insight-platform / Savant

Python Computer Vision & Video Analytics Framework With Batteries Included
https://savant-ai.io
Apache License 2.0
510 stars 41 forks source link

Image_file sink adapter outputs all frames from video in 0.2.10 while SKIP_FRAMES_WITHOUT_OBJECTS=True #773

Open heyryanw opened 4 weeks ago

heyryanw commented 4 weeks ago

Title.

It's hard to discern from the code what exactly the criteria for an "object" in the frame is though. We run two passes in a pipeline - first yolo, then OCR - and are finding that all frames from a video stream through the pipeline get outputted as images. If this is intended, perhaps a way to define the criteria for what a recognized object would be via metadata would make the MatchQuery more customizable as a feature improvement, versus having to alter Savant code directly to allow users to alter this behavior.

bwsw commented 4 weeks ago

So the problem is that the flag does not affect the behavior? The adapter saves all the images, regardless object presence or absence?

As a quick workaround you can implement a Sink with ClientSDK, enable output frame format to JPEG in the module and filter with MatchQuery or programmatically directly in the ClientSDK sink.

bwsw commented 3 weeks ago

To fix in:

heyryanw commented 2 weeks ago

So the problem is that the flag does not affect the behavior? The adapter saves all the images, regardless object presence or absence?

As a quick workaround you can implement a Sink with ClientSDK, enable output frame format to JPEG in the module and filter with MatchQuery or programmatically directly in the ClientSDK sink.

Dug further into this, and it seems this was caused by constant low confidence detections of static objects in our stream, so this is a model thing. It would be great so maybe set a threshold for this setting to improve this, however.

bwsw commented 2 weeks ago

Hi! The model threshold is a "module" setting, not an adapter setting. Why do you think it is relevant?

heyryanw commented 2 weeks ago

We enabled higher thresholds in the mode.yml to be above weak detections, but still saw almost all frames being written to disk. We may need to test this a different way to be sure, but I'm sure you can confirm faster than I will be able to.