latentsvm module mat2xml.m is outdated (Bug #4047)


Added by Feng Xu over 10 years ago. Updated almost 10 years ago.


Status:Done Start date:2014-12-05
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:objdetect
Target version:-
Affected version:branch 'master' (3.0-dev) Operating System:Any
Difficulty:Easy HW Platform:Any
Pull request:

Description

Xml models qualified for 2.4.9 latentsvm (which was in opencv/objdetect module) will crash the new LSVMDetector.
The new LSVMDetector use star-cascaded model from, I guess, https://github.com/rbgirshick/voc-dpm. Therefore the current model has new entries like "weightsPCA", "DeformationThreshold", "PCAcoeff", etc.
But mat2xml.m in the current version does not output usable xml models.

I have trained my own model in Matlab, but now I am not able to use it in OpenCV 3.0.


mat2xml.m - The current mat2xml applies to only voc-dpm before its version3 (3.9 kB) Feng Xu, 2014-12-05 01:12 pm

mat2xml.m (6.2 kB) Yan Wang, 2014-12-10 07:51 am


Associated revisions

Revision f5be8f6c
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #4047 from MSOpenTech:videoio-refactor-contrib

History

Updated by Feng Xu over 10 years ago

STEPS:
1. get the repo https://github.com/rbgirshick/voc-dpm, open matlab and run "compile.m" (should be OK in any platforms, tested under Ubuntu)
2. In matlab, load any trained model, e.g. "load('VOC2007/bicycle_final');",
3. In matlab, cast it to star-cascade model "csc_model = cascade_model(model, '2007', 5, -1);".
4. In matlab, save the csc_model, "save('csc_model.mat', 'csc_model');" Now you get csc_model.mat, which is ready for conversion.
5. In matlab, run "mat2xml('csc_model.mat', 'csc_model.xml')". Now you get the xml model
6. use the xml file for LSVMDetector::create, here it triggers segmentation fault.

Updated by Yan Wang about 10 years ago

I tried it. Your modification has some typo.
1. <CascadeThreshold> should be <CascadeThresholds>.
</CascadeThreshold> should be </CascadeThresholds>.
2. /HypothesisThresholdPCA> shoudl be </HypothesisThresholdPCA>.
/DeformationThresholdPCA> should be </DeformationThresholdPCA>.
/HypothesisThreshold> should be </HypothesisThreshold>.
/DeformationThreshold> should be </DeformationThreshold>.

After this modification, lvsm parser could parser its XML files like bicycle.xml. But I still couldn't detect bicycle by it. It may have more detail issue.
Attach my modified mat2xml.m

Updated by Feng Xu about 10 years ago

I found same typo several line below. Corrected it and the generated xml works.

Thanks

Yan Wang wrote:

I tried it. Your modification has some typo.
1. <CascadeThreshold> should be <CascadeThresholds>.
</CascadeThreshold> should be </CascadeThresholds>.
2. /HypothesisThresholdPCA> shoudl be </HypothesisThresholdPCA>.
/DeformationThresholdPCA> should be </DeformationThresholdPCA>.
/HypothesisThreshold> should be </HypothesisThreshold>.
/DeformationThreshold> should be </DeformationThreshold>.

After this modification, lvsm parser could parser its XML files like bicycle.xml. But I still couldn't detect bicycle by it. It may have more detail issue.
Attach my modified mat2xml.m

Updated by Kian Wii about 10 years ago

Xml generated but when using it no detection happens!!!
I have tried to convert car_final.mat to xml it worked after modify the changes that you was talking about but it's useless as detector
I have tried to compare it with car.xml file that included with opencv_contrib in testdata/latentsvm/models i have noticed there was many difference

Updated by Vadim Pisarevsky almost 10 years ago

I think, there was PR addressing this issue, need to find it

  • Category set to objdetect

Updated by Jiaolong Xu almost 10 years ago

Thanks for the updated mat2xml.m , I tried it with INRIA pedestrian model and it works.
Regarding to the issue of no detection, maybe you can try a lower value at <ScoreThreshold>.

Updated by Vadim Pisarevsky almost 10 years ago

ok, so this is solved; the updated conversion script has been merged in.

  • Status changed from New to Done

Also available in: Atom PDF