Face and person detection with Deepstack - local and free!

Thanks. That was the solution.
But it is a pain to solve it. I had to delete all logs, then the virtual disk still shows as full, so had to create a file with the blank space and then delete it. The export the virtual machine and mount it again. ufff it is not a solution to do this weekly.
Is there any known issue either with deepstack or HA? I have like 10Gb daily increase, if not more.

Hi all,

First off: thanks for all the hard work and effort that has been put into this. Awesome stuff!

I had a question about how (and if) I could setup this integration. My goal is to do facial recognition when someone rings the doorbell and have the name announced through tts. Iā€™m thinking about running the Deepstack container together with Hass.io on a Raspberry Pi 4 and buying an Intel NCS2. Before I buy the NCS2 Iā€™m wondering if this would be a valid setup in terms of performance? Are there any things I need to take in consideration? Is Deepstack/NCS2 the correct way to go, or are there other/better ways to do this?

Thanks a lot in advance!

@b.maia81 I am not aware of any specific issues, suggest asking on discord channels

@MvB the NCS2 does the processing so you can use pi3 or pi4, no matter. Deepstack wont run on same pi as Hassio, you need 2 piā€™s

Nice, thanks for the fast reply!

I happen to have two Raspberry Pi (3 & 4) so that will work :slight_smile: .

Is it possible to combine the Deepstack setup with a camera application such as MotionEye? I would like to setup one RaspberryPi dedicated to the capturing and processing the image and the other for HomeAssistant and triggering the automations.

Any other suggestions are of course also welcome :slight_smile:!

Can someone please tell me how I can use the attribute ā€œmatched facesā€ in an automation?

For example if Robin is detected, play fanfare.mp3 on google home speakers.
image

Thank youā€¦

1 Like

You can break out attributes with a template sensor.
Really I need to update this integration to add a face_detected event

2 Likes

Yes, that would really help :).
I will try that, thank you!

Any update on the new release from deepstack?

How do you guys solve these logs problems on your end?
Yesterday I created a new installation, (even used ubuntu 20.04), follow the tutorial above and the problem remains. I donā€™t believe everyone is living with this amount of logs. :slight_smile:

Dear Rob,

do you know how to get log on the rapsberry+NCS2 about performance of deepstack ?

Is it any way to see the last scanned image?

When you are using ā€œimage_processing.deepstack_teach_faceā€, is it better to teach with multiple images or is it only the last one that will be used to match?

Thank you!

@robmarkcole,

Is there a technical reason that deepstack canā€™t run on hassio?
I want to buy the intel NCS 2 and use this in combination with deepstack on my Hassio.

There is no specific image that you have to use for deepstack, just use the install script that they provide (link) and install it on rasbian. Looking inside the install script, there are no special things needed and all the extra libraries the component needs, seems are in this script (donā€™t know yet which standard libraries it uses from raspbian). It also requires python 3.7. It shouldnā€™t be hard to build a docker file based on a buster python 3.7 (link) image and integrate/replicate the install script from deepstack within the dockerfile. It would then also be easy to create a hassio addon for it.

I already played arround with the deepstack component on Home assistant and also ā€œplayedā€ with it using my laptop camera (python/OpenCV) for face recognition and i like the idea not using the cloud.

Before putting needless energy in creating a docker file for it that could be used with hassio, i canā€™t imagne someone already tried this. What am i overlooking?

@jodur When I last discussed with Frenck and the other hassio experts, the challenge was about making the comms over USB. This situation might have changed recently, I dont know. Personally last time I tried deepstack on the RPI it didnā€™t work, so I have decided to focus on my own effort, which also does not require hardware. The link is here. I would be grateful for any assitance on that project, since I am very busy with a baby these days

Ok thanks for pointing me to your new project. How is the preformance on a RPI4?
In the moment i am also exploring the replacement of my current Raspberry PI3 B. I am unsure between the choice of a more preformant Intel NUC or the New Raspberry PI4 for using Vision based solutions. The Pi4 has now also embedded VSCODE in Hassio enabled, so that not a pro any more for the NUC.
I favor the PI4 4MB, but have my doubts about preformance for vision projects and that why i am also looking for addititional hardware like Google Coral or Intel NCS 2.
How is your experience with the PI4?

I will have a look at this project and play arround with it and if i can contribute to it, i will do of course. And i know out of expierence that raising childeren wil cost you lots of time. (have 3, but are not babies anymore :slight_smile: ). Time is a scare good, when you have to devide your attention between, hobbies,family and work)

Hey @robmarkcole first of all thanks much for creating this mate.

I was trying your " tensorflow-lite-rest-server" with my Raspberry Pi4 (only) and when I submit a Curl request it works like a charm whatever Image I through at it.

Now the problem is when Iā€™m trying the custom component HASS-tensorflow-lite-rest-server (Taken from here) with my Docker hosted homeassistant it is giving me the following error

2020-05-02 15:28:47 ERROR (MainThread) [homeassistant.config] Platform error: image_processing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 777, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 279, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/tflite_server/image_processing.py", line 16, in <module>
    import deepstack.core as ds
ModuleNotFoundError: No module named 'deepstack'

My Configuration.yaml looks like following

image_processing:
  - platform: tflite_server
    name: MachineLearing_Cam
    ip_address: localhost
    port: 5000
    # scan_interval: 30 # Optional, in seconds
    save_file_folder: /config/www/
    source:
      - entity_id: camera.ender_3_stream

What am I doing wrong !! :thinking:

I think you still have to use deepstack as platform in your homeassistant config! This project still uses the deepstack rest api but on the background it is using tensorflow lite!

@jodur double check the vscode situation on pi4, I am running on pi4 but get warning that vscode is not supported. Re comparison with Nuc, I have never owned one so cant comment. I know the Nuc costs considerably more, so I would save my money and just get a pi4.

@Hitesh_Singh you will need to pip install deepstack-python in your environment, I have updated this now on the repo

1 Like

it seemed a person to me too!

@robmarkcole

VSCODE is only running op pi with hassio 64 bit versions, you probably have a 32 bit version (so have i) (https://www.home-assistant.io/blog/2020/02/19/community-highlights/)

Thanks for the tip!