Face and person detection with Deepstack - local and free!

Go back around 13-14 days in this thread and you’ll see some discussion on this problem.

1 Like

Not sure why I overlooked it, but using deepquestai/deepstack:cpu-x5-beta solved the issue. Thanks for pointing that out!

1 Like

Hello,
I have just installed the Deepstack integration for HA and got everything working within a reasonable amount of time, including processing the deepstack.object_detected event and having things announced on Alexa accordingly (kind of like a doorbell). Thank you very much for providing this to the community.
I am currently running basic object detection, and I am now interested in adding face detection and logo detection (via the OpenLogo Deepstack custom model). However I would like to avoid generating un-necessary load by running each image through object detection, then face detection and then logo detection.
I did not find any way to do these 3 things in one call to Deepstack. It seems that any custom model for example needs to be called separately, rather than Deepstack applying all available models to one image (please correct me if this is wrong).

So what I would like to do then, is to first submit my image to Deepstack object recognition, then only if a person was detected, resubmit the SAME IMAGE for face detection. Similarly if a vehicle was detected, resumbit the SAME IMAGE for logo detection.
I know how to process the deepstack.object_detected event and choose the right type of resubmission depending on what was detected. What I’m looking for help with, is how to invoke a new run through my deepstack instance (either for face detection or logo detection) with the same image as already processed (deepstack.object_detected returns the path to the image) from an automation?

Any help is appreciated.

Thank you.

Jean

Hey @robmarkcole
I was wondering if licence plate detection can be done using

I was able to add this model in Deepstack but I really don’t know how to add this in home assistant, it is probably along the same lines as your object detection custom component. Do direct me to the direction that I can take in this regard

1 Like

Hi guys.

I’ve made a simple automation that scan camera repeatly, I’ve notice the deep stack processing time is really fast on the Jetson Nano. It’s about 150ms for a half hd resolution.

However, the total processing of Home Assistant is very high. All the process of capture camera frame, send post request to deepstack wait until return result take total 3 seconds.

What is the best way to improve image processing service interference time?

This is the automation

- id: "1618637076001"
  alias: DeepStack Scan Camera 1
  description: Scan All Camera
  mode: restart
  trigger:
    - platform: homeassistant
      event: start
    - platform: state
      entity_id: automation.deepstack_scan_camera_1
      to: "on"
  condition: []
  action:
    - service: image_processing.scan
      data: {}
      target:
        entity_id:
          - image_processing.camera_1
    - service: system_log.write
      data:
        level: warning
        message: "Cameras 1 scan interval {{ (as_timestamp(now()) - as_timestamp(states.input_text.deepstack_camera_1_last_scan.state)) | float | round(2) }} seconds"
    - service: input_text.set_value
      entity_id: input_text.deepstack_camera_1_last_scan
      data:
        value: "{{ now() }}"
    - service: automation.trigger
      target:
        entity_id: automation.deepstack_scan_camera_1

Deepstack Docker Console: process image take 150 ms

[GIN] 2021/04/22 - 10:40:47 | 200 |  158.901916ms |   192.168.1.122 | POST     /v1/vision/detection

Home Assistant Log: The loop take more than 2 second

[homeassistant.components.system_log.external] Cameras 1 scan interval 2.34 seconds
3 Likes

Hi All,

I’m new to deepstack and also to linux but i managed to get deepstack up and running in the Jetson nano so far workign fine with my home assitant. Just a question, how can i view the deepstack process log? such as on what time and the durution of each image that has been sent to process?

run this command in terminal. Replace deepstack with whaterver you named your docker container

sudo docker container logs -f deepstack

Good day. Need your help

I installed and launched Deepstack-face, configured everything as it is written in the instructions, I do the training as shown in the video, but I get the status unknown. How do I fix this? Where did I mess up? I don’t have an API. Is it necessary to get the API for this?
Я установил и запустил Deepstack-face, настроил все так, как написано в инструкции, я провожу обучение, как показано в видео, но получаю статус неизвестно. Как это исправить? Где я накосячил? У меня нет API. API обязательно для этого нужно получать?

I installed deepquestai/deepstack in docker, below are the screenshots with the settings
Я установил deepquestai/deepstack в docker, ниже приведены скриншоты с настройками


If I specify the ip and port, the page opens
Если я укажу ip и порт, то открывается страница

I brought the recognition information to the page and ran the script for scanning
Вывел на страницу информацию о распознавании и запуск скрипта на сканирование
images04

After the first scan, I get the information that a face is recognized, but it is unknown and this is how it should be until we train the system
После первого сканирования у меня появляется информация, что распознано лицо, но оно неизвестное и это так и должно быть, пока не обучим систему
images05

I do training as shown here on video


Делаю обучение как показывают тут на видео

Docker log entries appear
Записи в журнале докера появляются

After training, my photo is not recognized and is still written unknown.
После обучения у меня фото не распознается и по прежнему пишется неизвестно.

In the config, I inserted the following:
В конфиг вставил следующее:

image_processing:
  - platform: deepstack_face
    ip_address: 192.168.1.200
    port: 5100
    timeout: 5
    detect_only: False
    save_file_folder: /media/deepstack/snapshots/
    save_timestamped_file: True
    show_boxes: True
    source:
      - entity_id: camera.galaxy_ip_camera
        name: face_counter

I noticed that my image is not registered
Я обратил внимание, что у меня не регистрируется изображение

I took a screenshot from the author’s video, the image is registered with him
Сделал скриншот с видео автора, у него изображение регистрируется

I don’t have an image registered
У меня не регистрируется изображение

If I enter it in the browser http://192.168.1.200:5000/v1/vision/detection, then I will get the error 404 page not found
Если введу в браузере http://192.168.1.200:5000/v1/vision/detection, то получу ошибку 404 page not found

I installed the Deepstack UI and also can’t load the image
Установил Deepstack UI и также не могу загрузить изображение

If I specify another port in the docker, it will swear at the connection and that it needs port 80
Если же в докере укажу другой порт, то будет ругаться на подключение и что ему нужен 80 порт


Solved the problem. You can’t register a face image from Home Assistant, but you can do it with curl. To upload an image to deepstack, first upload the image to Synology, and then upload it from the console via curl. You need to upload an image from a local folder somewhere, then it works.

Решил вопрос. Из Home Assistant не удается зарегистрировать изображение лица, но можно сделать это с помощью curl. Для того, чтобы загрузить изображение в deepstack, сначала загрузим изображение в Synology, а после из консоли загрузим через curl. Нужно загрузить изображение из локальной папки куда-то, тогда работает.

In Synology, we create any folder in any place and use the property to view the path to the folder, this is necessary in order to correctly specify the path to the image in the curl command

В Synology создаем любую папку в любом месте и через свойство смотрим путь к папке, это нужно для того, чтобы правильно в команде curl указать путь к изображению

Next, go to Synology via the Putty console with root rights and enter the command from where and where you want to transfer the image and specify that this image needs to be registered. If successful, the message success will be displayed at the bottom:true … as below in the screenshot

Далее заходим в Synology через консоль Putty с правами root и вводим команду от куда и куда нужно перенести изображение и указываем, что данное изображение нужно зарегистрировать. Если успешно, то снизу будет сообщение success:true … как снизу на скриншоте

curl -X POST -F image=@/volume1/Temp/faces/face_detect_latest.jpg -F "userid=Divan" 'http://localhost:5100/v1/vision/face/register'

image

The log will report that the image is registered

В журнале будет сообщаться, что изображение зарегистрировано

During recognition, the name of the recognized person will be displayed in the Home Assistant

При распознавании в Home Assistant будет отображаться имя распознанного человека

1 Like


I have created small container with web gui that helps me to teach new faces and test deepstack.
will be available in docker-hub by the end of the week.

3 Likes

Is it great and will it work on synology? After all, I didn’t have a deepstack ui.

1) Can I view the uploaded photo?
2) Is it possible to delete and add a photo, for example, you need to change the photo?
3) Is it possible to upload or delete photos via Telegram?

Это здорово и будет ли это работать на synology? Ведь deepstack ui у меня не завелся.

  1. Можно ли смотреть загруженное фото?
  2. Можно ли удалить и добавить фото, например нужно поменять фото?
  3. Можно ли через телеграм загружать или удалять фотки?

I made such sensors for myself. I entered the name of the identified person, but I would like to display the name with a translation into my own language. Below I use the attribute to output the name as a sensor, but I couldn’t use the attribute to translate and had to use the sensor. How can I translate a name by attribute?

Сделал для себя такие сенсоры. Вывел имя опознанного лица, но хотел бы выводить имя с переводом на свой язык. Ниже я использую аттрибут для вывода имени в качестве сенсора, но у меня не получилось использовать аттрибут для перевода и пришлось использовать сенсор. Как можно сделать перевод имени по аттрибуту?

# Deepstack sensors
sensor:
  - platform: template
    sensors:

# The sensor displays the number of recognized faces
      persons_hall:
        friendly_name: "People in hall"
        unit_of_measurement: 'Persons'
        value_template: "{{states.image_processing.detect_face.state}}"

# The sensor displays the name of the identified person in English
      persons_hall_en:
        friendly_name: 'Persons in hall en'
        value_template: '{{ states.image_processing.detect_face.attributes.faces[0].name }}'

# The sensor displays the name of the identified person in Russian
      persons_hall_rus:
        friendly_name: 'Persons in hall rus'
        value_template: >
          {% if states.sensor.persons_hall_en.state == 'user_en' %} user_rus
          {% elif states.sensor.persons_hall_en.state == 'user_en' %} user_rus
          {% elif states.sensor.persons_hall_en.state == 'user_en' %} user_rus
          {% elif states.sensor.persons_hall_en.state == 'user_en' %} user_rus
          {% elif states.sensor.persons_hall_en.state == 'user_en' %} user_rus
          {% endif %}

I figured it out and I post how to make a translation of the value of attributes

Разобрался и выкладываю как сделать перевод значении аттрибутов

persons_hall_rus:
        friendly_name: 'Persons in hall rus'
        value_template: >
          {% if states.image_processing.detect_face_tablet.attributes.faces[0].name == 'user_en' %} user_rus
          {% elif states.image_processing.detect_face_tablet.attributes.faces[0].name == 'user_en' %} user_rus
          {% elif states.image_processing.detect_face_tablet.attributes.faces[0].name == 'user_en' %} user_rus
          {% elif states.image_processing.detect_face_tablet.attributes.faces[0].name == 'user_en' %} user_rus
          {% endif %}
1 Like

Is it available?

Up and Running

5 Likes

Tomer_Klein Thank you for the great component Deepstack Trainer :grinning: :+1:

Made the instructions: How do I set up Deepstack and DeepStack Trainer in Docker on Synology?

Сделал инструкцию: Как настроить Deepstack и DeepStack Trainer в Docker на Synology?\

2 Likes

works great, thank you

How do I display a list of names in one line?
Как вывести список имен в одну строчку?
image

I created such a sensor that outputs a list of names in one line, but there is a problem, commas are not put, spaces are put and will show user01_RUS user02_RUS user03_RUS user04_RUS
Я создал такой сенсор, который выводит список имен в одну строку, но есть проблема, не ставятся запятые, проставляются пробелы и будет показывать user01_RUS user02_RUS user03_RUS user04_RUS

      persons_hall_rus:
        friendly_name: 'Persons in hall rus'
        value_template: >
            {% for names in states.image_processing.detect_face_camera.attributes.faces %}
                {% if names.name == 'user01_EN' %} user01_RUS
                {% elif names.name == 'user02_EN' %} user02_RUS
                {% elif names.name == 'user03_EN' %} user03_RUS
                {% elif names.name == 'user04_EN' %} user04_RUS
                {% elif names.name == 'user05_EN' %} user05_RUS
                {% endif %}
            {% endfor %}

I would like to have commas after each name user01_RUS, user02_RUS, user03_RUS, user04_RUS
Мне бы хотелось, чтобы стояли запятые после каждого имени user01_RUS, user02_RUS, user03_RUS, user04_RUS

If I put commas after each name, it will display user01_RUS, user02_RUS, user03_RUS, user04_RUS, where there will be a comma at the end after the name and this is not correct.
Если я поставлю запятые после каждого имени, то будет отображаться user01_RUS, user02_RUS, user03_RUS, user04_RUS, где в конце после имени будет стоять запятая и
это не правильно.

        value_template: >
            {% for names in states.image_processing.detect_face_camera.attributes.faces %}
                {% if names.name == 'user01_EN' %} user01_RUS,
                {% elif names.name == 'user02_EN' %} user02_RUS,
                {% elif names.name == 'user03_EN' %} user03_RUS,
                {% elif names.name == 'user04_EN' %} user04_RUS,
                {% elif names.name == 'user05_EN' %} user05_RUS,
                {% endif %}
            {% endfor %}

If I get the Intel Neural Compute Stick 2, can I stick it in my NUC, and expose it to the Deepstack docker container to offload cpu? (This is what I do with a Coral TPU and Frigate.)

I figured out how to output names, and you can also output names with translation and output it all in one line.
Разобрался как выводить имена, а также можно выводить имена с переводом и все это выводить в одну строчку

You need to edit this file
Редактировать нужно этот файлик
image

I made a video tutorial on how to install deepstack
Cделал видеоинструкцию как устанавливать deepstack