DeepStack installation

We created a lot of DeepStack self-help content.
The DeepStack + Blue Iris article talks about the integration and proper setup.
The DeepStack Gotchas article is learnings from past tickets.
Understanding the DeepStack analysis (.dat) functionality is very useful when trying to understand what DeepStack is doing.
See Fine Tuning Settings article.
Post Reply
varghesesa
Posts: 90
Joined: Thu Jul 11, 2019 9:52 pm

DeepStack installation

Post by varghesesa »

Introduction

Blue Iris integrated directly with the Deepstack open source AI project with the 5.4.0 release. This is an on-prem only AI solution requested by many users. Deepstack (deepstack.cc) was a private AI company (December 2018) located in Nigeria that recently open sourced their work (March 2019). If you prefer to listen instead of read, watch the DeepStack AI webinar associated with this article.

The DeepStack user experience article goes under the covers of the integration to explain the user interface as well as the unique advantages of the integration.

The DeepStack Fine tuning article explains the DeepStack analysis feature. Makes trouble-shooting AI alerts so easy now.

The DeepStack Gotchas article are all the lessons learned from past tickets.


Architecture

deepstack architecture.png
deepstack architecture.png (15.64 KiB) Viewed 23010 times


Deepstack AI Installation

Depending on your machine, you can choose the many Windows installation options. Below is the link to the Windows installation page. The CPU version is very easy to install. Just run the installer.

https://docs.deepstack.cc/windows/

Here is a link to a great video on setting up BI + DeepStack.

:!: Intel from a user. 20220-Jan-28
A new version of DeepStack was just released. There is an issue with the way Blue Iris starts up the new version of DeepStack. The issue is DS version 2021.09.01 had two of the same files just named differently in the folder "C:\DeepStack\server". One was named deepstack.exe and the other was named server.exe. Blue Iris is trying to start up server.exe.

DeepStack version 2022.01.1 only has one file in folder "C:\DeepStack\server" named deepstack.exe. I did a temporary fix by copying deepstack.exe in the same folder with the file name server.exe.

Link: https://github.com/johnolafenwa/DeepSta ... /2022.01.1

Engineering states 5.5.5.1 will have the fix.

:!: The DeepStack website needs some cleanup. There are pages on the site that point to a legacy installer that does not work! Stick to the URL above and you will be fine. In particular, the incorrect installer name is DeepStack.Installer.exe. My hunch is this version was created around 2019 before the company decided to open source their software. Another clue you have the wrong version is when you bring up the DeepStack splash page, Activation Key information is part of the page.

deepstack wrong activation page.PNG
deepstack wrong activation page.PNG (99.64 KiB) Viewed 19831 times


If you choose the wrong version, you will find BI cannot start DeepStack automatically. It cannot communicate with the server either with below errors in the Status -> Log.

deepstack error.PNG
deepstack error.PNG (22.95 KiB) Viewed 21180 times

As a final check, below is a screenshot of my install directory. I installed the Windows GPU version so your directory may be different based on the version installed. I have seen tickets where the install directory did not even have a README.md file which made me suspicious as to whether the installation was valid.

deepstack installation_install dir.png
deepstack installation_install dir.png (118.34 KiB) Viewed 13563 times

Other useful Deepstack resources; I decided to use the GPU option because of my NVidia GPU.

According to the documentation, the GPU installation also requires CUDA 10.1 and cuDNN. The latest version of CUDA is 11.2. I took a chance with CUDA 11.2 and it seems to be working fine for me. I will share issues if I come across any. For those who are curious, CUDA is an API created by NVidia to make parallel programming on NVidia GPUs easier.


Manual start
Run DeepStack manually to confirm Installation.

I prefer to work in stages. For me a good first step is to install/run DeepStack manually. To start DeepStack manually, from a CMD prompt run the below command.

Code: Select all

deepstack --VISION-DETECTION True --PORT 82
The above command assumes you want to run DeepStack on port 82. Below is an image of the DeepStack console when the software is running correctly.

deepstack started.PNG
deepstack started.PNG (21.32 KiB) Viewed 19823 times

In addition to the console, you also get confirmation via the DeepStack browser confirmation page. From a browser go to localhost:82 (or port chosen to run the server)
deepstack.PNG
deepstack.PNG (196.52 KiB) Viewed 23082 times

If DeepStack is running correctly, connect BI to DeepStack to confirm BI and DeepStack can work together. To do so, edit Global settings -> AI tab. The below settings tell BI where the DeepStack server is running, i.e. on the same machine on port 82. With this information, BI is able to send AI requests to DeepStack.

deepstack connect.PNG
deepstack connect.PNG (33.23 KiB) Viewed 19823 times

Checklist: Confirm whether BI can communicate successfully with the DeepStack server.
  • Global settings -> AI tab:
    Select "Use DeepStack server on IP/port". (see above)
    Specify which port to use for DeepStack. 82 is the default. As long as it is NOT the same port as the BI web server you are fine. I'm assuming you installed DeepStack on your BI machine, thus IP Address = 127.0.0.1. BI does allow the ability to run DeepStack on a separate server.
  • DO NOT check Auto start/stop with Blue Iris.
  • Jump to Blue Iris AI Camera settings section below and turn on DeepStack for one camera.
  • Check for any errors in Status -> log.
    When working correctly, the motion event in the log should be followed by a DeepStack response as seen below.
    deepstack status log.PNG
    deepstack status log.PNG (7.86 KiB) Viewed 20910 times
  • Check the DeepStack console as well. Are requests / response being processed by DeepStack?
If connected correctly and you activated AI on one of your cameras (see below), you can see request/response messages in the DeepStack console as seen below. At this point you know DeepStack is installed and running correctly.
deepstack log.PNG
deepstack log.PNG (146.93 KiB) Viewed 20954 times


BI Manages DeepStack
Once you confirmed BI/DeepStack communication, you can consider tightly connecting BI to DeepStack by activating "Auto start/stop" via Global settings -> AI tab as seen below.

AI global settings.png
AI global settings.png (55.35 KiB) Viewed 22902 times


Checklist: Now you can automate start/stop of DeepStack from BI.
  • Check "Auto start/stop with Blue Iris.
    Best to install DeepStack in default location (C:\DeepStack). If you choose a different location, please specify accordingly.
  • Stop the DeepStack server you started manually. May need to restart machine just to make sure all processes run by DeepStack are shutdown.
  • Hit Start now.
  • Use Test in browser link to confirm Deepstack is running.
  • Similar to above, confirm one camera is processing DeepStack motion events properly.
  • If you want to play with Facial recognition, you can activate the feature as well.
Besides the splash page you can also double check whether DeepStack processes are running.
Bring up task manager. If you see the below processes running, you know DeepStack is running.
server.exe and redis-server.exe are must processes.
python processes will also be seen but not sure if 2 or 1 or more python processes will be created based on load.

deepstack article processes.png
deepstack article processes.png (28.22 KiB) Viewed 18415 times


Distributed Systems
It is feasible to run BI on one machine and Deepstack on a completely separate machine. A separate machine could mean a completely separate hardware server or a VM or a Dockers container.

One user stated he did so successfully by running a Docker container in an Ubuntu 18.04 VM. In his implementation the IP Address for the Docker container was 10.32.1.9.

The docker command was:

Code: Select all

docker run -d \
        --name=deepstack \
        -p 80:5000 \
        -v /opt/deepstack-storage:/datastore:rw \
        -e "VISION-DETECTION=True" \
        -e "VISION-FACE=True" \
        deepquestai/deepstack
/opt/deepstack-storage was the folder where Docker was allowed to permanently store things.

Once setup, similar to the non-distributed system (above), check/confirm that you can access the Deepstack confirmation page from a browser on the BI server (Test in browser link). In BI, the AI settings based on the Docker IP Address mentioned above would be:
deepstack-ai-settings.png
deepstack-ai-settings.png (44.03 KiB) Viewed 21245 times

If you see traffic on the AI machine but no objects in BI, you likely did not enable the vision detection when starting DeepStack. The parameters BI uses to start DeepStack below.

Code: Select all

-VISION-SCENE=False -VISION-DETECTION=True -VISION-FACE=True -ADMIN-KEY= -API-KEY= -PORT=82


Next steps / Submit a ticket

This article is about installing and running DeepStack.

If you are having issues with installing or running DeepStack, it is best to go to the Gotchas article to see if others have seen and resolved the same issue.
DeepStack is an open source 3rd party AI solution. Issues running it are probably better addressed by experts on the DeepStack forum.


Last bumped by varghesesa on Fri Sep 17, 2021 8:36 pm.
Post Reply