minor changes to python path

This commit is contained in:
carl 2023-08-22 07:25:06 -03:00
parent 950214c389
commit 36ce234a8b
2 changed files with 58 additions and 14 deletions

View File

@ -19,22 +19,66 @@
# from Dispension Industries Limited. # 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.
HERE=$PWD HERE=$PWD
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR/.. cd $DIR/..
# Read in UKDI and determine basic PATHs etc
function f_read_ukdi(){
cat /etc/ukdi.json |\
tr -d '",'|\
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 CORE=$PWD/../core
export UKDI=$PWD/../ukdi
export YOLO=$PWD/../yoloserv
cat<<EOF
UKDIHOST=$UKDIHOST
UKDIPORT=$UKDIPORT
CORE=$CORE
UKDI=$UKDI
EOF
}
f_read_ukdi
PORT=8099 PORT=8099
IMGDIR="/tmp/yoloserv_in"
OUTDIR="/tmp/yoloserv_out"
ZZZ=5 ZZZ=5
# Assuming you're running from the yoloserv dir (eg not sbin) # Determina all the possible libs based on whats in UKDI_yolo_devices
export PYTHONPATH="$PYTHONPATH:lib/yolov5-face_Jan1" LIB_OPENVINO="modules/openvino/inference_engine"
export WEIGHTS="./lib/yolov5-face_Jan1/runs/train/exp/weights/yolov5m6_face.pt" PYP_OPENVINO="modules/openvino"
echo "PYTHONPATH = $PYTHONPATH" PYP_PARAVISION="modules/paravision"
# WHich libs are loaded depends on the YOLO device list
LLP=""
PYP=""
for i in `echo $UKDI_yolo_devices | tr ',' ' ' `
do
case $i in
"paravision") LLP="$LLP:$LIB_OPENVINO"
PYP="$PYP:$PYP_PARAVISION"
;;
esac
done
export LD_LIBRARY_PATH="$LLP"
export PYTHONPATH="$PYP"
export WEIGHTS="$DIR/../modules/yolov5-face_Jan1/runs/train/exp/weights/yolov5m6_face.pt"
# Install all the components. # Install all the components.
# There are many of them and they are all different. # There are many of them and they are all different.
@ -125,12 +169,12 @@ function f_test(){
} }
function f_start(){ function f_start(){
mkdir -p $IMGDIR echo PPPPPPPPPPPp
mkdir -p $OUTDIR echo $PYTHONPATH
echo $$ > var/yoloserv.pid echo $$ > var/yoloserv.pid
while [ -e var/yoloserv.pid ] while [ -e var/yoloserv.pid ]
do do
python3 src/yoloserv.py $PORT $IMGDIR $OUTDIR $WEIGHTS python3 src/yoloserv.py $PORT $UKDI_yolo_indir $UKDI_yolo_outdir $WEIGHTS
sleep $ZZZ sleep $ZZZ
done done
} }
@ -162,4 +206,4 @@ esac
cd $HERE cd $HERE

View File

@ -88,8 +88,8 @@ class yoloserv(object):
# Object matching # Object matching
if "paravision" in self.device_list: if "paravision" in self.device_list:
print("Loading paravision...") print("Loading paravision...")
from paravision import Paravision from paravisionx import Paravisionx
self.facematcher = Paravision() self.facematcher = Paravisionx()
self.facematcher.init() self.facematcher.init()
if "facematch" in self.device_list: if "facematch" in self.device_list:
print("Loading facematch...") print("Loading facematch...")
@ -143,4 +143,4 @@ if __name__ == '__main__':
cherrypy.config.update({'server.socket_host': '0.0.0.0', cherrypy.config.update({'server.socket_host': '0.0.0.0',
'server.socket_port': servport}) 'server.socket_port': servport})
cherrypy.quickstart(s, '/') cherrypy.quickstart(s, '/')