Ask Your Question

opencv_traincascade not working with cvhaardetectobject in python

asked 2013-07-04 04:03:38 -0500

VoidMee gravatar image

updated 2013-07-04 06:22:19 -0500

Hello, I am doing training using opencv_traincascade. I tried to use the output file at stage 16 do detect object using opencv 2.4.3. When I load my classifier in cvHaarDetectObjet, this gave me output error:

"The node does not represent a user object (unknown type?)"

I tried the classifier output of opencv_haartraining but it worked. I am using Python 2.7.3 32-bit

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-04 06:26:35 -0500

You are probably just using the stage16.xml file, which isn't the exact cascade model. You need to rerun your training on the same folder, with 16 stages given, it will see that the stages are calculated and create the resulting cascade.xml file!

edit flag offensive delete link more


sorry, but i have used cascade.xml too but it doesn't work out

VoidMee gravatar imageVoidMee ( 2013-07-04 07:03:12 -0500 )edit

Are you using the new or old xml structure? From opencCV 2.4.3 be sure to only use the new structure. Having that said, also try the latest stable version 2.4.6 which is just released and could have a fix for a bug.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-04 07:21:29 -0500 )edit

Sorry to say but I didn't understand what is new or old xml structure. How can I check my version of xml structure?

VoidMee gravatar imageVoidMee ( 2013-07-04 07:33:10 -0500 )edit

I have used the output cascade.xml directly into my program. Do I have to modify something in between? Please help

VoidMee gravatar imageVoidMee ( 2013-07-04 07:53:20 -0500 )edit

Old versions of openCV use a different xml structure then the newer versions, thats why I suggest first moving to the latest stable version.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-04 08:21:31 -0500 )edit

ok let me try this , thanx for replying, really appreciate your help

VoidMee gravatar imageVoidMee ( 2013-07-04 08:39:34 -0500 )edit

I have tried using new version of opencv 2.4.6. I simply copied cv2.pyd file to mydirectory : python27/lib/site-packages and again failed to run my program at the same error point. Is that a bug or can I send you my cascade file? Help

VoidMee gravatar imageVoidMee ( 2013-07-04 19:55:09 -0500 )edit

I do not program in Python so I cannot use/test your code. Maybe put your code and the exact line where it goes wrong. I am expecting you are doing something wrong when initializing your model.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-05 02:31:56 -0500 )edit

ok, simply to load my classifier I use this code:

import as cv


Which works fine for cascade file created by opencv_haartraining but genereates the above error with file created by opencv_traincascade

VoidMee gravatar imageVoidMee ( 2013-07-06 05:05:02 -0500 )edit

I am not familiar with python code, however, shouldnt you create a cascade object first then load the classifier into it?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-06 06:02:01 -0500 )edit

Question Tools


Asked: 2013-07-04 04:03:38 -0500

Seen: 530 times

Last updated: Jul 04 '13