Person and face detection using image_processing with Sighthound

Rob, Ive got the component working now. Great job.
Is it possible to a.) detect vehicles and b.) create multiple instances for more cameras? I have 4 cameras in total.
it would also be appreciated if you could post and example of how to detect specific (known) faces using the existing component.

For recognising specific faces you might need one of the other image processing components

For other noobs wanting to get this to work with multiple cameras, herewith my 2 camera config and automations. Any improvements would be appreciated.

configuration.yaml

# Sighthound
image_processing:
  - platform: sighthound
    api_key: !secret sighthound_api_key
    mode: dev
    state_display: persons
    source:
      - entity_id: camera.camera_road
      - entity_id: camera.camera_garden

automations.yaml

############################
## Sighthound people detection ##
############################ 

#Camera - Road
- id: sighthound_people_notify
  alias: Notify on person detection
  trigger:
    platform: event
    event_type: image_processing.detect_persons
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: '{{trigger.event.data.entity_id == "image_processing.sighthound_camera_road"}}'
      - condition: template
        value_template: '{{trigger.event.data.total_persons > 0}}'
  action:
    - service: notify.pushbullet
      data:
        data:
          file: '/config/www/images/road.jpg'
      data_template:
        title: Motion at cartlodge gate
        message: "{{now().strftime('%H:%M %d-%m-%Y')}}. People detected: {{trigger.event.data.total_persons}}"
        
#Camera - Garden
- id: sighthound_people_notify
  alias: Notify on person detection
  trigger:
    platform: event
    event_type: image_processing.detect_persons
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: '{{trigger.event.data.entity_id == "image_processing.sighthound_camera_garden"}}'
      - condition: template
        value_template: '{{trigger.event.data.total_persons > 0}}'
  action:
    - service: notify.pushbullet
      data:
        data:
          file: '/config/www/images/garden.jpg'
      data_template:
        title: Motion in garden
        message: "{{now().strftime('%H:%M %d-%m-%Y')}}. People detected: {{trigger.event.data.total_persons}}"

And to trigger the scan for each camera in an automation

#############################
## Trigger Sighthound Scan ##
#############################        

#Road Camera - Triggered by Cartlodge Ring Doorbell motion      
- id: camera_snapshot_road
  alias: Camera Picture Notification Road
  trigger:
    - platform: state
      entity_id: binary_sensor.ring_cartlodge_motion
      to: 'on'
  action:
    - service: image_processing.scan
      data:
        entity_id: image_processing.sighthound_camera_road

#Garden Camera - Triggered by Garden Camera VMD4 motion       
- id: camera_snapshot_garden
  alias: Camera Picture Notification Garden
  trigger:
    - platform: state
      entity_id: binary_sensor.m2025_le_1_vmd4_camera1profile1
      to: 'on'
  action:
    - service: image_processing.scan
      data:
        entity_id: image_processing.sighthound_camera_garden
3 Likes

Hi all
I just released v0.3 which simplifies usage, adds face and person detection, events, and exposes more face data. Let me know any feedback as I plan to release this as an official HA integration soon.
Cheers

1 Like

In which component do you display this camera local file and how do you update it to display latest one?

That is descried in the readme

Iā€™m getting a strange error during Check Config :
Platform error image_processing.sighthound - No module named ā€˜simplehoundā€™

This is the same error that plagues all custom components that have a dependency on pypi. Usually its a docker thing that requires restart of the hardware to fix

Works fine after a reboot. Iā€™ve been using Sighthound Video (local installation) for a while, but it does not work well with monochrome images in the night e.g. it classifies flying bugs as cars and spiders as people. I will now try to supplement it with the cloud API to reduce the amount of false positives.

5000 calls per month is quite generous. Would be really cool to also get their vehicles API as a component. I find it works better with vehicles than Googleā€™s Vision AI.

@ros I will be interested to hear how this compares to the local install option - both in performance and general comments about usability.

Hi all
just released v0.4 which now allows you to optionally save a timestamped image on each person detection. This allows the creation of a record of all detections, and simplifies sending notifications with the processed image. Additionally the time of the last detection is exposed as an attribute.

Hi, in the image_processing.py I can see age & gender.
age = str(face[ā€œageā€])
gender = face[ā€œgenderā€]
How do I implement ange & gender to HA, I have number of people working.

This data is in the image_processing.face_detected event payload

Thank you Robin, Iā€™m already lost;)
I started like this but donā€™t know how to continue.

- id: 'facedetection'
  alias: Face detection
  trigger:
    platform: event
    event_type: image_processing.face_detected
    event_data:
      entity_id: image_processing.sighthound_local_file
  action:

Well you have a blank slate. What do you want to do with this info, send it in a notification?

Hi and thank you Robin, optimal for me would be mqtt but a notification could be great to start with so I understand how it works.

I can imagine using the age as a condition on whether an automation is fired. Checkout the example automation here

Hi, I successfully created an automation that sends out one push per face with age and gender.
The only thing is that below automation sends same image for all detected faces.
Optimal would be to crop faces to a separate files. I checked the phython script but not sure if crop a image is possible.

- id: '1574628447449'
  alias: Object Detected
  trigger:
  - event_data:
      entity_id: camera.front_door_last_activity
    event_type: image_processing.face_detected
    platform: event
  action:
  - data:
      data:
        file: /config/www/sighthound_sighthound_latest.jpg
    data_template:
      message: 'Gender: {{ trigger.event.data.gender }} Age: {{ trigger.event.data.age  }}'
      title: Face details detected
    service: notify.pushbullet

You could write a script to generate the cropped image, it would be straightforward using PIL

Hi, in latest HA version 0.103.4 it stopped workingā€¦

ImportError: cannot import name 'draw_box' from 'homeassistant.components.image_processing' (/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py)

Maybe because of it:
from release notes

Move imports into setup function in homekit init.py (@springstan - #30137) (homekit docs)