Yeah I went the snapshot/motion route because I wasn’t comfortable with a live stream analysis, even though all my cameras are local
Okay Rob,
Will give it a try
@TheDanShepherd I’ve been using this component ‘realtime’ for occupancy detection - rather than trigger on motion - and it works rather well. i have the scan set for 10s and it gives me a pretty solid overview of how many people are where in the house. I use it to help keep lights on when people have been sat still passed the trigger point of my PIR automations!
the resultant problem is one of performance. my basement server (@robmarkcole it’s an old but decent i3 2130 with 16g ram) spent until recently most of its waking life idling, the occasional plex transcode taking me to around 10%. Now, with three cameras running oject/person model only (no face component being used) it’s at 45%-60% all the time. I would like to employ this component on more cameras/in more rooms, but worry that it’ll peg my server and affect other services it provides.
Also worth noting is that my homes energy usage has noticably risen as a result of this heavier server activity. only 25p a day more, but still…
Fantastic component all in all. Great work Robin!
that’s the reason why don’t you run the image_processing.scan
service every 10 seconds. it overloads the server and may cause it to crash. Only scan when it is necessary. This is what I have for my kitchen and it works fine for me…
##########################################################
# Automation
##########################################################
automation:
- alias: 'Start scan when Scan Kitchen is on'
initial_state: on
trigger:
platform: state
entity_id: input_boolean.scan_kitchen
from: 'off'
to: 'on'
action:
- service: image_processing.scan
entity_id:
- image_processing.kitchen_person_count
- delay:
seconds: 1
- service: input_boolean.turn_off
entity_id: input_boolean.scan_kitchen
- service: timer.start
entity_id: timer.scan_kitchen
- alias: 'Kitchen activity detected start scan'
initial_state: on
trigger:
platform: state
entity_id:
- binary_sensor.kitchen_motion_sensor
- binary_sensor.kitchen_door_motion_sensor
- binary_sensor.cam_3_field_detection
- binary_sensor.kitchen_window
- binary_sensor.back_door
condition:
- condition: state
entity_id: binary_sensor.kitchen_occupancy
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.scan_kitchen
# When timer is done, start scan
- alias: 'Scan Kitchen Timer Finish'
initial_state: 'on'
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.scan_kitchen
condition:
- condition: state
entity_id: binary_sensor.kitchen_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.scan_kitchen
##########################################################
# Timer
##########################################################
timer:
scan_kitchen:
name: 'Scan Kitchen Timer'
duration: '00:00:30'
##########################################################
# Input Boolean
##########################################################
input_boolean:
scan_kitchen:
name: Scan Kitchen
initial: off
##########################################################
# Binary Sensor
##########################################################
binary_sensor:
- platform: template
sensors:
kitchen_occupancy:
friendly_name: "Kitchen Occupancy"
device_class: occupancy
value_template: >-
{{ states('image_processing.kitchen_person_count')|float > 0 }}
##########################################################
# Customize
##########################################################
homeassistant:
customize:
image_processing.kitchen_person_count:
friendly_name: 'Kitchen Person Count'
an interesting approach @masterkenobi - so basically it waits for any initial motion to ‘die down’ before checking against the deepstack model. nice.
is the timer set at 30s for any particular reason?
Basically when activity is detected (motion and door open or close), it will start scan if no one was detected prior to that. If someone is detected, then it will continue to scan for every 30 seconds until no one is detected.
No particular reason why 30 seconds. You can adjust it until you feel it is balanced between performance and results.
I’ve installed the container for both facial and object detection. While i can get the object detections working everything i’ve tried for the facial detection component doesn’t return any results. I’ve run the service "name": "Superman", "file_path": "/config/www/superman.jpg"
and then run the scan service. The component neither detects a person in the picture nor the identified face. Again no issue with he object detection. Don’t really see any errors in my log. Any ideas?
Has superman been home yet?
@nickrout that was just an example. Nothing i put in the entity triggers neither a scan nor a teach command. You would think that even if I can’t get it to detect a thought face that it would at least detect that there was a person in the picture.
Should be:
docker run -e VISION-DETECTION=True -e VISION-FACE=True -v localstorage:/datastore -p 5000:5000 deepquestai/deepstack
You can always try the test image
@robmarkcole yes that is the one i installed. Its roughly 1.7 gb in size. running image processing scan i can see nothing changes in the log. Doing the same for object detection does.
I just added your test image. Under image_processing.face_counter its giving me a 0 value.
@Maaniac Which OS are you running docker on? There is a known issue (currently, windows and mac) where requests can take so long that they timeout
@robmarkcole running this docker on my mac. The one on my VM doesn’t have enough memory to run this container.
That looks intriguing.
@Maaniac the mac issue is being worked on. Recommend you install Ubuntu in Virtualbox and use docker then for the timebeing.
@katsaplias support for the stick is on the roadmap
Anyone know if I can make the D-Link DCS-8000LH/B Mini work with this/Home-Assistant? They’re really cheap at Amazon at the minute, look like a pretty good quality lens for this and easy to put in the corner of the room.
@robmarkcole only issue is that my computer only has 8gb of memory. Not sure if i want to allocate all of it to the vm.