简体   繁体   中英

HaarCascade training: merge .lst files

I am working on an own object detector using HaarCascade. BTW, I am stucked at some point, which I'll explain below.

The situation it's this: - I collected 100 images of my object (let's say apples) - I collected about 1500 negatives images - I created negatives.txt , a file which contains paths to the negatives images - I created positives.txt , a file which contains paths, number of objects, coordinates and dimensions of my positive images

Now, this is the problem.

Using opencv_createsamples.exe to augment my data/images, I saw that if I execute it (with same parameters) for each object image, the output will be more or less a 1000 positive images (negatives background + object) together with a .lst file containing path and object coordinates inside the negative image. These coordinates will not change (because I set them when I executed opencv_createsamples.exe ).

The question is: it's a good idea to change the parameters createsamples requires for each of my object image and then merge them all ?

Example of what I am doing now:

  • opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7
  • for one of my object image for each of my negatives
  • .lst file with info's (the same if execute for each positive ojbect image)

Example of what I am willing to do:

  • for each of my object image for each of my negatives
  • opencv_createsample.exe -p1 0.5 -p2 0.6 -p3 0.7 - opencv_createsample.exe -p1 0.6 -p2 0.7 -p3 0.8, and so on (with random values of parameters)
  • multiple .lst files with different info's for each object image
  • merge of all .lst

I really hope I explained all.

My doubt it's about efficiency of doing this: I will have a better accuracy by training using different objects (of the same class) in different position or it's the same by using only one object ?

Glossary:

  • object = what I want to detect (an apple)
  • negative image = background image not containing the object
  • positive image = processed image (createsamples output) with negative + object

Thanks all

UPDATE

Here after watching Sentdex video on HaarCascade: Training Haar cascade object detection - OpenCV with Python for Image and Video Analysis 20

I think you'd have better results training your model with multiple objects in each (positive) image. It also depends on what you want to achieve. 1. Try both approaches you mentioned in your question and test them using the same images. 2. Compare the effectiveness (accuracy of detection) and also efficiency (is there noticeable difference in speed, for instance?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM