How to Install DeepStack Object Detection on GPU
A plugin made by Elad Bar of the Shinobi Community. Here's how to get it running with an NVIDIA GPU.
It is not recommended that you run this on CPU only. Having an NVIDIA GPU increases performance and longevity of your setup. This was tested on a P106-100 GPU (Headless GTX 1060). I have two of them installed but nvidia-smi only reports one in use.
Install NVIDIA Drivers
The Shinobi folder includes an installer for getting NVIDIA Display Drivers as well as CUDA Toolkit and cuDNN.
You can also install them with this one-liner (tested for Ubuntu 20.04).
bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi/-/raw/dev/INSTALL/cuda-10-2.sh)
Other Versions : https://hub.shinobi.video/articles/view/jPEYnfOFEYdcss7
Install Docker
DeepStack is easier to install with Docker, So you may follow along here to install it.
Install NVIDIA Docker
As noted in the DeepStack documentation you may install GPU capabilities for docker with the following commands.
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \ sudo apt-key add - distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \ sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo pkill -SIGHUP dockerd
Get the DeepStack Image
Download the image from DockerHub.
sudo docker pull deepquestai/deepstack:gpu
Start DeepStack
The following command will create a container from the DeepStack image you had downloaded.
sudo docker run --gpus all -e VISION-FACE=True -e VISION-DETECTION=True -v localstorage:/datastore -p 5000:5000 deepquestai/deepstack:gpu
Once it has started you may lose control of the terminal window, you can close the terminal window and open a new one to resume using terminal commands.
Install the DeepStack Plugin for Shinobi
1. Navigate to the Shinobi folder in terminal. By default this is /home/Shinobi.
cd /home/Shinobi/plugins/deepstack-object
This path shows deepstack-object but you may also navigate to deepstack-face for Facial Recognition rather than standard Object Detection.
2. Run with the following to Install the plugin's dependencies.
sh INSTALL.sh
3. Modify the conf.json deepStack object's host and port parameter to point at your DeepStack server. If you are installing all of this now, on the same machine, don't change it.
4. Restart Shinobi once to activate the plugin key. Shinobi only needs to be restarted this one time to allow initiating or disabling the plugin.
node shinobi-deepstack-object.js
You can save it to the startup list with the following
pm2 start node shinobi-deepstack-object.js pm2 save
Now you should see the DeepStack plugin as your connected Object Detector.
Enjoy!