Standalone Raspberry Pi Security Camera with AI "person detection"


#41

I wonder what the dnn module is doing internally? If the first layer is expecting 300x300 and you send it more does it crop? resize? analyze multiple overlapped 300x300 "tiles"? (which it seems should slow it down a lot). If you send it less, does it interpolate or zero pad? I'm going to see if searching comes up with some info on what is going on internally. I'm kind of surprised it doesn't give errors if the size is not 300x300 or whatever it was trained on. I'm pretty sure the NCS version chokes if the input is not 300x300, although if I recall the NCS SDK v2 api would do an automatic resize if necessary (I didn't pursue it as I only saw different, not better)

I've got some mp4 files (from a real crime at an industrial site) that are particularly hard to detect, I do get some detections but most of the time that the perp is in the frame its not detected. I plan to add the CLAHE to the pre-processing to see if it helps.

Doh! my object oriented stupidity, I searched on Timer not the tmrs objects created.


#42

I've played a bit with CLAHE and pre-processing the images with it before sending to the AI can definitely help. Unfortunately I've found little guidance on how to set its parameters with my googlefu.

Here is an ~10 second clip of that security camera footage I mentioned of an actual crime where the people paid to monitor the cameras totally missed it, the entire event lasted ~30 minutes, the thefts were discovered the next day.

CLAHE enhanced AI performance comparrison

Dual frame view "normally" processed by the MobileNet-SSD AI on the left. On the right is the result of images pre-processed with CLAHE before going to the AI sub-system. The images certainly look better to the naked eye, but I doubt it would have been enough to make a difference to the people who were obviously not paying attention.

If you want to play with this, I'll share my Python code, if requested. It reads from a video file or a "live" camera on /dev/video0 using OpenCV cv2.VideoCapture(). This code uses the Movidius NCS, so as far as I know it will not run on Windows. Analyzing the input file, twice per frame, gave me ~4.5 fps meaning the NCS was processing ~9 fps.