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

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


Ibrahim? Can you help debug this.

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.

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.