width
and height
are supposed to reflect the resolution of the actual video feed. They don’t change the size of the video, but are used to configure the frame buffers and other things needed for Watsor to work. If width
or height
are wrong, the image can’t be displayed correctly.
So the right approach is to change the resolution at Foscam settings or use its sub stream.
300x300 is the size of the images used to train the object detection model. During detection the framework automatically converts an input image to the size of the model to match the size of its tensors. As the resize happens anyway during detection, feeding the stream of high resolution doesn’t make much sense unless the output stream the Watsor produces (the size of which matches the input resolution) is being recorded for later review (where the high resolution video is obviously desired).
Few things can be made to reduce the load on Rasberry CPU:
- consider configuring hardware acceleration for decoding H.264 video (or whatever Foscam produces) in FFmpeg. Remember the options with
hwaccel
prefix. According to the doc, Raspberry has some dedicated device, which can take care of the decoding. This should take off some load from CPU, maybe 10%. - either in Foscam setting or using the filter lower the frame rate. Ideally, the input frame rate shouldn’t exceed Raspberry capabilities (~5 FPS), otherwise all available CPU units will be used for detection.
- the image can be rebuilt with NEON and VFPV3 options of OpenCV turned ON to enable native support of single and double-precision in Raspberry’s ARM Cortex-A72 CPU. Rebuilding is last resort and I can’t say how much can be gained as far as OpenCV is not used for detection, but only to produce Motion JPEG and some video effects. The options can be enabled only when running the build on the Raspberry itself. I used cross build where these options are not available.
The most reasonable is buying hardware accelerator, such the Coral, as I think the Raspberry itself won’t cope with more than 5 FPS of the lightest detection model. The accelerator takes off almost all the load and opens the opportunities to use the models with higher accuracy.