#!/bin/bash # # DISPENSION CONFIDENTIAL # # [2020] - [2021] Dispension Industries Limited. # Portions Copyright © 2014-2020 Atlantean Technical Solutions Limited # with full licensing rights granted to Dispension & Successors. # # All Rights Reserved. # # NOTICE: All information contained herein is, and remains # the property of Dispension Industries Limited. # The intellectual and technical concepts contained # herein are proprietary to Dispension Industries Limited # and its suppliers and may be covered by U.S. and Foreign Patents, # patents in process, and are protected by trade secret or copyright law. # Dissemination of this information or reproduction of this material # is strictly forbidden unless prior written permission is obtained # from Dispension Industries Limited. # # OK just so were clear, this is a pretty complicated lib. This is due # to all the various tools we are obliged to use due to various tech # we've been asked to implement, some of which is proprietary, most # of which is experimental and ALL of which is huge. # See doc for more details. # # sudo pip3 install openvino opencv-python yolov5 yolov8 . awesome_venv/bin/activate HERE=$PWD DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $DIR/.. # Read in UKDI and determine basic PATHs etc function f_read_ukdi(){ cat /etc/ukdi.json |\ tr -d '"'| sed 's/,$//'|\ awk '{ if (NF>1){print "export UKDI_"$1"=\""$2"\"" } }' |\ sed 's/://' > var/gen.ukdi chmod +x var/gen.ukdi . var/gen.ukdi export ZZZ=5 export UKDIHOST=`echo $UKDI_ukdi|tr '/:,' ' '| awk '{print $2}'` export UKDIPORT=`echo $UKDI_ukdi|tr '/:,' ' '| awk '{print $3}'` export YOLOHOST=`echo $UKDI_yolo|tr '/:,' ' '| awk '{print $2}'` export YOLOPORT=`echo $UKDI_yolo|tr '/:,' ' '| awk '{print $3}'` export CORE=$PWD/../core export UKDI=$PWD/../ukdi export YOLO=$PWD/../yoloserv cat< var/yoloserv.pid while [ -e var/yoloserv.pid ] do python3 src/yoloserv.py $YOLOPORT $UKDI_yolo_indir $UKDI_yolo_outdir $WEIGHTS sleep $ZZZ done } function f_stop(){ rm var/yoloserv.pid wget http://localhost:$YOLOPORT/shutdown } echo "Running $0 with option $1 at $DIR" case $1 in "apt") f_apt ;; "start") f_start ;; "restart") f_stop f_start ;; "reload") f_reload ;; "stop") f_stop ;; *) echo "Error. $1 is not a $0 command." ;; esac cd $HERE