Face detection with Docker/Machinebox

I still have no issues, but i have an old docker facebox install.

One question though. Can i reset the image somehow. Trying to copy the motion.jpg, but i see an file adress in input_text.last_added_file. What i want to prevent is that the last still image is not updated and the facebox scan is initialized and gets a posive. One time this actually happened.

something like this isn’t working copying a photo of the actual pope :wink:

shell_command:
overwrite_motion_image: ‘cp -rf /config/faces/last_face/pope.jpg /config/faces/last_face/MOTION.jpg’

I added an update_file service to the local file camera, recommend using that approach.
I’m planning on adding a serivce to image processing where a file can be posted for processing, rather than having to process from a camera

Rob, So if i understand correctly, you advise to drop the camera local file and use a live feed from the camera.

So drop the scan interval. Now it only scans when my camera recognizes a face, then its uploaded to my nas, folder watcher is then activated. updates local file, then an automated trigger to scan by facebox. Hope i am still clear…

image_processing:

  • platform: facebox
    ip_address: 192.168.1.10
    port: 12345
    scan_interval: 990000
    source:
    • entity_id: camera.dahua

That’s a but confusing, but what’s working for me is described in my Hassio repo :+1:

hahaah thought so, will take a look in a short while when I have some time.

@Phuturist and @marthocoo try machinebox/facebox_noavx, i.e.

sudo docker pull machinebox/facebox_noavx

Then

sudo docker run -p 8080:8080 -e "MB_KEY=$MB_KEY" machinebox/facebox_noavx

The issue you are currently experiencing is related to a new change to facebox that adds support for AVX, which is some kind of hardware acceleration, but breaks compatibility with non AVX machines (like the Synology)

That did the trick! Thanks for figuring it out. Now to teach some faces…

Btw want to try out my new teach service? Its in https://github.com/robmarkcole/HASS-Machinebox-Facebox/tree/adds-teach-service

I’ll do that. Also: maybe I’m just being thick, but I can’t seem to find how Facebox persists data - can you mount a docker volume? How does my taught face data get saved across container deletion and recreation?

Data is not persistent on the free tier. However you need only a single image to train a face so an automation can be used to do teaching after a restart

Ok just to get that straight - I need to reteach faces after each restart of the Facebox container (not just deletion and recreation)?

That’s correct - should be very straightforward with the new service

yeah damn noavx still wont work on my old box

faceClient: box is not ready, try again later

they also wont be supporting that image…

1 Like

Awesome, that works. I’ll dig into the face teaching service soon.

1 Like

Is the new teaching service only available with the latest version of that branch of the custom_component?
Currently running the standard HA 70.1 component. The only service available is image_processing.scan.

For the new teaching service, is there a way to use folders (on a remote machine) rather than individual file names?

I’m currently trying to use your teach_facebox.py code. I get an error message when running this:

Traceback (most recent call last):                                              
  File "teach_facebox.py", line 7, in <module>            
    import requests                                                             
ModuleNotFoundError: No module named 'requests'

Images for teaching are located in subfolders where the script runs… The script runs on the remote Facebox server. Any help is appreciated!

I’ve already added 3 cameras to HA. I’ve noticed that adding invalid camera entities or invalid IP addresses for the HA component still adds an image_processing entity with an unknown state:

image_processing.kitchen	
state: unknown	
faces: 
total_faces: null
matched_faces: {}
friendly_name: Kitchen
device_class: face

This should not create the entity and return an error instead in the HA log, I guess!

Facebox is running on a separate/beefy Win10 docker. Unable to do much testing (performance, detection, etc) as it’s night time… Will check back in the morning.

@robmarkcole how can I run your updated facebox component over top of that which shipped with .71? I added it to my custom_components folder but the component doesn’t appear to be working correctly anymore.

@Maaniac the contents of custom_components should overwrite the default, what’s not working?

@monkey-house you need to pip install requests in your env. The service is only in the github branch for now. I don’t understand your question about remote machine, but as the docs explain if you are not running on localhost you will need to edit the .py file to include the required IP address.
Cheers

1 Like

@robmarkcole after adding the custom component I tried to teach facebox a new face and then changed entity picture to the new person. In the front end it is still showing that its detecting my face even though i’m not in the picture.

Going to try to restart and see if that fixes it.

Teaching doesn’t force a scan so you will need to trigger it

@robmarkcole got it to work thanks. Do you know for your sensor template which you provided in the hackster article is there a way for the template to include the name of all the faces that the image processor detected?