Ask Your Question
0

Opencv_createsamples suddenly stopped producing vector files

asked 2017-11-16 15:14:58 -0600

Hello there,

I'm working a university project which makes use of haarclassifiers. I had been able to call the opencv_createsamples application to generate [num] vector files from a single image in the past. I understand that this method is less accurate for objects that are not rigid but it definitely helps boost the training data have.

My problem is that all of a sudden, whenever I call the opencv_createsamples application and I specify vector name, image name and background collection file, I get an error message from the computer that opencv stating the program has stopped working. When I try to use the debug function, it opens up visual studio and gives the following error:

Unhandled exception at 0x00007FF8D0DC775F (ntdll.dll) in opencv_createsamples.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FF8D0E286B0).

I don't understand what I could be doing wrong and would very much appreciate any insight.

Information possibly related
- I am running opencv version 3.3
- I use a windows 64 bit computer
- I call the command on the windows command line interface
- I already setup my environment variables and just calling "opencv_createsamples" shows the usage
- I have previously generated vector files from on single image using this program
- My -w -h is proportional to my cropped images
- I have rebooted a bunch of times

Below is the command I run:

opencv_createsamples.exe -img cropped01.png -num 10 -bg negatives2.txt -vec vector/sampledat.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 30 -h 24

Also, here is the first few lines of negatives2.txt file, this is about a 1000 lines long:

C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0015.jpg 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0016.JPG 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0017.JPG 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0020.JPG 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0037.JPG 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0038.JPG 
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0039.JPG
edit retag flag offensive close merge delete

Comments

It means that you're writing to an area of memory that is not owned by you. Are you sure that all of your loops reference a valid pixel index/location, things like that?

sjhalayka gravatar imagesjhalayka ( 2017-11-16 15:37:27 -0600 )edit

But I'm not calling any loops. I'm simply trying to run the opencv_createsamples application which stops running each time.

bohorsejackman gravatar imagebohorsejackman ( 2017-11-16 20:52:40 -0600 )edit

btw, you never told us, what you're trying to detect, but in the real world, this method of "synthesizing" positives from a single image NEVER works. you need a ton of REAL positive images, not generated ones.

also, please look at the docs , not at blogposts ..

berak gravatar imageberak ( 2017-11-17 01:29:44 -0600 )edit
1

Thanks for taking time to respond. Yes, I understand this. I am trying to detect a hand. I have 600 positive images that are real. I'm simply trying to generate around 25~ images for each real one I have. That will be used for vectors to boost my training data. I have read through the documentation for making use of the opencv_createsamples program and from my commands above it seemed to me like I had followed the expected usage. I just don't undertsand why I seem to be having problems with this particular program.

bohorsejackman gravatar imagebohorsejackman ( 2017-11-17 08:04:03 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-11-16 18:46:15 -0600

DrVivek gravatar image

do this process in two steps first create positive sample from single image you want to than create vector file of that

you need to make batch file write

createsamples.exe -img 33.jpg -bg neg/bg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1000

this will create 1000 positive samples, be sure first make folder of name info

than create vector file

createsamples.exe -info info/info.lst -num 1000 -w 20 -h 20 -vec positives.vec

bg.txt is negetive file list in directory neg info refer to positive folder

another tip while HAAR training numpos should be 900 means if you have 1000 than minus 100 than only training work well

edit flag offensive delete link more

Comments

Thanks for your suggestion, I will try this and report back.

bohorsejackman gravatar imagebohorsejackman ( 2017-11-16 20:57:18 -0600 )edit

So I tried the solution and still got an error that program had stopped working

Here is what I see

I got this when running the first command

bohorsejackman gravatar imagebohorsejackman ( 2017-11-16 21:08:03 -0600 )edit

you are working in haartrain folder so your positive croped image in the same folder, and you did mistake with -bg negetive.txt his info file should be with all negetive images and its path should be given then means -bg neg/negetive.txt and move your neg folder containing negtive images and negtive.txt file than run this ,it will work

DrVivek gravatar imageDrVivek ( 2017-11-17 02:18:35 -0600 )edit

Thanks a lot. It seems thee problem was likely the fact that my negatives.txt was not with the negatives.

bohorsejackman gravatar imagebohorsejackman ( 2017-11-17 08:18:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-11-16 15:07:11 -0600

Seen: 447 times

Last updated: Nov 16 '17