The Face recognition works well. Under optimal lighting conditions. But I want the Picar-X to follow a person who may not be looking at the camera.
The vilib (video library) seems to have lots of references to “human” object detection, but it looks like it only does face detection. I want actual person detection based on body outline.
Running objects_detection.py works pretty well for detecting anything and it uses the image classifier (/opt/vilib/coco_labels.txt) to label it from among nearly 100 possible objects.
It does work. The preview window shows a bounding box with the “person” label… but it’s very slow on a raspberry pi.
How do I modify the human_face_detect example script, to have it focus solely on “person” instead of “faces”? I assume that importing Vilib into Python still uses OpenCV, so it should be easy to change the model it’s looking for, right?
Thanks.
Opencv comes with a pedestrian detector and detection model HOGDescriptor, HOGDescriptor_getDefaultPeopleDetector , you can search the web for many examples of usage, which is faster than using Tensorflow’s objections_detection. Because HOGDescriptor is only for human bodies, whereas projection_detection is for many different objects, Pedestrian Detection using OpenCV-Python - GeeksforGeeks
We will consider adding pedestrian detection to Vilib.
Thank you.
In the meantime, is there a way to directly make this work?
I’ve found a few issues with vilib.py:
Added double quotes to change settings that requires strings instead of numbers. Got this working to change exposure, crop, and other camera settings on the fly.
Color detection can work in low light by modifying these settings and cropping so things like exposure and auto white balance can adjust. But it seems color detection happens before some post process settings like saturation, brightness, and contrast. The preview window shows a great color block after compensating for low light, but no detection. Similarly, in good lighting with saturation turned down to black and white, the preview shows grey block but has good detections. So it seems color detection happens before these settings. I’d prefer it happen after those camera adjustments.
If you want to do the color detection after modifying the parameters, you can swap the code order in vilib/vilib/vilib.py as shown.
1 Like
Thank you so much. That works now.
Any workaround for person/pedestrian detection? If not included in Vilib, can I call OpenCV directly for this object model?
Yes, the pedestrian detection model is built-in to opencv, please refer to the reference Pedestrian Detection using OpenCV-Python - GeeksforGeeks that was sent to you earlier.
We will add pedestrian detection to vilib in the future.