This is a HAAR Cascade Classifier training GUI application for Linux. This application makes it really easy to train classifiers for object detection and tracking using opencv by providing a Graphical user interface to set parameters and perform necessary steps.
This script has some minimum system requirements to run. They are listed as follows:
The script can run with these minimum requirements and can install other packages automatically. However, it is recommended that you install the following packages before running the application:
This application is super easy to use! Here are all the step from downloading the application till testing your classifier:
You need to first clone all the files from the github repository. Visit the repositiry and download it as a zip file or just open the terminal and type the following command:
git clone https://github.com/amannirala13/HAAR-Cascade-Trainer-Linux.git
Once downloaded open the terminal in the downloaded directory to make it the present working directory.
Once changed the pwd, you need to make all the file in the ./app
directory executable, use the following command to change the permission of the files:
chmod -R a+x ./app
Change you pwd to the app and execute the main.py
with python using the following command:
python3 main.py
This will launch the application interface with which you can train your HAAR Cascade classifier with your dataset.
Now, you have the application ready and running to train you classifier. The steps below tell you how you can train the classifier using actual dataset.
To train a HAAR Cascade Classifier you will have to create two directories with positive and negative images i.e. images with the target object and the images without the target object accordingly. Provide the location of the directories of the positive dataset and negative dataset as per asked in the application.
Then you need to select an output directory to tell the application where to store the classifier.xml
file. Its recommended although not necessage to keep both the directories in the same directory and use that directory as the output directory.
Now provide the width and height of the traget object which is by default set to 24x24.
Now provide the percent of positive sample you want to use for the training of the classifier.
Set the number of stages of training of your classifier which by default is set to 10.
Press the start button to start training!
When the training is done, you can file your classifier.xml
file in the output directory as ./classifier/classifier.xml
This application doesn't cleans the data and the vectors are generate automatically on the positive dataset so its highly recommended that your positive images are well cropped and only contain the target object. I will be adding a cropper, an image labeler, seperate vector file providing and positive dataset generation using single image features in the coming versions. Till then just manage with this small drawback.
If you like my work, a bit of contribution would motivate me a lot for more open source contributions.
Please support the work: