OPENCV_HAARTRAINING(1)

πŸ“¦ version 4.5.4, in ubuntu jammy

✨ NAME ✨

okay so this is opencv_haartraining β€” it trains a classifier. that's it, that's the vibe. it's the OPENCV_HAARTRAINING(1) girlie from the User Commands section and she is booked and busy πŸ’…


🌸 SYNOPSIS 🌸

opencv_haartraining [options]

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, opencv_haartraining is literally training the classifier. and here's the cute part: while it's running you can already peek and get an impression of whether your classifier is gonna be suitable, or if you need to go back and improve the training set and/or the parameters. it's giving "live progress, no waiting for the finale" πŸ’–

in the output, here's what you're reading:

  • 'POS:' β€” shows the hitrate in the set of training samples. this should be equal or near to 1.0, same energy as in stage 0. πŸ‘‘
  • 'NEG:' β€” indicates the false alarm rate. it should reach at least 5*10-6 to be a usable classifier for real world applications. like, that's the bar, no cap.
⚠️ if one of the above values gets 0 (zero) there is an overflow. in this case the false alarm rate is so low that further training doesn't make sense anymore, so it can be stopped. not me telling you to just let it go πŸ’€

πŸŽ€ OPTIONS πŸŽ€

opencv_haartraining supports the following options:

  • -data dir_name β€” the directory in which the trained classifier is stored. this is where your baby lives 🍼
  • -vec vec_file_name β€” the file name of the positive samples file (e.g. created by the opencv_createsamples(1) utility).
  • -bg background_file_name β€” the background description file (the negative sample set). it contains a list of images into which randomly distorted versions of the object are pasted for positive sample generation. chaotic, but make it fashion.
  • -bg-vecfile β€” this option is that bgfilename represents a vec file with discrete negatives. the default is not set.
  • -npos number_of_positive_samples β€” the number of positive samples used in training of each classifier stage. the default is 2000.
  • -nneg number_of_negative_samples β€” the number of negative samples used in training of each classifier stage. the default is 2000.

reasonable values are -npos 7000 -nneg 3000. πŸ‘€

  • -nstages number_of_stage β€” the number of stages to be trained. the default is 14.
  • -nsplits number_of_splits β€” determine the weak classifier used in stage classifiers. if the value is:
    1. 1, then a simple stump classifier is used
    2. >=2, then CART classifier with number_of_splits internal (split) nodes is used

the default is 1.

  • -mem memory_in_MB β€” available memory in MB for precalculation. the more memory you have the faster the training process is. the default is 200.
  • -sym, -nonsym β€” specify whether the object class under training has vertical symmetry or not. vertical symmetry speeds up training process and reduces memory usage. for instance, frontal faces show off vertical symmetry. the default is -sym. ✨ symmetrical queen ✨
  • -minhitrate min_hit_rate β€” the minimal desired hit rate for each stage classifier. overall hit rate may be estimated as min_hit_rate^number_of_stages. the default is 0.950000.
  • -maxfalsealarm max_false_alarm_rate β€” the maximal desired false alarm rate for each stage classifier. overall false alarm rate may be estimated as max_false_alarm_rate^number_of_stages. the default is 0.500000.
  • -weighttrimming weight_trimming β€” specifies whether and how much weight trimming should be used. the default is 0.950000. a decent choice is 0.900000.
  • -eqw β€” specify if initial weights of all samples will be equal. equality, we love her 🫢
  • -mode {BASIC|CORE|ALL} β€” select the type of haar features set used in training. BASIC uses only upright features, while CORE uses the full upright feature set and ALL uses the full set of upright and 45 degree rotated feature set. the default is BASIC.

for more information on this see http://www.lienhart.de/ICIP2002.pdf. πŸ“š

  • -h sample_height β€” the sample height (must have the same value as used during creation). the default is 24.
  • -w sample_width β€” the sample width (must have the same value as used during creation). the default is 24.
  • -bt {DAB|RAB|LB|GAB} β€” the type of the applied boosting algorithm. you can choose between Discrete AdaBoost (DAB), Real AdaBoost (RAB), LogitBoost (LB) and Gentle AdaBoost (GAB). the default is GAB. pick your fighter πŸ’…
  • -err {misclass|gini|entropy} β€” the type of used error if Discrete AdaBoost (-bt DAB) algorithm is applied. the default is misclass.
  • -maxtreesplits max_number_of_splits_in_tree_cascade β€” the maximal number of splits in a tree cascade. the default is 0.
  • -minpos min_number_of_positive_samples_per_cluster β€” the minimal number of positive samples per cluster. the default is 500.

the same information is shown, if opencv_haartraining is called without any arguments/options. so like, if you're confused, just run it naked and it'll spill the tea πŸ“


🌈 EXAMPLES 🌈

TODO

not the manpage leaving the examples as a TODO 😭 bestie we're all waiting

πŸ‘‘ SEE ALSO πŸ‘‘

more information and examples can be found in the OpenCV documentation.


πŸ’œ AUTHORS πŸ’œ

this manual page was written by Daniel Leidert <daniel.leidert@wgdd.de> and Nobuhiro Iwamatsu <iwamatsu@debian.org> for the Debian project (but may be used by others). icons, fr fr 🫢


okay that's the whole page, mwah πŸ’‹ it's from OpenCV, dated May 2010, and the original header/footer said OPENCV_HAARTRAINING(1) top and bottom β€” so there you go bestie, go train that classifier and slay βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from