Object Detection uses a lot of CPU Power. To mitigate this you can use an NVIDIA Graphics Processor. A desktop GPU, server-class GPU, or even Jetson Nano's tiny little Maxwell. Be sure to install the drivers before installing the plugin. Jetson users do not need to install CUDA drivers, they are already installed.
WARNING : Only do this if you have an NVIDIA graphics chip.
More Versions of CUDA that you can Install
Install NVIDIA Drivers and CUDA Toolkit
curl -s https://gitlab.com/Shinobi-Systems/Shinobi/raw/dev/INSTALL/cuda-10.sh | sudo sh
Reboot.
sudo reboot
Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
Install NVIDIA Drivers and CUDA Toolkit
curl -s https://gitlab.com/Shinobi-Systems/Shinobi/raw/dev/INSTALL/cuda-10.sh | sudo sh
Reboot.
sudo reboot
TensorFlow is the most refined detection method available with Shinobi. There are numerous model sets you can choose from. The default ones provided with the installer are general purpose and detect a number of different things.
OpenCV is an engine used for detection, you should opt to use TensorFlow instead though. This is the same install script used in the CUDA installation but if you do not have the NVIDIA Drivers and CUDA Toolkit it will install OpenCV without it.
Install libraries
curl -s https://gitlab.com/Shinobi-Systems/Shinobi/raw/dev/INSTALL/opencv-cuda.sh | sudo sh
WARNING : Only do this if you have an NVIDIA Graphics Processor and have ran the install script provided above for the Drivers and Toolkit. If you already have them installed please be sure they are compatible with the plugins. You should opt to use TensorFlow instead.
Check the driver status with NVIDIA's utility.
nvidia-smi
nvidia-smi should show you something like this.
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.25 Driver Version: 390.25 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1050 Off | 00000000:01:00.0 Off | N/A |
| 30% 30C P0 N/A / 75W | 0MiB / 1999MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
Download, Build and Install OpenCV with CUDA enabled.
curl -s https://gitlab.com/Shinobi-Systems/Shinobi/raw/dev/INSTALL/opencv-cuda.sh | sudo sh
Driver not starting? You may need to reboot. If not then you may need to install version 340 instead.
sudo apt install nvidia-340* -y
WARNING : Be sure you have OpenCV built and installed with CUDA.
Download, Build and Install OpenALPR with CUDA enabled.
curl -s https://gitlab.com/Shinobi-Systems/Shinobi/raw/dev/INSTALL/openalpr-gpu-easy.sh | sudo sh
We will use TensorFlow as the example for this section. You may need sudo
infront of some commands if your user doesn't have permission to execute them.
Navigate to your plugin's directory, where you downloaded the Shinobi files to.
Example : cd /home/Shinobi/plugins/tensorflow
Navigate to your Shinobi directory and install the node.js wrappers needed to run the plugin. Some plugins will complete the conf.json modifications for you within this installer.
sh INSTALL.sh
Modify the conf.json key
value to anything you want, make it random.
nano conf.json
Open your main conf.json.
nano /home/Shinobi/conf.json
Add the key you created to allow the plugin to authenticate. TensorFlow123123
is the default key provided in the conf.json
for the TensorFlow plugin.
"pluginKeys":{"TensorFlow":"TensorFlow123123"}
Shinobi will need to be restarted after modifying connection keys
pm2 restart camera
Start the plugin
pm2 start shinobi-tensorflow.js
When complete you will see Object Detection : TensorFlow Connected
in your Monitor Settings.
Important information to note are as follows.
Monitor Settings > Global Detector Settings > Send Frames :
Enabling this will push frames to your main detection.
Monitor Settings > Global Detector Settings > Motion Detection :
Disabling this will make your Object Detection as the primary detection engine.
Monitor Settings > Global Detector Settings > Object Detection > Send Frames :
Enabling this will push frames to your object detection engine.
Monitor Settings > Global Detector Settings > Object Detection > Check For Motion First :
Enabling this will force check for motion before sending any images to the object detector.
Not everyone uses object detection and the libraries required can be bothersome to install, based on the OS. For example if I make shinobi-opencv.js a feature then everyone will be required to install OpenCV just to use basic features in Shinobi. This also allows us to swap the plugin with a custom one or run it on another machine entirely. Sharing the work between multiple machines can be a great way to optimize performance.