Face and person detection with Deepstack - local and free!

Thats not implemented yet for face

Hi,

Been following this thread with much interest, so thought I’d let you know what I’ve been up to:

I have Home Assistant hass.io running on a Raspberry pi 3b+.
I installed DeepStack with a NCS2 on a Raspberry pi 4 following these instructions -https://python.deepstack.cc/raspberry-pi
I’ve got the integration between HA and Deepstack working well harnessing Line Crossing notifications from a number of Hikvision cameras mounted around the house.
Still playing with automation of notifications etc.

Got a bit sidetracked with the idea that it would be nice to have HA and Deepstack running on the same raspberry pi. To this end, I installed Hassbian on the pi 4 and then installed Deepstack as above. So now I have an instance of HA and Deepstack running on a pi 4 and all seems well except I can’t get the instance of HA on the pi 3 to work with Deepstack as it did previously. I get a timeout errors in HA and no notification in Deepstack of the “detection” api being hit.

Any input into what I might be doing wrong or things to try greatly appreciated.

Thanks.

HI @nigel1
I agree it would be nice to have deepstack and HA on the same pi, good to know you already did this successfully on a pi 4. We are planning to support deepstack as a hassio addon in the future. I suspect this could be a specific issue for Hasspbian, perhaps they lock down the ports or something like that. The hasspbian discord chat might be a place to go for advice.
Cheers

Damn! Looking forward to testing! Nice work!

My use case is pretty simple.
Camera NVR (shinobi) detects motion. Use node-red to grab a snapshot and check the motion is from a person or car (avoiding wind moving trees, shadows etc) - as really I only care if a random person is somewhere near my house and less that a tree is moving lol. I currently manually save that file, but may move to your implementation.

I read you are looking to make an official integration. Haven’t played with your updates yet, but wondering if you could combine a single camera/image to have multiple targets, color bounding boxes differently. Save as a single file or different file?

image_processing:
  - platform: deepstack_object
    ip_address: localhost
    port: 5000
    api_key: Mysecretkey
    save_file_folder: /config/www/deepstack_person_images
    source:
      - entity_id: camera.local_file
        name: person_detector
        target: person
          show_bounding_box: true
          color: yellow
          save_file_prefix: person
        target: car
          show_boundjng_box: true
          color: red
          save_file_prefix: car

Not sure how useful that would be for folks though?

Either way, been using this for a while and LOVE it. In my mind your component is a key difference between an automated home, and a smart home! Thank you!

3 Likes

Thanks for your reply.
I believe the port is not an issue as I can reach the web ui on port 5000
I’ll do some digging.
Btw, any idea why the bounding boxes on images from one specific camera are mis-alligned (below) the identified person? Not the end of the world, just the perfectionist in me :grin:

Hey thanks for all your awesome projects on here! I noticed on your coral hit hub it’s archived.

Is that project dead? Did this replace it?

Thanks again.

@nigel1 where is your image? I notice sometimes bounding boxes are not perfect, but usually not far off.

@Darbos to coral is now integrated through my deepstack_object integration as described in the readme. Why duplicated work

Thank you. I thought that may be it. These two projects (deepstack and the usb accelerate project I linked) look the same just using different api servers? Is one preffered over the other, or faster? Thanks

It depends which hardware you have. Coral is using tensorflow-lite models which are less accurate but faster than the deepstack models. So it depends if you want:

  • Fast and tolerate lower accuracy, use coral
  • Slower but higher accuracy, use deepstack

Thanks, that clears it up perfect.

Im using a coral to watch my driveway and garage…and notify me if my car is in the driveway and not the garage when it is about to rain.

1 Like

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: