Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

opencv_createsamples not creating anything inside the 'samples' folder #9

Closed
ferranaltarriba opened this issue Feb 5, 2016 · 15 comments

Comments

@ferranaltarriba
Copy link

Hi there!

when I run the command:

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"

it doesn't create anything inside the 'samples' directory. I attach a screen capture showing it:
captura de pantalla 2016-02-05 a les 12 39 02

Am I doing something wrong?

Thanks a lot!! :)

@mrnugget
Copy link
Owner

Sorry, I don't see anything wrong with your command.

@anuragisi
Copy link

You are using 7 postive images.
So,you have to change that value in your code (i.e, 7 instead of 1500)

@harishpathak
Copy link

I have same issue...nothing is created in samples folder...I am on Mac

@rejaverion
Copy link

Hey I have the same issue. I'm on Windows. Only thing I changed is the w and h ratio, adjusted it to the right proportion with my images. I ran the command several times. Still no vec file shows up

@wei-han
Copy link

wei-han commented Dec 11, 2016

I was wondering if the number of samples in the step 5 should be the same as the number of positive images? I saw some people set the parameter different from the number of positive images.

@mrnugget
Copy link
Owner

I was wondering if the number of samples in the step 5 should be the same as the number of positive images? I saw some people set the parameter different from the number of positive images.

See this resource for more information: http://note.sonots.com/SciSoftware/haartraining.html#e5c54f60

The author of createsamples.pl writes here:

I also wrote a script, createtrainsamples.pl, to repeat the procedures 1000 (or some) times. I specified 7000 instead of 5000 as default because the Tutorial [1] states as "the reasonable number of positive samples is 7000." Please modify the path to createsamples and its option parameters directly written in the file.

The tutorial he's referencing is this one: http://note.sonots.com/SciSoftware/haartraining/document.html

@fazeelzama20
Copy link

@mrnugget i have changed the value from 7000 to 7 (as i have also used 7 positive images) in createsamples.pl, but then i didnt get the output. Anyone can help?

@johnd3v
Copy link

johnd3v commented Jan 19, 2018

hi man is this fixed?

@developer239
Copy link

developer239 commented Jan 19, 2018

Basically, if you can't run the command then it has bad parameters. I found many different answers on the internet because I had this problem twice and in the end it was always because I made some mistake when setting the parameters:

  • Make sure that positives.txt is not empty and its paths are correct
  • Make sure that negatives.txt is not empty and its paths are correct

Also try change this value: -w 32 -h 32 (sweet spot is between 15 to 35)

perl bin/createsamples.pl positives.txt negatives.txt samples 3000 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 0  -maxyangle 0 maxzangle 0 -maxidev 40 -w 32 -h 32"

I hope this helps.

@johnd3v
Copy link

johnd3v commented Jan 23, 2018

Still not working @developer239 no vec files created

@damiano1996
Copy link

I solved it changing the name of files, remove the spaces.

@bharatabhinav
Copy link

bharatabhinav commented Dec 5, 2018

when I run the command:

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"

it doesn't create anything inside the 'samples' directory. still i m facing same issue .. Please help me

I m running this command on REDHAT
Python version : 2.7 and opencv version :3.4.4
Thanks in Advance

@JizhouLiu-Daren
Copy link

JizhouLiu-Daren commented Sep 18, 2019

Hey guys,

I am wondering if I could help. I just met with this kind of problem while trying to use the createsamples function in opencv.
My case is that when I tried to build opencv, the "createsamples" did not occur. So when I finally want to use it, it does not respond. What I did to fix it is to go back to the opencv source file I downloaded from Github. Go to .../opencv/apps/CMakeLists.txt . Surprisingly, I found in the last but 3-4 lines that the commands "ocv_add_app(traincascade);ocv_add_app(createsamples)" are commented. I deleted the "#" and rebuild the program by following this https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html. Then I found it work.

@PrasadNR
Copy link

I don't have any spaces in my files. I have been trying with Cygwin on Windows and Ubuntu in VM. This used to work before. I am not sure what the issue is. I am using single channel grayscale images too. I am also avoiding setting unnecessary parameters like max angle for x, y, z and other parameters which are not needed. I am using 7404 positive samples and I tried that also (I clearly remember using some different number other than the number of positive samples and still getting it to work a year ago or so).

I have been stuck on this since hours and I don't know why this has been closed. I tried both 2.4.13 and 2.4.9 OpenCV versions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests