Shinobi/plugins/tensorflow-coral
Levent K db13c16260 Refactored shinobi-tensorflow.js (by moe and thellamafarm) 2020-10-28 15:02:53 +00:00
..
.gitignore adding coral tensorflow plugin 2020-09-19 12:36:58 +02:00
INSTALL.sh Update INSTALL.sh 2020-10-12 16:48:22 +00:00
README.md update readme and install script 2020-09-19 17:07:09 +02:00
conf.sample.json adding coral tensorflow plugin 2020-09-19 12:36:58 +02:00
detect.py adding coral tensorflow plugin 2020-09-19 12:36:58 +02:00
detect_image.py Adjust model file name 2020-10-11 08:09:36 +00:00
package.json adding coral tensorflow plugin 2020-09-19 12:36:58 +02:00
shinobi-tensorflow.js Refactored shinobi-tensorflow.js (by moe and thellamafarm) 2020-10-28 15:02:53 +00:00

README.md

TensorFlowCoral.js

Ubuntu and CentOS only

Go to the Shinobi directory. /home/Shinobi is the default directory.

cd /home/Shinobi/plugins/tensorflow

Install TensorFlows python version first: https://www.tensorflow.org/lite/guide/python Make sure that you are downloading the correct file for your system architecture and python version.

Install other python dependencies

pip install pillow
pip install numpy

Copy the config file.

sh INSTALL.sh

IF YOU DON'T HAVE INSTALLED CORAL DEPENDENCIES BEFORE, YOU NEED TO PLUG OUT AND THEN PLUG IN YOUR CORAL USB ACCELERATOR BEFORE USING THIS PLUGIN!

Start the plugin.

pm2 start shinobi-tensorflow.js

Doing this will reveal options in the monitor configuration. Shinobi does not need to be restarted when a plugin is initiated or stopped.

Run the plugin as a Host

The main app (Shinobi) will be the client and the plugin will be the host. The purpose of allowing this method is so that you can use one plugin for multiple Shinobi instances. Allowing you to easily manage connections without starting multiple processes.

Edit your plugins configuration file. Set the hostPort to be different than the listening port for camera.js.

nano conf.json

Here is a sample of a Host configuration for the plugin.

  • plug is the name of the plugin corresponding in the main configuration file.
  • https choose if you want to use SSL or not. Default is false.
  • hostPort can be any available port number. Don't make this the same port number as Shinobi. Default is 8082.
  • type tells the main application (Shinobi) what kind of plugin it is. In this case it is a detector.
{
  "plug":"Tensorflow",
  "hostPort":8082,
  "key":"Tensorflow123123",
  "mode":"host",
  "type":"detector"
}

Now modify the main configuration file located in the main directory of Shinobi.

nano conf.json

Add the plugins array if you don't already have it. Add the following object inside the array.

  "plugins":[
      {
          "id" : "Tensorflow",
          "https" : false,
          "host" : "localhost",
          "port" : 8082,
          "key" : "Tensorflow123123",
          "mode" : "host",
          "type" : "detector"
      }
  ],