neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make an API call also when no object is detected in jpg that is analyzed

heikil opened this issue · comments

I would like to make an API call when no object is detected on picture as well, in addition to call on detection. The idea is to start and to stop recording only by API calls on the basis of motion detection from Deepstack. I guess that would be a new feature as I did not notice such in the documentation.

The reason is that at night time when recording is started due to object detected the bugs can cause a lot of motion detected and that does not allow the recording to be stopped.

If you are seeing lots of recordings getting started due to bugs then I suggest playing around with the detection thresholds for the camera trigger. The whole point to the AI system is to not have false positives so adding a whole feature to send "nothing detected" would be a very big solution to a problem that could be solved another way.

You can look at the logs in Docker to see what the detection confidence was for the false positives then configure the triggers in trigger.conf to have a minimum that's higher. Look for Confidence in the output logs and then see the wiki for how to set the min and max confidence level that should result in the trigger firing.

I guess I was not explaining this very well. The recording is started because a valid object like a car or person is detected, but it is not stopped when it exits the frame as the bugs are going crazy arround infrared light source and there is enough movement in the frame. I guess I should reduce the sensitivity, but then I am not sure night time movement detection would save images to analyze for the AI tool. I will consider other strategies to solve this then.

BTW. I am using Agen DVR to record footage.

I'm not familiar with the Agen DVR. Is it recording on its own when it detects motion? Or is it only creating an image for the AI system to process and waiting for the trigger to fire with a "start recording" message?

Both. It is recording motion and also creating images to be processed by the AI.

I was curious and had a look at the source. In case of empty predictions array from analyzeImage method it could maybe not just return to exit processImage method, but still fire notifications and/or WebRequestHandler.processTrigger. Such behaviour would need to be configured along with "no detection" trigger that would also need to be defined. I could of course be completely wrong about all of this :)

I can now see that it may not be feasible to make these extensive changes just for this use case. If I will get time, I might do a fork just to play around with this.

Very nice project. I hope you keep it up :)

You really shouldn't have to rely on a "stop" event to handle bugs. The Agen DVR should only be creating images for analysis. It shouldn't start recording on its own. The AI system will detect if a real human/car/whatever is present then trigger the recording via a web request call. That's how it's designed to work and works with BlueIris well.

Try changing the threshold for detection to clean up the false positives from bugs. That should be all that's required.