#!/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 # Assuming you're running from the yoloserv dir (eg not sbin) export PYTHONPATH="$PYTHONPATH:lib/yolov5-face_Jan1" export WEIGHTS="./lib/yolov5-face_Jan1/runs/train/exp/weights/yolov5m6_face.pt" echo "PYTHONPATH = $PYTHONPATH" # Install all the components. # There are many of them and they are all different. # Some are proprietary, so check your licensing (ask Matt) function f_apt(){ case $1 in "updates") apt update apt upgrade apt install libopencv-dev python3-opencv python3 -m pip install --upgrade pip ;; "regula") f_apt_regula ;; "yolov5") f_apt_yolov5 ;; "yolov8") f_apt_yolov8 ;; "paravision") f_apt_paravision ;; "deepface") pip3 install deepface ;; "freeface") f_apt_facerec ;; "paraface") f_apt_regula f_apt_yolov5 f_apt_paravision ;; "intox") f_apt_yolov5 f_apt_intox ;; *) echo "Error. Second parameter must be updates|regula|yolov5|paravision|freeface|paraface|palm|intox" ;; esac } function f_apt_regula(){ apt install pcscd libccid wget -O downloads/regula.deb https://downloads.regulaforensics.com/repo/ubuntu/pool/stable/r/regula-reader/regula-reader_6.7.198393.16246_amd64.deb wget -O downloads/drivers.deb https://downloads.regulaforensics.com/repo/ubuntu/pool/stable/r/regula-drivers/regula-drivers_2.1.1.12_amd64.deb dpkg --install downloads/regula.deb } function f_apt_yolov5(){ wget -O downloads/yolov5.zip https://github.com/ultralytics/yolov5/archive/refs/heads/master.zip cd downloads unzip yolov5.zip cd $HERE } function f_apt_yolov8(){ wget -O downloads/yolov8.zip https://github.com/ultralytics/ultralytics/archive/refs/heads/main.zip cd downloads unzip yolov8.zip cd $HERE } function f_apt_openvino(){ sudo pip3 install openvino } function f_apt_paravision(){ # Needs openvino . /usr/local/lib/python3.10/dist-packages/ ROOTURL="http://824f668f-5c6e-4ffe-8b5b-edb4d0301982:985c5412-5e0d-4d66-8d28-ed32dbb900a3@paravision.mycloudrepo.io" pip3 install cmake --upgrade pip3 install --no-cache-dir\ --extra-index-url $ROOTURL/repositories/python-sdk\ --extra-index-url $ROOTURL/repositories/python-recognition\ "paravision-recognition" "paravision-models-gen5-balanced-openvino-2022-3" "openvino==2022.3"\ --trusted-host paravision.mycloudrepo.io } function f_apt_facerec(){ # Open source Face_Recognition wget -O downloads/facerec.zip https://github.com/ageitgey/face_recognition/archive/refs/heads/master.zip cd downloads unzip facerec.zip cd $HERE } function f_apt_intox(){ make -f sbin/Makefile } 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 "apt") f_apt $2 ;; "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