Histogram of oriented gradients is a feature descriptor used in image processing and has recently got a lot of attention for the purpose of object detection.
HOG with SVM has given very good results. Their implementation has been provided in the OpenCV library. However, the library uses its own SVM implementation in C++.
hog-svm-tf
is an approach to use tensorflow
for SVM training while we continue to use HOG with OpenCV.
The project has 3 modules (for now):
sample_create
- For generating a lot of sample data from the given set of input. Based on rotation and scaling, this will generate more sample data for training.feature_engineering
- It generates the hog descriptors and save the data to be used for training.linear_svm
- It is a generic linear SVM implementation. It uses the training data generated in last step and creates a tensorflow model. After creating a tensorflow model, save the model.eval_image.py
- It evalutaes a folder of image according to the tensorflow checkpoint.
sample_create.py
> python3 sample_create.py -p /Users/cprakashagr/Pictures/MCQSheet/128x256/pos -n /Users/cprakashagr/Pictures/MCQSheet/128x256/neg
feature_engineering.py
> python3 feature_engineering.py -p /Users/cprakashagr/Pictures/MCQSheet/128x256/pos -n /Users/cprakashagr/Pictures/MCQSheet/128x256/neg
linear_svm.py
> python3 linear_svm.py --train trainData.csv --svmC 1 --verbose True --num_epochs 10
eval_image.py
> python3 eval_image.py -i /path/to/imagefoler
TODO
- More samples creation based on brightness and contrast alteration
- Support for Keras and OpenCL
- Visualisation module for the tensorflow model
- add the evaluation program to the project