Ask Your Question
0

opencv traincascade on windows

asked 2018-04-18 13:05:03 -0600

samnick gravatar image

I am new to opencv and I am trying to train a classifier using opencv_traincascade command there are number of tutorial I watch and some articles I read but I am confused about some parameter we pass to opencv_traincascade and will be really helpful if someone can explain following is the command I used for training:
opencv_traincascade -data /out -vec /positive/vecfile.vec -bg /negative/negative.txt -w 290 -h 150 -numPos 800 -numNeg 800 -maxFalseAlarmRate 0.45 -featureType LBP -numStages 10
Here is some explanation:
System: Z620 dual Processor with 32 Gb of Ram

OpenCV 3.0

OS: Windows 10 64 bit

-data /out is the output directory

-vec /positive/vecfile.vec vector file having all the positive images

-bg /negative/negative.txt negative txt file containing negative images info

-w 290 width of my object in real time(not sure in what it get measured in opencv like px,cm,mm,inch. in real time it is 290mm)

-h 150 height of my object in real time (not sure in what it get measured in opencv like px,cm,mm,inch. in real time it is 150mm)

numPos 800 number of positive images to train with

numNeg 800 number of negitive images to train with

-maxFalseAlarmRate 0.45 not exactly sure about what it is but it seems to be ratio of wrong detection i think

featureType LBP Algorithm we used to train with

-numStages 10 number of stages the training will go

I am following these steps :
http://doc.openalpr.com/opensource.ht...
1) I am confused about the width and height of my object as many examples are using way smaller like 24 width and 24 height or 60 width and 30 height it looks like my width and height values are too high.
2) It is very slow on my xeon machine it suppose to be faster do i need to configure something special about the machine or about opencv.
Please suggest.

edit retag flag offensive close merge delete

Comments

  • do NOT follow any arbitrary , silly blog posts, ever. (they're all lying) follow docs instead
  • 290x150might be far too large, to be useful. remember, it's the minimum size, that can be detected later.
berak gravatar imageberak ( 2018-04-18 13:17:36 -0600 )edit

Hi break no need for I dont know much about it it may be not usefull to any newcomer I understand that fully accept my mistake I will try to be better at posting questions.

samnick gravatar imagesamnick ( 2018-04-18 16:07:17 -0600 )edit

I also want to know one more thing about system requirements the system I am using is that enough for that like dual xeon and 32 gb ram or I need to upgrade my system for getting result faster please suggest for some system which are good enough to run that process in 2 3 days or even 4 days

samnick gravatar imagesamnick ( 2018-04-18 16:10:07 -0600 )edit

Right now It had been 2 days the process is running and still on stage 1 and it created 3 rows only in stage 1 of HR and FA table I will share the output screen shot later please guide me

samnick gravatar imagesamnick ( 2018-04-18 16:12:54 -0600 )edit

I would really like some guide lines for making my question better for others thanks in advance for your response

samnick gravatar imagesamnick ( 2018-04-18 16:14:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-04-19 03:47:53 -0600

Lets start by referring you to chapter 5 of the OpenCV 3 Blueprints book. I am still quite convinced [and let's ignore the fact that I was the author] it has one of the most detailed explanations of all the parameters and their influence when training cascade classifiers, simply because all those blogs got it wrong in 90% of the cases.

Some comments on your parameters

  • As pointed out by @berak a resolution of 290x150 pixels will be too large probably. Not only will it need a great amount of memory (although you have 32GB), it will yield millions of features. For example, the 24x24 pixel face detector has already 35000 unique features. And it raises exponentially. That means that for calculating each weak classifier, you will need to evaluate all those features over your training set to select the strongest one (boosting process) and thus that will take ages.
  • For now, you are not using the full potential of your memory. By default -precalcValBufSize and -precalcIdxBufSize are limited to 2GB of memory ... so increase them to at least 8-10 GB in your case.
  • Make sure your OpenCV is built with TBB, it helps a bit in the parallelized parts of the training.
  • Same number of positives and negatives usually doesn't work. In my case I always end up with 1:4 ratios up to even 1:25 ratios when having large numbers. There is simply alot that your detector has to identify as negatives!

Also, try the search bar on this page, I guess it has been explained over multiple 100's of times already into quite the detail!

edit flag offensive delete link more

Comments

1

thank you steven the fix for width and height helps me alot the model i was training from last two days and it didn't go forward than stage 1 is completed just by changing width and height values in 40 mints. and again thanks for the reference of the book i wil make sure to read it

samnick gravatar imagesamnick ( 2018-04-20 01:12:43 -0600 )edit
1

i am also thankful to @berak who guide me to the right path

samnick gravatar imagesamnick ( 2018-04-20 01:13:52 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-18 13:05:03 -0600

Seen: 881 times

Last updated: Apr 19 '18