Face and person detection with Deepstack - local and free!

I am getting “Platform error image_processing.deepstack_object - Integration ‘deepstack_object’ not found.” when I check configuration in Home Assistant. I am using Hassio docker and DeepStack docker

curl -X POST -F image=@/disks/data/share/Photos/jmm.JPG ‘http://192.168.0.50:5000/v1/vision/detection’ does return {“success”:true,“predictions”:[{“confidence”:0.9992482,“label”:“person”…

here is config in HA

image_processing:
  - platform: deepstack_object
    ip_address: 192.168.0.50
    port: 5000
    api_key: !secret
    save_file_folder: /config/www/deepstack_person_images
    source:
      - entity_id: camera.local_file
        name: person_detector

I have restarted the machine where these dockers are running. Are there any dependencies I need to install to integrate deepstack_object as Image Processing platform in HA container?

Does anyone know if the deepstack_latest_{target}.jpg gets locked if a nofication grabs the file and sents it?

    - service: notify.android
      data_template:
        message: 'Car spottet {{states.image_processing.driveway_object_car.attributes.last_car_detection}}'
        data:
          image: https://xxxxxxxxxxxxxxxxxxxxxxxxx:8123/local/deepstack_car_images/driveway/deepstack_latest_car.jpg

It looks like the file sometimes locks and not gets updated, which results that I get the same file sent twice.

Anyone?

@Yoinkz I observed this and created an issue

Oh okay. Sounds good. Was also asking in the Ariela forum, because I use the fcm-android Notification system.

I was testing further yesterday and I got this

5 Notifications where the picture was the same. I Tag all the Notification messages with the last_person_detected variable you added lately. So The time is almost exactly the same as the ones that are on the images when created.

But when looking at the pictures that deepstack creates, it certainly is different pictures, which isn’t the case on the Notifications.

Let me know if you need any additional information or if you want me to test something! :slight_smile:

Yes its a race condition, will address

where do i add the scan_interval?
in the document, it says under sensor but i don’t have sensor, only :

image_processing:
  - platform: deepstack_object
    ip_address: 192.168.1.66
    port: 5000
    api_key: Mysecretkey
    save_file_folder: /config/www/deepstack_person_images
    source:
      - entity_id: camera.kitchen_1_camera
        name: person_detector
image_processing: 
  - platform: deepstack_object
    ip_address: 192.168.1.2
    port: 5000
    api_key: Mysecretkey
    scan_interval: 10000
    save_file_folder: /config/www/deepstack_person_images
    source:
      - entity_id: camera.entrada
        name: person_detector_entrada

and how do you do auto delete of the images in that folder that older then 1 day?

1 Like

Anybody try to compare Dlib and Deepstack? Who is faster and better?

define better :slight_smile:

I’m trying this out and it is indeed very cool. :slight_smile:
One thing that I can’t figure out though:

I’ve set this up so that the image_processing starts 20 seconds after motion stops where the camera is located. Seems to work. But - when motion goes on for a while, I don’t get deepstack to analyze every “movie” recorded by the camera. (The camera would record a number of small movieclips), and if this happens while waiting the 20 seconds and also the analyze time, I miss it completely. I guess if one could “queue up” the clips to be processed by deepstack that would help.

I hope that makes sense.

Does anyone have any ideas?

When checking my configuration I am getting this error:

Invalid config for [image_processing.deepstack_face]: [api_key] is an invalid option for [image_processing.deepstack_face]. Check: image_processing.deepstack_face->api_key. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/image_processing.deepstack_face/

Is there a special way I am supposed to put my key in?

Also these are flooding my logs:

2019-10-31 22:08:26 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:08:46 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:09:07 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:09:27 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:09:33 ERROR (MainThread) [homeassistant.components.hassio] Invalid config for [image_processing.deepstack_face]: [api_key] is an invalid option for [image_processing.deepstack_face]. Check: image_processing.deepstack_face->api_key. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/image_processing.deepstack_face/
2019-10-31 22:09:48 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:10:09 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20
2019-10-31 22:10:29 WARNING (MainThread) [homeassistant.components.image_processing] Updating deepstack_face image_processing took longer than the scheduled update interval 0:00:20```

Have you specified an api_key when starting deepstack?

sudo docker run -e VISION-FACE=True -e API-KEY="Mysecretkey" -v localstorage:/datastore -p 5000:5000 deepquestai/deepstack

Hey Nigel, Yes I did. I changed to using the object detection vs the facial and I currently have it working for that. So I’m not sure if there is something wrong with the deepstack facial

1 Like

#!/bin/bash

folder1=/config/www/deepstack_person_cocina

folder2=/config/www/deepstack_person_salaestar1

find $folder1 -type f -name ‘*.jpg’ -mtime +5 -exec rm {} ;

find $folder2 -type f -name ‘*.jpg’ -mtime +5 -exec rm {} ;


replace folder with your config, (+5 in your case with 1) save this bash file inside docker, register shell_command in your config, and then make an automation, i run it every restart.

Does the free version of deepstack have GPU acceleration? I’m currently pegged at 100% CPU, and I have a gtx 950 that I could have it use if I switch from windows to Linux.

So after going though all the hassle of installing linux (didn’t like my gtx950) deepstack does require a paid version for the GPU accelerations… bummer… anyone want to split the cost of a key since you get 2 installs per key?

Also I know my recycling cans look very suspecious…but why is it detecting them? Isn’t the default target only “person”?

cans

Check your confidence threshold, maybe its too low

hello, the first thing woooww, this is incredible, I am in love with this project thanks for sharing it and investing your knowledge and time in it. Do you know if there will be improvements in the detection speed in upcoming updates and if so, when could we get to see them?
Greetings and thank you very much again

what is your detection speed? last I looked on an old cpu it was great!