This is a toolbox to train, test, and run HAAR/LBP cascade easily.
- C++17
- Cmake:
sudo apt install cmake
- Zenity:
sudo apt install zenity
- OpenCV (versions 2 or 3):
sudo apt install libopencv-dev
- Simd (Optional)
git clone https://github.com/zanazakaryaie/Cascade_Toolbox.git
cd Cascade_Toolbox
mkdir build && cd build
cmake ..
make
If you want to use Simd library to accelerate the detection, replace the cmake command by:
cmake -DBUILD_SIMD_INFERENCE=ON -DSIMD_LIBRARY_PATH=~/Simd ..
Run the generated executables in the build folder following this order:
-
collect_train_data
Input: a training video (.mp4 or .avi)
Instructions: draw and edit positive boxes with mouse (no need to draw negatives), press space to move to the next frames
Output: Positive and Negative folders that contain sample images -
collect_test_data
Input: a testing video (.mp4 or .avi)
Instructions: draw and edit positive boxes with mouse, press space to move to the next frames
Output: a folder that contain .txt annotations of each frame -
train
Input: configs.yaml file, Positive and Negative folders
Instructions: just wait for the training to finish
Output: trained model in .xml format -
test
Input: the testing video, the testing directory (output of 2), and the trained .xml model
Output: prints the Precision and Recall of the trained detector -
hard_negative_mine
Input: the training video, the trained .xml model
Instructions: right-click in false positives, press space to move to the next frames.
Output: new negative images added to the Negative folder -
train
This is for including hard negatives and training a more accurate model. -
inference or inference_simd (if linked with Simd library)
Input: a video (.mp4 or .avi) and the trained .xml model
Output: the video played with detected objects and FPS
For more details read my posts on cascade algorithm and training a cascade model