Ask Your Question
0

Minimize False Positives using opencv_traincascade

asked 2013-10-17 04:42:36 -0600

Samjakar gravatar image

I am using opencv to detect a brand logo in different possible orientations.

1) Since the logo is a constant image, I used opencv_createsamples with a single logo image. I had used the default value for the -num parameter ( which amounts to 1000). My syntax is as below: opencv_createsamples -img ../brandname.jpg -vec brandnamew100h30.vec -w 100 -h 30

I created a VEC file with parameter of width 100 and height 30. The actual image dimensions are bigger than the size used here. Note that I am NOT using the background images for the sample creation. The sample creation will just contain the brands and not the background.

2) I am then using the opencv_traincascade to train this VEC file. opencv_traincascade -data "brandxml" -vec brandnamew100h30.vec -bg ../tobmp/neglist.txt -numPos 600 -numNeg 300 -w 100 -h 30 -featuretype LBP

The bg file here is just random background images and not relevant to where the brand might appear (in the test video below) When I try to match images/videos using the resultant xml, I am getting a lot of false positives.

Any suggestions on how to decrease the false positives?

Karthik

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-10-17 06:01:32 -0600

I guess you should specify better what different orientations mean. Do you mean small deformations? Or litterally the possibility of rotating an existing logo over 360°. This is in fact a big difference and both need totally other approaches.

As to your cascade model approach

  • Using random negative BG images is actually not the best approach. Either you supply multiple thousands of negatives, which could average out the variation in the background or you use samples that have actual a meaning. Either way, 300 negatives will never give you good results if you are detecting the logo 'in the wild' which means in every possible situation. If you want to achieve that, go for example for 10.000 negatives.
  • Using a single image and transform it to find the logo, only works in very controlled testing situations. It is way better to capture possible situations of the logo, annotate them as positives and use the other approach of openCV create samples to create the image vector. The transformation that are applied in your case create artificial structures which yields bad results. This is however badly documented...
  • Also, using a logo of 100 x 30 pixels in size won't give you problems now, but once you go for like 5000 pos and 10.000 negatives, this will generate huge memory problems. The train cascade applications stores large amounts of data in memory, which isn't so good, but which limits it capabilities. Try reducing your size to for example 50 x 15 or even 25 x 7.

Hopefully these insights help out. Also, use the search button on this forum, look for cascade classification and train cascade and you will find tons of topics where people have gathered good information about this problem.

edit flag offensive delete link more

Comments

Hi Steve, I had not subscribed to this question. So, I had not noticed you'd answered. I'll review your comments and will revert back. Thanks Karthik

Samjakar gravatar imageSamjakar ( 2013-10-28 01:47:20 -0600 )edit

Steve, Very Insightful. 1) The orientation I am interested is only about 60-70degree rotation with camera taking a shot from different positions. Not a fill 180Degree turn. 2) You have mentioned that I should use "you use samples that have actual a meaning.". Say for example, I am looking for billboards on the street, a valid bg image will be roads, buildings, sky etc but, not having the logo of interest, is it? 3)"Using a single image and transform it to find the logo, only works in very controlled testing situations". Can I use this method if I know the background of where I'd be detecting, like say detecting brands on billboards/Hoardings on the streets? Is it possible for me to combine the results of create samples with one image and using 1000 other images? Thanks Karthik

Samjakar gravatar imageSamjakar ( 2013-10-28 01:59:27 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-10-17 04:42:36 -0600

Seen: 458 times

Last updated: Oct 17 '13