Opencv train cascade haar and lbp training Opencv train cascade script parameter examples for Windows. Traincascade utility is easy to use for training HAAR-like and LBP-like cascade for opencv detect multiscale by CascadeClassifier. On this blog, you can find several examples of how to detect something by the HAAR and LBP cascade.

Opencv traincascade examples
I am using this parameter. You can start where you just ended before. This makes sense. Train for 5 stages and test. If the results with a higher threshold make sense. Train again with the same script and increase numStages. After some time training is much and much slower and test before you run the training for a long time.
This is my script.. If you have any
opencv_traincascade.exe -data v -vec vec.vec -bg bg.dat -numPos 300 -numNeg 300 -numStages 10 -numThreads 2 -stageType BOOST -featureType LBP -w 32 -h 64 -minHitRate 0.995 -maxFalseAlarmRate 0.42 -maxDepth 1 -maxWeakCount 100
opencv_traincascade.exe -data vv -vec vec.vec -bg bg.dat -numPos 540 -numNeg 800 -numStages 8 -numThreads 4 -stageType BOOST -featureType LBP -w 32 -h 64 -minHitRate 0.9995 -maxFalseAlarmRate 0.32 -maxDepth 5 -maxWeakCount 120
opencv_traincascade.exe -data cascade -vec vec.vec -bg bg.dat -numPos 680 -numNeg 800 -numStages 10 numThreads 4 -stageType BOOST -featureType LBP -w 32 -h 64 -minHitRate 0.999995 -maxFalseAlarmRate 0.42 -maxDepth 10 -maxWeakCount 120 -mode ALL
opencv traincascade documentation description
Later abou this.. Complex staff. Just try example if you have some datasets prepared or know the how to prepare vector_file and background file for training.
Usage: opencv_traincascade.exe -data <cascade_dir_name> -vec <vec_file_name> -bg <background_file_name> [-numPos <number_of_positive_samples = 2000>] [-numNeg <number_of_negative_samples = 1000>] [-numStages <number_of_stages = 20>] [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = 1024>] [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = 1024>] [-baseFormatSave] [-numThreads <max_number_of_threads = 9>] [-acceptanceRatioBreakValue <value> = -1>] —cascadeParams— [-stageType <BOOST(default)>] [-featureType <{HAAR(default), LBP, HOG}>] [-w <sampleWidth = 24>] [-h <sampleHeight = 24>] —boostParams— [-bt <{DAB, RAB, LB, GAB(default)}>] [-minHitRate <min_hit_rate> = 0.995>] [-maxFalseAlarmRate <max_false_alarm_rate = 0.5>] [-weightTrimRate <weight_trim_rate = 0.95>] [-maxDepth <max_depth_of_weak_tree = 1>] [-maxWeakCount <max_weak_tree_count = 100>] —haarFeatureParams— [-mode <BASIC(default) | CORE | ALL —lbpFeatureParams— —HOGFeatureParams—


