Comments (8)
Hi,
I faced the same problem and was solved by modifying the bg.txt
file . I've written the whole address to the bg images as follows :
E:\RProj\ALL_LABELS\trees\negative\img_0.jpg
E:\RProj\ALL_LABELS\trees\negative\img_1.jpg
E:\RProj\ALL_LABELS\trees\negative\img_2.jpg
E:\RProj\ALL_LABELS\trees\negative\img_3.jpg
E:\RProj\ALL_LABELS\trees\negative\img_4.jpg
E:\RProj\ALL_LABELS\trees\negative\img_5.jpg
E:\RProj\ALL_LABELS\trees\negative\img_6.jpg
E:\RProj\ALL_LABELS\trees\negative\img_7.jpg
E:\RProj\ALL_LABELS\trees\negative\img_8.jpg
E:\RProj\ALL_LABELS\trees\negative\img_9.jpg
E:\RProj\ALL_LABELS\trees\negative\img_10.jpg
E:\RProj\ALL_LABELS\trees\negative\img_11.jpg
E:\RProj\ALL_LABELS\trees\negative\img_12.jpg
E:\RProj\ALL_LABELS\trees\negative\img_13.jpg
E:\RProj\ALL_LABELS\trees\negative\img_14.jpg
.
.
.
.
from opencv-haar-classifier-training.
Hi,
I faced the same problem and was solved by modifying thebg.txt
file . I've written the whole address to the bg images as follows :E:\RProj\ALL_LABELS\trees\negative\img_0.jpg E:\RProj\ALL_LABELS\trees\negative\img_1.jpg E:\RProj\ALL_LABELS\trees\negative\img_2.jpg E:\RProj\ALL_LABELS\trees\negative\img_3.jpg E:\RProj\ALL_LABELS\trees\negative\img_4.jpg E:\RProj\ALL_LABELS\trees\negative\img_5.jpg E:\RProj\ALL_LABELS\trees\negative\img_6.jpg E:\RProj\ALL_LABELS\trees\negative\img_7.jpg E:\RProj\ALL_LABELS\trees\negative\img_8.jpg E:\RProj\ALL_LABELS\trees\negative\img_9.jpg E:\RProj\ALL_LABELS\trees\negative\img_10.jpg E:\RProj\ALL_LABELS\trees\negative\img_11.jpg E:\RProj\ALL_LABELS\trees\negative\img_12.jpg E:\RProj\ALL_LABELS\trees\negative\img_13.jpg E:\RProj\ALL_LABELS\trees\negative\img_14.jpg . . . .
I was looking through the same situation and thankfully this was the answer, thanks!
from opencv-haar-classifier-training.
Hey!
That's a pretty common error. See all these questions on the OpenCV board. There is not much I know about this error and I can only guess a solution, since there are a lot of possible reasons for that error.
And without any information about your setup there is nothing I can do.
from opencv-haar-classifier-training.
I have 55 positive images and 395 negative images (all images are 32x32).
I created my pos.dat and neg.dat files as:
$ find positive_images/ -name '.jpg' -exec echo {} 1 0 0 32 32 ; > pos.dat
$ find negative_images/ -name '.jpg' > neg.dat
Create my vec file as:
$ opencv_createsamples -info pos.dat -w 24 -h 24 -vec flowers.vec -num 55
And my training:
$ opencv_traincascade -data data_5 -vec flowers.vec -bg neg.dat -numStages 5 -numPos 55 -numNeg 395 -w 24 -h 24
And I got the following output error:
PARAMETERS:
cascadeDirName: data_5
vecFileName: flowers.vec
bgFileName: neg.txt
numPos: 55
numNeg: 395
numStages: 5
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 55 : 55
NEG count : acceptanceRatio 395 : 1
Precalculation time: 2
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1|0.0683544|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 8 seconds.
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 55 : 55
NEG count : acceptanceRatio 395 : 0.123592
Precalculation time: 1
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 0.265823|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 16 seconds.
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 55 : 55
NEG count : acceptanceRatio 395 : 0.0283154
Required leaf false alarm rate achieved. Branch training terminated.
from opencv-haar-classifier-training.
Sorry, I have no idea! Again, I can only guess.
And since this problem doesn't directly affect this project, I'm closing the issue for now.
from opencv-haar-classifier-training.
i have same problem, but when i put the bg.txt into build/bin directory, the error has gone, works fine now
i think it is a bug in opencv 3.1.0, since the -bg parameter did not support any path/dir, with the file name
from opencv-haar-classifier-training.
also have this problem and do not find a way to handle this.
from opencv-haar-classifier-training.
Hello,
I want to confirm that paths in the bg.txt file need to be absolute.
On linux I was forced to use paths as /home/..../image.jpg to don't get this error.
Adding path as -bg parameter didn't work.
Used OpenCV 3.4.10 build
from opencv-haar-classifier-training.
Related Issues (20)
- hi, i'm getting like this while creating my own harr-cascade classifier, please let me correct if anything wrong, and please tell the reason for why classifier cant be trained? and thanks in advance HOT 3
- Illegal division by zero at bin/createsamples.pl line 45. HOT 3
- OpenCV error : Bad Arguement - Can not get new Positive Sample
- no vec files
- Can not see finished_classifier.xml file HOT 15
- unable to create .vec files with create samples file HOT 1
- how createsamples.pl will works? HOT 1
- Error when create samples HOT 1
- Cannot create sample.vec HOT 14
- opencv_createsamples not creating anything inside the 'samples' folder HOT 1
- not able to create final classifier HOT 1
- File not found - '*.jpg' HOT 1
- Please Help
- std::logic_error
- opencv error assertion failed
- sh: 1: Syntax error: Unterminated quoted string HOT 1
- opencv_traincascade assertion error HOT 2
- vec files can't be created HOT 1
- mergevec.py error
- 'opencv_createsamples' is not recognized as an internal or external command, HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-haar-classifier-training.