yoloserv/sbin/ctl.sh
2023-05-15 07:01:50 -03:00

79 lines
1.7 KiB
Bash
Executable File

#!/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.
#
HERE=$PWD
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR/..
PORT=8099
IMGDIR="/tmp/yoloserv_in"
OUTDIR="/tmp/yoloserv_out"
ZZZ=5
export PYTHONPATH="$PYTHONPATH:./yolov5-face_Jan1"
export WEIGHTS="./yolov5-face_Jan1/runs/train/exp/weights/yolov5m6_face.pt"
function f_test(){
wget http://localhost:$PORT/process/
}
function f_start(){
mkdir -p $IMGDIR
mkdir -p $OUTDIR
echo $$ > var/yoloserv.pid
while [ -e var/yoloserv.pid ]
do
python3 src/yoloserv.py $PORT $IMGDIR $OUTDIR $WEIGHTS
sleep $ZZZ
done
}
function f_stop(){
rm var/yoloserv.pid
wget http://localhost:$PORT/svc_stop
}
echo "Running $0 with option $1 at $DIR"
case $1 in
"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