Face detection with Docker/Machinebox

Looking for some help here. I have HA and Facebox running on a core i7 Synology docker instance. I can teach faces and recognize them in the facebox console. Nothing ever shows on the HA side of things. I always get 0 recognized faces and the saved image that is created by my camera triggers the automation in the tutorial but facebox never does anything. I am just guessing that the standard docker facebox install code ( sudo docker run -p 8080:8080 -e MB_KEY=yourkey machinebox/facebox ) on my synology is preventing it from talking to my HA instance. Anyone with a Synology or knowledge on this care to help with the install code so that my HA can communicate with Facebox? Here is how my HA instance was installed. docker run --name home-assistant --restart=always --net=host --privileged -itd -v /volume1/Shared/docker/homeassistant/config:/config -v /usr/syno/etc/certificate:/certificate --device /dev/ttyACM0 homeassistant/home-assistant

Any log errors?

I have everything nearly identical as per the tutorial. Only thing I changed was my media player name and front motion sensor (from my blue iris camera instance) in the automation. Looks like the automation is the culprit. Here is the error:

Invalid config for [automation]: invalid template (TemplateSyntaxError: unexpected 'end of print statement') for dictionary value @ data['action'][5]['data_template']['message']. Got None. 

Here is the automation i have:

- id: facebox_announcement

alias: ‘Facebox Announcement’
initial_state: on
trigger:
- platform: state
entity_id: sensor.front_motion
to: ‘on’
action:
- delay: 00:00:02
- service: camera.snapshot
data:
entity_id: camera.local_file # your doorbell camera
filename: ‘/config/www/facebox/tmp/image.jpg’
- delay: 00:00:01
- service: image_processing.scan
entity_id: image_processing.facebox_saved_images
- delay: 00:00:02
- service_template: ‘{% if states.sensor.facebox_detection.state != “unknown” %} tts.google_say {% endif %}’
data_template:
entity_id: media_player.kitchen_speaker
message: ‘{% if states.sensor.facebox_detection.state != “unknown” %} {{ states<“sensor.facebox_detection”> }} is at the door {% else %} {% endif %}’
- service: media_player.volume_set
data:
entity_id: media_player.kitchen_speaker
volume_level: 0.7

Like this, the automation doesn’t show up at all and I get the above mentioned error. If I change the message under media player from states<“sensor.facebox_detection”>and change to states(“sensor.facebox_detection”) it shows up but I get template rendered invalid service error.

I still feel as though Home assistant is not talking to the Facebox instance as I alsways have 0 for everything on the front end of HA in the Facebox.local_file even though I have several faces trained.

@ffyter can you check the hostname field on the HA front end?
Also please try this image of the beatles via the facebox GUI

Beatles picture returns success with the locations of all of the faces.

Ok you have a hostname so the box is up and reachable… Can you use the local file camera with the beatles photo to check if the faces are returned by the facebox HA component?

So I would drop the Beatles photo in /config/www/facebox/tmp folder named image.jpg and call service image_processing scan? When I drop the photo in this location I get the picture on my front end of HA labeled saved image.

No, please follow the instructions for https://www.home-assistant.io/components/camera.local_file/ which displays the image on the HA front end, then call the scan service.

1 Like

Beatles image shows on frontend as saved image. I then ran the image processing scan and the result is nothing shown in the facebox local_file on the home page. I do have the local camera set up as u pointed out.

OK well everything appears to be configured correctly. You’re absolutely certain there are no errors in the log?

Log Details (ERROR)

Fri Oct 12 2018 07:31:14 GMT-0500 (Central Daylight Time)

Error on receive image from entity: Camera not found

I don’t understand this error it occurred right after I ran the image processing request. I just noticed it.

Hi @robmarkcole,

I just tried this component. I am wondering is it possible to use this to detect human only? I don’t really need to identify the person.

The reason is motion sensor is unreliable to detect someone is in a room. When someone stay motionless for too long, then HA will think no one is in the room and trigger automation such as turning off the lights.

Edit 1: After further testing, I notice that it only detect faces, not human. For example, if I turn around and the camera only sees my back, Facebox will detect 0 face.

HI @masterkenobi you could try Classification box, or sighthound, I have CC for both on my github.
Cheers

@ffyter I expect that the camera issue is the cause of your problems then

Thanks. Will give classificationbox a try. I’m wondering does this send my camera images to the internet for processing? I’m a bit concerned for my privacy.

Yes local, although you could host on AWS etc as just a docker container. Checkout https://github.com/robmarkcole/HASS-Machinebox-Classificationbox

1 Like

you mean it doesn’t send my camera images to the internet if I have installed the docker container in my local Synology NAS, right?

Anyway, I have installed the custom component and the docker container. My HA is in a raspberry Pi and the classificationbox docker container is in my Synology NAS.

Now, I need to create models. I am wondering what kind sample images must I use. Let say if I want to teach it to recognize human in my CCTV, do I use images from my CCTV that contain person such as this sample image from the web…

or

random images of human such as this…

Yes all local. In my hackster write up I describe the complete process of training. You would train person/not-person classes. Note that it is a classification algo, not object detection, so you won’t get bounding boxes or a number of people. Use sighthound for that

ok thanks. will try sighthound instead. anyway, sightshound seems to be cloud service. does that mean all my snapshots from my cctv will be uploaded to sighthound server?

anyway, back to facebox. i am still playing around with it.

while i was using your teach_facebox.py python script, it came out this error…

failed with message:With the FREE plan you are, only able to teach 100 images, visit http://machinebox.io to get a suscription

I wonder how do I remove some images so that I can add more faces.