@mymy
2021-09-24T13:25:22.000000Z
字数 3877
阅读 1371
机器学习
实验
你可以点击这里查看中文版本。
python3, at least including following python package: sklearn, numpy, matplotlib, pickle, PIL.
It is recommended to install anaconda3 directly, which has built-in python package above.
PyCharm Community Integrated Development Environment (optional).
2021-9-25 8:50-12:15 AM B7-231,233 (Mingkui Tan)
2021-10-7 11.59 AM
Complete Independently.
Face Classification
1. Load data set data. The images are supposed to converted into grayscale images with size of 24 * 24, the number and the proportion of the positive and negative samples is not limited, the data set label is not limited.
2. Processing data set data to extract NPD features. Extract features using the NPDFeature class in feature.py. (Tip: Because the time of the pretreatment is relatively long, it can be pretreated with pickle function library dump() save the data in the cache, then may be used load() function reads the characteristic data from cache.)
3. The data set is divisded into training set and calidation set, this experiment does not divide the test set.
4. Write all AdaboostClassifier functions based on the reserved interface in ensemble.py. The following is the guide of fit function in the AdaboostClassifier class:
4.1 Initialize training set weights , each training sample is given the same weight.
4.2Training a base classifier , which can be sklearn.tree library DecisionTreeClassifier.
4.3 Calculate the classification error rate of the base classifier on the training set.
4.4 Calculate the parameter according to the classification error rate .
4.5 Update training set weights .
4.6 Repeat steps 4.2-4.6 above for iteration, the number of iterations is based on the number of classifiers.
5. Predict and verify the accuracy on the validation set using the method in AdaboostClassifier and use classification_report () of the sklearn.metrics library function writes predicted result to classifier_report.txt .
Face Detection
1. Run the face_detection.py file. Experience the OpenCV's built-in method of face detection using Haar Feature-based Cascade Classifiers.The result will be save as detect_result.jpg.
2. You can provide your own images to replace the default test image.
Finishing experiment report according to result: The template of report can be found in example repository.
Item | Proportion | Description |
---|---|---|
Attendance | 40% | Ask for a leave if time conflict |
Code availability | 20% | Complied successfully |
Report | 30% | According to report model |
Code specification | 10% | Mainly consider whether using the readable variable name |
Any advice or idea is welcome to discuss with teaching assistant in QQ group.
[1] Liao, S., Jain, A. K., & Li, S. Z. (2016). A fast and accurate unconstrained face detector. IEEE transactions on pattern analysis and machine intelligence, 38(2), 211-223.
[2] 周志华. 机器学习. 北京:清华大学出版社,2016:173-177