Face detection with Docker/Machinebox

Hey Rob,
I have checked out your github and i got facebox running. Just a quick question. Does facebox gets triggered when it detects a face and does the recognition or do i trigger it with a motion sensor?

Edit: Can i also run a live camera feed into facebox?

You need to call the SCAN service.

I think the max frame rate for cameras in HA is 1FPS so if your hardeware is capable you can classify at 1FPS.

Checkout https://www.hackster.io/97766/announce-who-is-home-using-facial-recognition-dcc389

OK I’m revisiting Facebox but stalling at the first hurdle. Upon launching the Facebox docker I’m getting the following error:

[CRITICAL]    command exited during start up, make sure the container has enough RAM available to start, check out https://machinebox.io/docs/setup/docker#minimum-requirements
stderr

Now I have a DS918+ with 4GB which worked fine when the Facebox integration was first launched. The link above states at least 4GB needed which differs from the 2GB thats listed on the components page.

Any ideas?

I’m not sure, but the machinebox forum are probably the place to get a quick answer. Cheers

1 Like

@apt checkout https://github.com/RdeLange/robinvision

1 Like

Well that’s looks good, I’ll give it a go. I posted on Machinebox slack re the issues and got this reply:

probably is not memory, is that machine does not have AVX instructions, so it does not run try Docker for that machine, but as a big warning, is an image that is not maintain, or officially supported

I think I’ll give your link a try first. Cheers :beers:

Yes I recall now that I am using facebox_noavx

Up and running with that image. Tried the robinvision version but would not build correctly for me which is a shame. No pre-built image :frowning:

Yes would be great to get robinvision deployed as a HASSIO addon, although that’s outside the scope of my experience

1 Like

but not for @frenck… just saying :wink:

1 Like

Ok my logs are pulling this back:

Failed to parse headers (url=http://192.168.1.117:2971/camera/stream): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
09:50 /usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py (WARNING)

The video stream is working fine.

Ok so I got it to work but had to teach the face via the Facebox demo page even though I used the HA service to teach the face like below:

15%20am

EDIT: That above error seems to also appear when I’ve called the Service to teach. Does the image to be taught need defined boundaries somehow?

Still can’t seem to get the HA service to teach Facebox so had to revert to using ‘Paw’ (https://paw.cloud) to send a POST request through to my instance of Facebox. Still getting my logs flooded with the following error however:

Failed to parse headers (url=http://192.168.1.117:2971/camera/stream): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 396, in _make_request
    assert_header_parsing(httplib_response.msg)
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/response.py", line 66, in assert_header_parsing
    raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ''

That error appears to be related to the camera. The facebox component will return facebox specific errors on a failed teaching attempt, e.g. if there is no face present in an image.

EDIT: to trouble shoot, set the SCAN_INTERVAL: 1000 as this will disable the auto scan every 10 seconds, see if this halts the error

Sorry Robin where does this option go? Under the image_processing within configuration.yaml?

e.g.

image_processing:
  - platform: bla
    scan_interval: 10000

Ok so that’s stopped the error outputting to the logs, I’m guessing this has also stopped the scanning of faces too?

Yes try calling the scan service manually. A scan requests a new image from the camera, then processes the new image. So I think the error you are getting is due to the request for a new image

Yeah manual scan gives the error again, but detects the face ok.

It’s a ha camera entity I’m using but the end point is as follows:

http://192.168.1.117:2971/camera/stream

Is it expediting something else hense the parsing issue?

EDIT: I swapped out the camera entity for another camera entity in my HA instance and the error isn’t happening. The camera entity in this instance is a ffmpeg where as the entity that I was having issues with was a mjpeg.

Can facebox handle a mjpeg stream?

OK so this is definitely an issue with the camera setup, and you should create an issue on the HA Github repo.

RE facebox you can checkout the source code here, but the facebox component merely receives the image file from the camera component.

1 Like