You were correct! Home assistant named my camera camera.saved_image which caused the issue. I changed the facebox detection sensor to
- platform: template
sensors:
facebox_detection:
friendly_name: ‘Facebox Detection’
value_template: ‘{{ states.image_processing.facebox_saved_image.attributes.faces[0][“name”].title}}’
saved_image instead of saved_images and now the facebox detection sensor will not display the name. Is this normal? I get error Could not render template Facebox Detection: UndefinedError: list object has no element 0
@masterkenobi suggest machinebox for query on wiping faces, suspect theres a docker command to clear the image. In my experience only a couple of images were required to teach a face
hello. you have a great project
please help me. When I configure in automation the error message is as follows
Invalid config for [automation]: template không hợp lệ (TemplateSyntaxError: bất thường cuối trong print statement) cho giá trị giá dữ liệu [‘action’] [5] [‘data_template’] [‘message’]. Got None. (See /config/configuration.yaml, line 310). Please check the docs at https://home-assistant.io/components/automation/
I need to enter the ID of the image in the box but I am not sure where to find the ID.
I have tried looking for it in HA from the Developer tools > States and then look for image_id attributes for the image_processing entity after it detected my face. The value is like this… “D:\\Users\\ben\\Documents\\python\\teach_facebox\\ben\\IMG_20180902_192844.jpg”
I used it in the above web tool but it says Not Found.
I am wondering how to find the list of image IDs captured in the system.
Also, how many images do you think is sufficient to use to teach a face? Is 5 images enough?
The face ID isn’t exposed via the HA integration, so you would need to access the facebox API directly e.g. via curl. However I think you are better just wiping the container and starting over. 5 photos per face should be sufficient
OK. I have another question. Do the faces got deleted whenever I restart the docker container or my NAS? The reason I ask is because it couldn’t match any face after I restarted the container.
@robmarkcole, I am trying to create a template binary sensor that will turn on when my face is detected and off if otherwise. This is what I have so far…
binary_sensor:
- platform: template
sensors:
ben_at_couch:
friendly_name: 'Ben At Couch'
device_class: occupancy
value_template: >-
{% if states.image_processing.couch.attributes.matched_faces["Ben"] > 50 %}
on
{% else %}
off
{% endif %}
entity_id:
- image_processing.couch
Unfortunately it is not working. This is the error in the log…
ERROR (MainThread) [homeassistant.components.binary_sensor.template] Could not render template Ben At Couch: UndefinedError: ‘dict object’ has no attribute ‘Ben’
Please point me to the right direction on how to do this. Thanks.
i have found a workaround to this. instead of binary_sensor, I am using input_boolean now.
First, create the input_boolean:
input_boolean:
ben_at_couch:
name: Ben at Couch
Then create the automation to turn on the input_boolean.
automation:
- alias: 'Turn on Ben at Couch Input Boolean '
initial_state: on
trigger:
platform: event
event_type: image_processing.detect_face
event_data:
name: 'Ben'
entity_id: 'image_processing.couch'
condition:
condition: template
value_template: "{{ trigger.event.data.confidence|float > 50 }}"
action:
service: input_boolean.turn_on
entity_id: input_boolean.ben_at_couch
…and then another automation to turn it off when my face is not detected.
automation:
- alias: 'Turn off Ben at Couch Input Boolean '
initial_state: on
trigger:
platform: state
entity_id: image_processing.couch
condition:
condition: template
value_template: "{{ states.image_processing.couch.attributes.matched_faces['Ben'] is not defined }}"
action:
service: input_boolean.turn_off
entity_id: input_boolean.ben_at_couch
With this input_boolean, I can create all sorts of automation such as track my kids TV time by using facial recognition.