mrnugget / opencv-haar-classifier-training

Learn how to train your own OpenCV Haar classifier
Other
735 stars 470 forks source link

Cannot create sample.vec #53

Open arizalzr opened 6 years ago

arizalzr commented 6 years ago

I already run

perl bin/createsamples.pl positives.txt negatives.txt samples 1500\ "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"

but there is no sample.vec created, how to fix this sir ? i hope you can help my problems

saideepthik commented 6 years ago

@arizalzr https://github.com/mrnugget/opencv-haar-classifier-training/issues/50 same issue raised by me initially go though link its works, but yet to find the in depth concept try your level best. once go through all issues for further use.

arizalzr commented 6 years ago

@saideepthik how you fix it ?

saideepthik commented 6 years ago

will u give details that how many positives and negative images u gave then then commands u used and all, then i will get to know ur problem correctly, and also check all folders onces samples folder aslo, if sample folder is having any file already just delete them then do train.

arizalzr commented 6 years ago

@saideepthik i use 60 positive image and 600 negative image, like on the tutorial. with all picture ratio 100x100 there is no file on samples folder sir

saideepthik commented 6 years ago

"i use 60 positive image and 600 negative image, like on the tutorial." it wont be same for every object detection. it depends on images you selected for training which are more clear objects and background images also will effect, so increase positive images and try u can take pictures from your cam which you are using now just have code if you want in this below link https://github.com/saideepthik/learning-python/blob/python/opencv-resize_save.py still getting problem means check once by resizing the images, i gave 300x300 resolution for every image. and also check the bin folder path once while training this step

arizalzr commented 6 years ago

@saideepthik

what is the best comparison between positive and negative images

arizalzr commented 6 years ago

@saideepthik i already try resize and increase positive images, but still not work,

joshdabosh commented 6 years ago

@arizalzr positive images are the images that contain only the objects you want to detect, while negative images are images that contain anything but the objects.

CagriYonca commented 6 years ago

Hello to everyone! Same error appeared when I try to merge vectors. Then I've used python2.7 instead of python and just merged. So try:

python2.7 tools/mergevec.py -v samples -o samples.vec

xqiangx1991 commented 5 years ago

does anyone solve this problem?

rnogy commented 5 years ago

try

find ./positive_images -iname "*.jpg" | sed -r 's/^.{18}/\"/' | awk '{print $0"\""}' > positives.txt
i=0
while IFS= read -r line; do echo opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1   -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40 -img ./positive_images/"$line" -bg tmp -vec samples/"$i".vec ; i=$((i+1)); done < positives.txt > do.sh
sh do.sh
yashjha123 commented 5 years ago

use apt install libopencv-dev

PrasadNR commented 4 years ago

https://github.com/mrnugget/opencv-haar-classifier-training/issues/9#issuecomment-660239472 Same issue has popped up repeatedly and it has not been solved yet.

yashjha123 commented 4 years ago

use apt install libopencv-dev

In my case the above code fixes the issue