Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because i can't even save my trained model to file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

< ?xml version="1.0"?>
< opencv_storage>

and nothing more. Spaces after < sign are added only for visibility of the code in here. After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213) in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

click to hide/show revision 2
PS - my configuration

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because i can't even save my trained model to file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

< ?xml version="1.0"?>
< opencv_storage>

and nothing more. Spaces after < sign are added only for visibility of the code in here. After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213) in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, krenel Linux 3.5.0-17-generic.

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because i can't even save my trained model to file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

< ?xml version="1.0"?>
< opencv_storage>

and nothing more. Spaces after < sign are added only for visibility of the code in here. After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213) in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, krenel Linux 3.5.0-17-generic.3.5.0-17-generic. PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because i can't even save my trained model to file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

< ?xml version="1.0"?>
< opencv_storage>

and nothing more. Spaces after < sign are added only for visibility of the code in here. After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114 terminate called after throwing an instance of 'cv::Exception' what(): /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213) in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, krenel Linux 3.5.0-17-generic.
PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;

SVM->load("SVM.xml");
SVM->predict(DataRow);

<br>SVM->load("SVM.xml"); <br>SVM->predict(DataRow);

I'll obtain this error:

OpenCV error:

<p>OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because i I can't even save my trained model to a file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

< ?xml

<?xml version="1.0"?>

< opencv_storage>

<br>< opencv_storage>

and nothing more. Spaces after < sign are added only for visibility of the code in here. more.

After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213)  in function CvStatModel::write

CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: PS: I almost forgot. Im working under ubuntu 12.10 x86, krenel kernel Linux 3.5.0-17-generic.
PS2:
3.5.0-17-generic.

PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
<br>SVM->load("SVM.xml");
<br>SVM->predict(DataRow);

I'll obtain this error:

<p>OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because I can't even save my trained model to a file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

<?xml version="1.0"?>
<br>< opencv_storage>
<opencv_storage>

and nothing more.

After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213)  in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, kernel Linux 3.5.0-17-generic.

PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
<br>SVM->load("SVM.xml");
<br>SVM->predict(DataRow);
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

<p>OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because I can't even save my trained model to a file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

<?xml version="1.0"?>
<opencv_storage>

and nothing more.

After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213)  in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, kernel Linux 3.5.0-17-generic.

PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

<p>OpenCV OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because I can't even save my trained model to a file, for example when I run this code:

KNearest->save("KNearest.xml","NET");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

<?xml version="1.0"?>
<opencv_storage>

and nothing more.

After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213)  in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, kernel Linux 3.5.0-17-generic.

PS2: Ow - One more thing - Im using OpenCV 2.4.4

Machine learning save/load problem

Hello,

I have a problem with save() and load() methods in ml module. for example if I run code:

CvSVM *SVM = new CvSVM;
SVM->load("SVM.xml");
SVM->predict(DataRow);

I'll obtain this error:

OpenCV Error: Bad argument (The SVM should be trained first) in CvSVM::predict, file /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp, line 2072
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/svm.cpp:2072: error: (-5) The SVM should be trained first in function CvSVM::predict

Model in "SVM.xml" is saved with: SVM->save("SVN.xml","NET"); of course SVM was previously trained;

When I'm doing the same with CvRTrees, method load() gives me a segmentation fault (core dumped). For CvERTrees, CvGBTrees and CvNormalBayesClassifier it works exactly like for CvSVM.

CvKNearest is bigger problem because I can't even save my trained model to a file, for example when I run this code:

KNearest->save("KNearest.xml","NET");
KNearest->save("KNearest.xml");

for trained CvKNearest *KNearest=new KNearest; my "KNearest.xml" will contain only:

<?xml version="1.0"?>
<opencv_storage>

and nothing more.

After that Ill obtain this error:

OpenCV Error: The function/feature is not implemented () in CvStatModel::write, file /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp, line 114
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/wampir/OpenCV-2.4.3/modules/ml/src/inner_functions.cpp:114: error: (-213)  in function CvStatModel::write

Can somebody help me, and tell me how to properly save and load my models or if it is a bug fix it?

Thank you very much ;)

PS: I almost forgot. Im working under ubuntu 12.10 x86, kernel Linux 3.5.0-17-generic.

PS2: Ow - One more thing - Im using OpenCV 2.4.4