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

Can not see finished_classifier.xml file #49

Open
lyhoangnam-archway opened this issue Jan 21, 2018 · 15 comments
Open

Can not see finished_classifier.xml file #49

lyhoangnam-archway opened this issue Jan 21, 2018 · 15 comments

Comments

@lyhoangnam-archway
Copy link

Dear pro!
I tried to convert a picture to an "image_learning.xml" file
I cloned your project and do step by step, there was no error!

I got the results from "opencv-haar-classifier-training\classifier" folder
There were 1 params.xml file and 9 stage.xml file

image

I wonder where is the finished_classifier.xml ?

Thanks for help!

Ly Hoang Nam

@lyhoangnam-archway lyhoangnam-archway changed the title Can not finished_classifier.xml file Can not see finished_classifier.xml file Jan 21, 2018
@johnd3v
Copy link

johnd3v commented Jan 22, 2018

hi man. what did you do to have vec files in perl bin/createsample.bin. i have try the code yet not creating any file in samples forlder

@lyhoangnam-archway
Copy link
Author

Dear @johnd3v !
I do as the guide in this repository:
Step 5

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"

Which error occured with you?

@johnd3v
Copy link

johnd3v commented Jan 22, 2018

@lyhoangnam-archway thanks for the reply.
i got only this sir.
screenshot from 2018-01-22 18-32-32

no file created in sample folder

@lyhoangnam-archway
Copy link
Author

Dear @johnd3v !
It did not throw any error, I think that all seem to be done
Try next step(number 6). I think so!

@johnd3v
Copy link

johnd3v commented Jan 23, 2018

@lyhoangnam-archway thanks for the reply.
i tried step6 yet this is the result.

badly need to create my own classifier for my last year research

@lyhoangnam-archway
Copy link
Author

Dear @johnd3v !
Can you get your result?
I still waiting for the author...he do not reply my question!

:( :( :(

@saideepthik
Copy link

Dear @johnd3v !
naotoshio seo explained this mechanism in creating samples. how means, vector samples are images which include positives in negative background images.
so, it all depends on your object how complex it is and whether +ve images needed more or -ve images needed more to generate the .vec files.
i got this error many times while creating samples using createsamples.pl file at that time i change the ratio of +ves and -ves then it will work fine.
and one noticeable point is here size also matters because if positive image is having more resolution than -ve image then it cant be impose its features on -ve background. so its good if all images having same size.
but one thing disappointing me is i haven't get exact information on this! till searching for this..........

@saideepthik
Copy link

@lyhoangnam-archway !
There were 1 params.xml file and 9 stage.xml file
I wonder where is the finished_classifier.xml ?

because classifier achieved the accuracy in training the .vec files at the stage of 9th. please look this image.
classifier

f you want to convert an intermediate haartraining output dir tree data into a xml file, there is a software at the OpenCV/samples/c/convert_cascade.c (that is, in your installation directory). Compile it.
how to compile ? -->> https://www.learnopencv.com/how-to-compile-opencv-sample-code/
so, you can create the cascade.xml file using this command
$ convert_cascade --size="<sample_width>x<sampe_height>" <haartraining_ouput_dir> <ouput_file>
example : convert_cascade --size="20x20" classifier haarcascade.xml

@lyhoangnam-archway
Copy link
Author

Dear @saideepthik !
It means that I have to manually merge all stage.xml file to finished_classifier.xml
I think that this tool will do all of this step...

@saideepthik
Copy link

@lyhoangnam-archway
"I have to manually merge all stage.xml file to finished_classifier.xml
I think that this tool will do all of this step...
"
for this, actually say no need to do manually just give less number of stages while training or else give more positives and negatives do same from first step (delete .vec files in samples folder then do) you will get cascade.xml file

@kapslocker
Copy link

kapslocker commented Apr 4, 2018

@johnd3v
I hope it's not too late. I had the same issue as you do. It was an OpenCV bug. I was working with a newer version of OpenCV (3.4.1). The code works when I use it with OpenCV version 3.2.0.
No files were generated because a segmentation fault was thrown by opencv_createsamples.
Hope this helps.
The issue can be closed.

@arizalzr
Copy link

arizalzr commented Jun 3, 2018

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, anyone can help me ?

@arizalzr
Copy link

arizalzr commented Jun 3, 2018

@saideepthik
how to change the image ratio ? can you help my problem ?

@saideepthik
Copy link

@arizalzr
Ratio in the sense increase or decrease the number of input images (positive images and negative images) for the training.
check while testing the image detection whether r u getting more false positives or not, if getting false positives means just take (save as images ) those false positives give as negative images and train the same.
observable thing is sometime u need to give more appropriate positive images (depends on how complicated is your object to be detected) it will give good results.
try u will get...........

@arizalzr
Copy link

arizalzr commented Jun 4, 2018

@saideepthik
why after run this :

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"

there is no sample.vec created ? can you help me to solve this ?

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

5 participants