Timestamp / picture time issue #236
Description
I'm not saying this is a bug, but I would like to understand what is happening and thought this may be the best place to post this. There could be a race condition somewhere.
This is what is happening: whenever my camera is detecting motion, I am feeding images to Deepstack via an automation that runs every 1 second. The automation is set in blocking mode currently so that it will not run a second time before the first process has returned (which I think is whenever Deepstack responds to the API post). Based on my logs, it seems that the actual rate at which images are being fed is more like once every 8 seconds. On a recent motion event, this is what happened:
4:47:19 Start of motion event on camera
4:47:20 HA sends an image to Deepstack
4:47:28 HA sends an image to Deepstack
4:47:35 Event received from Deepstack; car object detected
{'bounding_box': {'height': 0.241, 'width': 0.373, 'y_min': 0.233, 'x_min': 0.383, 'y_max': 0.474, 'x_max': 0.756}, 'box_area': 0.09, 'centroid': {'x': 0.57, 'y': 0.354}, 'name': 'car', 'object_type': 'vehicle', 'confidence': 92.548, 'entity_id': 'image_processing.deepstack_object_driveway', 'saved_file': '/config/snapshots/driveway/deepstack_object_driveway_2021-04-20_16-47-29.png'}
This is the content of the image filename referenced above:
4:47:36 HA sends an image to Deepstack
4:47:43 Event received from Deepstack; car object detected
{'bounding_box': {'height': 0.114, 'width': 0.1, 'y_min': 0.16, 'x_min': 0.22, 'y_max': 0.274, 'x_max': 0.32}, 'box_area': 0.011, 'centroid': {'x': 0.27, 'y': 0.217}, 'name': 'car', 'object_type': 'vehicle', 'confidence': 78.134, 'entity_id': 'image_processing.deepstack_object_driveway', 'saved_file': '/config/snapshots/driveway/deepstack_object_driveway_2021-04-20_16-47-37.png'}
This is the content of the image filename referenced above:
4:47:44 HA sends an image to Deepstack
4:47:52 HA sends an image to Deepstack
4:48:00 HA sends an image to Deepstack
4:48:08 HA sends an image to Deepstack
4:48:16 HA sends an image to Deepstack
4:48:24 HA sends an image to Deepstack
4:48:32 HA sends an image to Deepstack
4:48:39 End of motion event on camera
This is what I would like to understand:
The first event that is returned has an image containing a camera timestamp of 4:47:28 with a filename of 16:47:29. Presumably this is the picture submitted by HA to Deepstack just before at 4:47:28 and it took about 7 seconds for it to be analyzed and come back. This makes sense to me.
But on the second event: an image is sent to Deepstack at 4:47:36, event comes back at 4:47:43 with an image name of 16:47:37. This makes sense too, but if you then look at the image contained in the file, it has a camera timestamp of 4:48:32 with is roughly the timestamp of the last image sent to Deepstack during the event and after the car has already left, so there is nothing to see in the image. Yet We know that Deepstack fired an event for this submission and saw the car, so it looks like the image that was analyzed by Deepstack is the correct one, but a different image was saved in the file.
This happens consistently on all of my events, where the last one or several images saved in my directory have no object on them and a much later camera timestamp, yet I know that Deepstack saw an object at the time of the filename, which is why the image was saved in the first place.
Any idea of what might be wrong?
Thanks.
Jean
Activity