Cannot use openmv-cascade.py script for haarcascade of depth > 1

Discussion related to "under the hood" OpenMV topics.
calvinmryan
Posts: 23
Joined: Tue Jan 30, 2018 11:05 am
Location: Boston, MA

Cannot use openmv-cascade.py script for haarcascade of depth > 1

Postby calvinmryan » Thu Mar 22, 2018 2:27 pm

Hi,

I've created my own haar cascade and I'm experimenting with tree depths greater than 1 (i.e. not a stump). However, it seems that the provided script to convert .xml haar cascades into .cascade files for the openmv cam doesn't handle trees deeper than 1. Fundamentally, the .xml files of different tree depths have more values in the <internalNodes> header. See below images. It seems that for a tree depth of 1 you get 4 values where the 3rd value is the index (variable "idx" in the script around line 180). The error that the script throws is that the index is out of range for the list "features." I added code to use every set of 4 values in the <internalNodes> header as it uses the first, but to no avail. The second "set" of 4 values also gave me an out of bounds error because the 3rd value was an index that was out of the range of features. I will now look at where the list "features" is being constructed, but I wanted to see if you have any other ideas in mind. Thanks!

Yours,

Calvin Ryan
Attachments
Screen Shot 2018-03-22 at 14.22.40.png
cascade.xml with depth of 3
Screen Shot 2018-03-22 at 14.22.40.png (427.03 KiB) Viewed 584 times
Screen Shot 2018-03-22 at 14.22.28.png
cascade.xml with depth of 1
Screen Shot 2018-03-22 at 14.22.28.png (454.35 KiB) Viewed 584 times
User avatar
kwagyeman
Posts: 2286
Joined: Sun May 24, 2015 2:10 pm

Re: Cannot use openmv-cascade.py script for haarcascade of depth > 1

Postby kwagyeman » Thu Mar 22, 2018 11:38 pm

Ibrahim? Can you help debug this.
Nyamekye,
User avatar
iabdalkader
Posts: 544
Joined: Sun May 24, 2015 3:53 pm

Re: Cannot use openmv-cascade.py script for haarcascade of depth > 1

Postby iabdalkader » Fri Mar 23, 2018 11:39 am

However, it seems that the provided script to convert .xml haar cascades into .cascade files for the openmv cam doesn't handle trees deeper than 1
Hi, no the script doesn't handle that, and I'm not sure how those extra features should be handled in code.
calvinmryan
Posts: 23
Joined: Tue Jan 30, 2018 11:05 am
Location: Boston, MA

Re: Cannot use openmv-cascade.py script for haarcascade of depth > 1

Postby calvinmryan » Fri Mar 23, 2018 12:01 pm

So just to be clear - the haar cascade openmv class only operates with a haar cascade of tree depth 1?
User avatar
iabdalkader
Posts: 544
Joined: Sun May 24, 2015 3:53 pm

Re: Cannot use openmv-cascade.py script for haarcascade of depth > 1

Postby iabdalkader » Fri Mar 23, 2018 12:08 pm

calvinmryan wrote:
Fri Mar 23, 2018 12:01 pm
So just to be clear - the haar cascade openmv class only operates with a haar cascade of tree depth 1?
Yes, and originally it only supported the old format, then someone contributed support for the new format with depth 1.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests