python-yolo plugin installer
parent
482939bc08
commit
1148deca5d
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
sudo apt update -y
|
||||
sudo apt-get install libxml2-dev libxslt-dev libxslt1-dev zlib1g-dev -y
|
||||
if ! [ -x "$(command -v python3)" ]; then
|
||||
echo "Installing python3"
|
||||
sudo apt install python3 python3-dev python3-pip -y
|
||||
sudo apt install python3-lxml libxml2-dev -y
|
||||
else
|
||||
echo "python3 found"
|
||||
fi
|
||||
if ! [ -x "$(command -v gcc-6)" ]; then
|
||||
echo "Installing gcc-6 and g++-6"
|
||||
sudo apt-get install gcc-6 g++-6 -y && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
else
|
||||
echo "gcc-6 and g++-6 found"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
if ! [ -x "$(command -v nvidia-smi)" ]; then
|
||||
echo "You need to install NVIDIA Drivers to use this."
|
||||
echo "inside the Shinobi directory run the following :"
|
||||
echo "sh INSTALL/cuda9-part1.sh"
|
||||
exit 1
|
||||
else
|
||||
echo "NVIDIA Drivers found : $(nvidia-smi |grep 'Driver Version')"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
if [ ! -d "/usr/local/cuda" ]; then
|
||||
echo "You need to install CUDA Toolkit to use this."
|
||||
echo "inside the Shinobi directory run the following :"
|
||||
echo "sh INSTALL/cuda9-part2-after-reboot.sh"
|
||||
exit 1
|
||||
else
|
||||
echo "CUDA Toolkit found"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
if ! [ -x "$(command -v opencv_version)" ]; then
|
||||
echo "You need to install OpenCV with CUDA first."
|
||||
echo "inside the Shinobi directory run the following :"
|
||||
echo "sh INSTALL/opencv-cuda.sh"
|
||||
exit 1
|
||||
else
|
||||
echo "OpenCV found : $(opencv_version)"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
export GPU=1
|
||||
export OPENCV=1
|
||||
if [ ! -x "$(command -v darknet)" ]; then
|
||||
if [ ! -d "/opt/darknet" ]; then
|
||||
export PATH=/usr/local/cuda/bin:$PATH
|
||||
pip3 install lxml
|
||||
pip3 install numpy
|
||||
pip3 install cython
|
||||
echo "Installing Darknet"
|
||||
cd /opt
|
||||
git clone https://github.com/pjreddie/darknet.git darknet
|
||||
cd darknet
|
||||
make
|
||||
cd ..
|
||||
git clone https://github.com/madhawav/YOLO3-4-Py.git YOLO3-4-Py
|
||||
cd YOLO3-4-Py
|
||||
export GPU=1
|
||||
export OPENCV=1
|
||||
pip3 install .
|
||||
apt remove libpython-all-dev python-all python-all-dev python-asn1crypto python-cffi-backend python-crypto python-cryptography python-dbus python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-pkg-resources python-secretstorage python-setuptools python-six python-wheel python-xdg -y
|
||||
echo "Done Installing Darknet"
|
||||
fi
|
||||
export PATH=/opt/darknet:$PATH
|
||||
else
|
||||
echo "Darknet found"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
if [ ! -e "./conf.json" ]; then
|
||||
echo "Creating conf.json"
|
||||
sudo cp conf.sample.json conf.json
|
||||
else
|
||||
echo "conf.json already exists"
|
||||
fi
|
||||
echo "-----------------------------------"
|
||||
echo "Start the plugin with pm2 like so :"
|
||||
echo "pm2 start shinobi-python-yolo.js"
|
|
@ -95,7 +95,6 @@ s.detectObject=function(buffer,d,tx){
|
|||
if(err) return s.systemLog(err);
|
||||
if(s.isPythonRunning === false)return console.log('Python Script is not Running.')
|
||||
s.getRequest('http://localhost:'+config.pythonPort+'/get?img='+d.dir+d.tmpFile,function(data){
|
||||
console.log(data)
|
||||
if(data.length > 0){
|
||||
var mats=[]
|
||||
data.forEach(function(v){
|
||||
|
|
Loading…
Reference in New Issue