Giter Site home page Giter Site logo

Comments (8)

MahmoudAbdelRahman avatar MahmoudAbdelRahman commented on June 24, 2024 3

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.

ignacio-escalera avatar ignacio-escalera commented on June 24, 2024 1

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
.
.
.
.

I was looking through the same situation and thankfully this was the answer, thanks!

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on June 24, 2024

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.

romulogcerqueira avatar romulogcerqueira commented on June 24, 2024

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.

mrnugget avatar mrnugget commented on June 24, 2024

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.

gloomyfish avatar gloomyfish commented on June 24, 2024

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.

DamonDBT avatar DamonDBT commented on June 24, 2024

also have this problem and do not find a way to handle this.

from opencv-haar-classifier-training.

rbk1234567 avatar rbk1234567 commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.