Face and person detection with Deepstack - local and free!

@Alex_Pupkin, any experience on running pytorch serve on a Jetson Nano device?

Seeing the same on my end (detection works, face registering times out) using v2021.02.1. It times out after 60seconds and the DeepStack Log entry isn’t posted until the timeout occurs. Bummer :frowning:

@jodur Right now I have a pretty heavy setup with Ryzen 5950x CPU and 12Gb Nvidia Titan Xp. CPU does not matter i think if you build your images on GPU. 1 model worker uses 500-2Gb of GPU memory from what i can tell depending on the model size (fastrcnn which from I can tell kicks yolo easily is about 1.7Gb). Jetson nano seems to have 4Gb so i think it will work fine. I ran it on 2Gb K2200 Quadro before.

Training models will be tighter but Nvidia has Jetson container images and with small batch sizes i think you could train Yolo for object detection (easy to train, you just need to make small changes in export to export the right torch model - i have github repo for that). Image classifiaction models are not that memory intensive.

Hello.
Have been running Deepstack for a while on a NAS where I also have MotionEye with 3 cameras.
Has worked fine with an “image_processing” of 200-400ms for a camera in MotionEye, but then just went up, after adding 2 extra, so I am now between 14-20sec. for each “image_processing”.
Have tried Mode for Medium and Low but it just makes processing time longer.

My question is then:
I am running HA on a NUC, via Proxmox and considering throwing a Deepstack on it too as it is better than my NAS but can I set up a VM with Deepstack on Proxmox? if so, how! have tried searching on google but did not think I can find anything.

As well as what exactly are these two parameters for “image_processing” doing?

`
timeout: 5

scan_interval: 10
`

Very nice integration. It works fast. I use it at my front door. As soon it detects me, I get a notification on my IPhone asking me if I want to open de door. In the future, I’m thinking to make it more transparent in background with three factors : face recognition (just that isn’t enough since you can recognize face with the picture of someone), bluetooth and GPS trackers.

But everything said, now I want to delete all the faces and start it again because I made some mistakes. I don’t find anywhere the solution. Does someone can help me? Thanks!

1 Like

Hi! Is it possible to run the “docker part” on same machine with Home Assistant if it is intel nuc? I use Home Assistant OS, so not sure if I can install and use use docker.
Any help?
P. S.
So I installed portainer, added new container with:
image - deepquestai/deepstack
ports - 83, 5000
volume - /datastore and localstorage-local (which I just created in volumes menu)
VISION-FACE True

And then wrote this in Home Assistant config:

image_processing:
  - platform: deepstack_face
    ip_address: 192.168.1.14
    port: 83
    timeout: 120
    save_file_folder: /config/snapshots/
    save_timestamped_file: True
    save_faces: True
    save_faces_folder: /config/faces/
    source:
      - entity_id: camera.recognition_camera
        name: face_recogniser

After that I tried to fire a service image_processing.scan and got 500 error:

Depstack error : Error from Deepstack request, status code: 500

And my portainer log:

[GIN] 2021/02/22 - 17:27:37 | 500 |          1m0s |    192.168.1.14 | POST     /v1/vision/face/

And yes, I can access to deepstack’s page on localhost:port

Any ideas what I got wrong?

It may just be me, but most of the ‘faces’ APIs I have tried are simply broken (version 2021.02.1 for CPU). They either return immediately with nothing, or they timeout after a minute. The only one that works for me is face/list which of course returns 0 faces. To answer your first question, yes I have gotten object detection working using Portainer in Hassio (officially Home Assistant).

Hmm, so your deepstack integration was working and now it does not?
But it runs locally on your machine, what could cause the change? If Home Assistant can correctly send a request to deepstack API

Maybe you have tensorflow working too? If so, can you share some details how to make it work?

I’m running 2021.02.1 on my Jetson Nano 2G and it works ok with facial recognition (admittedly I need to train it with some more samples, but it is working). I use Robin’s deepstack-ui for training/testing.

Thanks for letting me know. I’ve been testing out the recent CPU versions, and I’ve seen someone else on this thread seeing the same problem (but said it did work on an older CPU version).

EDIT UPDATE: I just tried the Windows10 version (CPU 2021.01.2) and the face register actually works!! The one I was having a problem with was Docker (CPU 2021.01.2).

Hmm; Might just be an issue with that “CPU” image. The jetson one is specific to jetson’s too: deepquestai/deepstack:jetpack-2021.02.1

@Alex_Pupkin amazing work on your TorchServer integration, can I respectfully suggest that as well as posting it here, you create a thread just for it?

Another approach to consider (or perhaps it is what you mean) is to standardise the API’s across them all like @synesthesiam has here: GitHub - synesthesiam/opentts: Open Text to Speech Server
^^ THIS is a truly awesome piece of work

1 Like

@robmarkcole may I get some help with this question?
Maybe you could at least comment if it is on deepstack side, or I got something wrong with your component? Sorry for tagging, but situation is pretty confusing, seems like everything is done by docs

Can you confirm you have it licensed properly?

Also, try placing a picture in the www folder and creating a camera of the type local file:

Then do your check on that camera to make sure the basic config is working, this is my “test” picture setup which I have left there for the moment

homeassistant:
  whitelist_external_dirs:
    - /config/www/cameras

camera:
  - platform: local_file
    name: file_front_door
    file_path: /config/www/cameras/motion-snapshot-frontdoor1.jpg

Good suggestions Mark. Also, to take HA out of the equation all together, try querying Deepstack directly. e.g

curl -X POST -F [email protected] ‘http://192.168.1.26:5000/v1/vision/detection’

Let us know what response you get back.

I created that camera based on my image and changed image_processing config. I restarted Home Assistant, tried to call service and got the same results:
Depstack error : Timeout connecting to Deepstack, the current timeout is 15 seconds, try increasing this value

I am not sure how to check it, here is deepstack’s page

P.S.
Here is my config:

camera:
  - platform: local_file
    name: file_front_door
    file_path: /config/www/images/Argo.jpg
image_processing:
  - platform: deepstack_face
    ip_address: 192.168.1.14
    port: 83
    timeout: 15
    save_file_folder: /config/snapshots/
    save_timestamped_file: True
    save_faces: True
    save_faces_folder: /config/faces/
    source:
      - entity_id: camera.file_front_door
        name: file_front_door

I opened up my laptop’s terminal and went to directory with my image (Argo.jpg)
than I tried:
curl -X POST -F [email protected] ‘http://192.168.1.14:83/v1/vision/detection’
And got:
curl: (6) Could not resolve host: ‘http

What did I do wrong here?

P.S.
http://192.168.1.14:83/v1/vision/detection - gets me 404 in browser

Maybe check the type of quotation mark in you curl statement. Should look more like:
curl -X POST -F [email protected] 'http://192.168.1.14:83/v1/vision/detection'

{"success":false,"error":"Detection endpoint not activated","duration":0} **%**

Restarting the container did not help

When you started the container, did you use the following environmental variable?
VISION-DETECTION=True