openmv-cascade to be use

When use the openmv-cascade.py at python2.7 .some error shows as follow:


[code]usage: openmv-cascade.py [-h] [-i] [-n NAME] [-s STAGES] [-c] file
openmv-cascade.py: error: too few arguments

Traceback (most recent call last):
  File "C:\Documents and Settings\fff\My Documents\Downloads\openmv-master (1)\usr\openmv-cascade.py", line 257, in <module>
    main()
  File "C:\Documents and Settings\fff\My Documents\Downloads\openmv-master (1)\usr\openmv-cascade.py", line 241, in main
    args = parser.parse_args()
  File "D:\Python27\lib\argparse.py", line 1656, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "D:\Python27\lib\argparse.py", line 1688, in parse_known_args
    return self._parse_known_args(args, namespace)
  File "D:\Python27\lib\argparse.py", line 1901, in _parse_known_args
    self.error(_('too few arguments'))
  File "D:\Python27\lib\argparse.py", line 2311, in error
    self.exit(2, _('%s: error: %s\n') % (self.prog, message))
  File "D:\Python27\lib\argparse.py", line 2299, in exit
    _sys.exit(status)
SystemExit: 2
>>> openmv-cascade.py stop_sign.xml
SyntaxError: invalid syntax

[/code][/color][/b]
please how to use the openmv-cascade.py to convert the opencv xml file to be use in openmv platform.Thanks!Attach the xml file ,thank you very much!
trafffic xml.rar (20.3 KB)

Ibrahim will have to look at this. Um, did you see this thread?

Yes,I had looked the thread,but it can’t solve my issue!

openmv-cascade.py doesn’t support the new cascade format.

Thanks iabdalkader.I also use the official xml file, the same error message appears。

This should happen, can you try this?

python2 openmv-cascade.py data/haar/haarcascade_frontalface_default.xml

Hello,everyone!Forgive me,I am a Chinese who is not good at English.So my statement may be hard to understand. :smiley:
I want to use the openmv to identify the car license plate,but I meet the similar issue.I think the haarcascade_licence_plate_rus_16stages.xml file format is shorter than required.When I use the openmv-cascade.py to convert the xml file to casacde file,some error shows as follow:

D:\Model\cascade file>python D:\Model\openmv-cascade.py D:\Model\licence_plate_rus_16stages.xml
Traceback (most recent call last):
  File "D:\Model\openmv-cascade.py", line 257, in <module>
    main()
  File "D:\Model\openmv-cascade.py", line 254, in main
    cascade_binary(args.file, args.stages, args.name)
  File "D:\Model\openmv-cascade.py", line 112, in cascade_binary
    fout.write(struct.pack('h', int(float(a.childNodes[0].nodeValue)*256))) #int16_t
 struct.error: short format requires SHRT_MIN <= number <= SHRT_MAX

Could you help me solve this issue or give me some suggestions?Thank you very much!
haarcascade_licence_plate_rus_16stages.xml (46.7 KB)

Hi, your cascade has a very unusual value in one of the trees:

            <right_val>-3.2377028808593750e+003</right_val></_></_>

This value overflows a signed short because it’s scaled by 256. Typically it’s small. I can’t change the data type because all cascades are using signed short for this value. You could fix this value by making it smaller (not sure if it will break the cascade) example:

            <right_val>-3.2377028808593750e+000</right_val></_></_>

Ok,I see.I’ll try your way.

Thanks for your help!

@ iabdalkader ,when I used the attach the cascade file(the .rar file include the .xml file) ,the openmv3 be crashed ,How solve this issue.Thank you for kindly support.