0.115.x new State "attributes" exposed in automations - help understanding implications with Deepstack object

I use Deepstack and a Google Coral to process images from my front gate cam. Works great but I see opportunities for improvent. I see that I’m now able to extract and test individual attributes and take actions based on those values (fantastic!). However, I’m pondering how this info might be used CORRECTLY.

When an object of interest (car/person/truck) is detected, the Deepstack object gives this output:

It’s actually much more but for clarity, lets focus on the ROI attribute. I check it in the automation to see if the Region of Interest (ROI) is greater than 1 which implies DeepStack found what I’m looking for, in this case, only 1 actual car with confidence > 85% out of 7 possibilities.

I’m now able to check this ROI attribute to see if it is greater than 1 and then do things:

However, as I look at the ROI attributes after the fact (like 10 minutes later), the attributes is still 1. so, how will the Automation ever trigger again if the next time the ROI is 1 again, in other words, if the result is STILL = 1?

Do I manually reset the attributes after each run of the automation? Do the attributes reset to zero with each call to the image_processing.frontgate_object_detection service and then get set after it has run?

I know this question is specific to DeepStack, but I’d like to understand the broader implications as it relates to using any object’s attributes. Things could get out of hand quickly…

Jeff

Not sure if it helps massively but I use DOODS for image processing and sometimes that gets stuck on a number higher than 0 (1 most often than not), I assumed it was something I had done wrong but maybe it’s an issue between HA and the application perhaps? It usually resets itself after a little while but it’s definitely longer than it should be sometimes!

This is why I’m asking. I used to check the Deepstack object and it was 1 if an object was detected and 0 if not, but it wouldn’t reset to 0 sometimes for hours…

Obviously it’s not working as intended but perhaps you could have an automation that says if that attribute is higher than 0 for X amount of time then trigger an homeassistant.update_entity (or similar as I’m not sure if that’ll actually force it to update).

1 Like

That might work. I’ll give it a try. Calling that service does reset it to zero.

2 Likes

Hac anyone been able to display the deep stack attributes in a Lovelace card?

I want to display some of this data.


targets:

  • target: dog
    confidence: 35
  • target: cat
    confidence: 40
  • target: boat
    confidence: 80
  • target: bicycle
    confidence: 80
  • target: person
    confidence: 40
  • target: vehicle
    confidence: 45
  • target: car
    confidence: 40

targets_found:

  • person: 57.381

summary:
person: 1

last_target_detection: 2021-04-10_14-14-31
all_objects:

  • chair: 10.126
  • person: 11.852
  • person: 13.629
  • bench: 19.862
  • motorcycle: 33.237
  • person: 57.381

save_file_folder: /config/www/snapshots
save_file_format: png
save_timestamped_file: false
always_save_latest_file: true
unit_of_measurement: targets
friendly_name: deepstack_object_backyard