neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
167 stars 28 forks source link

Deepstack invalid image #340

Closed melvinraju closed 4 years ago

melvinraju commented 4 years ago

Describe the bug Deepstack is now returning invalid image on almost all of my images that are automatically added to the folder. When copying and pasting the same image back in it works perfectly

Log entries Automatically added image trigger_1 | 2020-07-07T13:25:55+01:00 [Trigger Front Door] /aiinput/FD_12-25-48.jpg: Analyzing deepstack-ai_1 | [GIN] 2020/07/07 - 12:25:55 | 400 | 15.225609ms | 172.21.0.3 | POST /v1/vision/detection trigger_1 | 2020-07-07T13:25:55+01:00 [Trigger Front Door] Error: Failed to call DeepStack at http://deepstack-ai:5000/: {"success":false,"error":"invalid image"} trigger_1 | 2020-07-07T13:25:55+01:00 [Trigger Front Door] /aiinput/FD_12-25-48.jpg: Analysis failed

Copy and Pasted identical image trigger_1 | 2020-07-07T15:01:18+01:00 [Trigger Front Door] /aiinput/FD_12-25-48 copy.jpg: Analyzing deepstack-ai_1 | [GIN] 2020/07/07 - 14:01:25 | 200 | 7.193620498s | 172.21.0.3 | POST /v1/vision/detection trigger_1 | 2020-07-07T15:01:25+01:00 [Trigger Front Door] /aiinput/FD_12-25-48 copy.jpg: Found at least one object in the photo. (7181 ms)

Installation details

Additional context I believe the problem occurs because the program is sending the images too quickly after they have been placed into the folder not allowing enough time for it to completely save. I have recently received telegrams that include images that are half grey that i previousy mentioned in #187 Here's someone else with the Deepstack error: https://github.com/robmarkcole/HASS-Deepstack-object/issues/83 I assume Deepstack is reading the image as "blank" Would a delay function fix this?

melvinraju commented 4 years ago

Just found awaitWriteFinish in the settings.json schema 🚀 Sorry to keep "bugging" you