currently I am trying to implement my own hardhat-recognition to my MV-cam. For the Cascade classifier I used openCV and with my webcam it is working. Then I created a new .xml-classifier-file with the additional parameters “-SaveBaseFormat” and “-FeatureType HAAR” in order to make it usable for the MV-cam. Then I used this (https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py) script to transform it into a .cascade-file which I included like this into my micropython sript:
But my script just does nothing. It gets the snapshots, but recognized nothing. Does anyone have any experience in including own haar-cascades?
Did I implement it right?
Hi, I’m not sure why it’s not working, try to remove the stages argument to test all stages. If you can you attach the xml and binary cascades I’ll test them for you.
Note: Actual FPS is higher, streaming the FB makes it slower.
print(clock.fps())
I just get the line: width:36 height:36 n_stages:17 n_features:150 n_rectangles:260
And the red-LED turns on and I can’t do anything, not even disconnecting
This one works (doesn’t crash the camera) it’s different from the one you sent before (cascadesc22.cascade) I’m attaching the binary cascade I made with the script cascade.zip (1.69 KB)
I have another question:
I created the XML-file with openCV. In order to run it on my Laptop (using it’s webcam) I created the new version of the XML-file (without the parameter -SaveBaseFormat).
The result is very good an it detects a lot of hardhats.
Now, in order to run it on the openMV-Cam I need the old format of the XML-file (created by using the parameter -SaveBaseFormat). But then I use the script (https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py) in order to convert it into a .cascade-file and it detects almost nothing. How ist this possible: I used the same parameters as I did for the new format.
Hi iabdalkader,
I tried to replace the eye detection cascade with a new one. I converted the .xml file to .cascade file using the provided tool. But the video stream stuck and I think the camera cracked . I read the thread above and bascially the problem is the same as Fabianhummel’s. You created a new binary cascade (cascade.zip) for him and it also works on my machine. I want to know how you did that. I also attached my xml file. It’ll be great help if you create a binary cascade for me.
hi @iabdalkader
i want to create a cascade file from xml file
xml file is a opencv sample (haarcascade_fullbody)
i try to convert xml file to cscsde file whit openmv-cascade.py but it return
usage: conver [-h] [-i] [-n NAME] [-s STAGES] [-c] file
conver: error: too few arguments
Traceback (most recent call last):
File “C:\Users\azaduni\Desktop\conver”, line 288, in
main()
File “C:\Users\azaduni\Desktop\conver”, line 272, in main
args = parser.parse_args()
File “C:\Python27\lib\argparse.py”, line 1656, in parse_args
args, argv = self.parse_known_args(args, namespace)
File “C:\Python27\lib\argparse.py”, line 1688, in parse_known_args
return self._parse_known_args(args, namespace)
File “C:\Python27\lib\argparse.py”, line 1901, in parse_known_args
self.error((‘too few arguments’))
File “C:\Python27\lib\argparse.py”, line 2311, in error
self.exit(2, _(‘%s: error: %s\n’) % (self.prog, message))
File “C:\Python27\lib\argparse.py”, line 2299, in exit
_sys.exit(status)
SystemExit: 2