sync with xtian
This commit is contained in:
parent
65e2394602
commit
c6af086495
11
sbin/ctl.sh
11
sbin/ctl.sh
@ -44,6 +44,8 @@ chmod +x 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
|
||||
@ -57,7 +59,6 @@ EOF
|
||||
}
|
||||
f_read_ukdi
|
||||
|
||||
PORT=8099
|
||||
ZZZ=5
|
||||
|
||||
|
||||
@ -77,7 +78,7 @@ echo "UKDI_yolo_devices = $UKDI_yolo_devices"
|
||||
for i in `echo $UKDI_yolo_devices| tr ',' ' '`
|
||||
do
|
||||
case $i in
|
||||
"para_facematch") LLP="$LLP:$LIB_OPENVINO"
|
||||
"paravision") LLP="$LLP:$LIB_OPENVINO"
|
||||
PYP="$PYP:$PYP_OPENVINO:$PYP_PARAVISION"
|
||||
;;
|
||||
"yolov5") LLP="$LLP:$LIB_OPENVINO"
|
||||
@ -180,7 +181,7 @@ function f_apt_intox(){
|
||||
#### #### # # # # # #### ######
|
||||
|
||||
function f_test(){
|
||||
wget http://localhost:$PORT/process/
|
||||
wget http://localhost:$YOLOPORT/process/
|
||||
}
|
||||
|
||||
function f_start(){
|
||||
@ -189,14 +190,14 @@ function f_start(){
|
||||
echo $$ > var/yoloserv.pid
|
||||
while [ -e var/yoloserv.pid ]
|
||||
do
|
||||
python3 src/yoloserv.py $PORT $UKDI_yolo_indir $UKDI_yolo_outdir $WEIGHTS
|
||||
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:$PORT/shutdown
|
||||
wget http://localhost:$YOLOPORT/shutdown
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
#
|
||||
# Paravision based face matcher
|
||||
#
|
||||
import json
|
||||
|
||||
from paravision.recognition.exceptions import ParavisionException
|
||||
from paravision.recognition.engine import Engine
|
||||
from paravision.recognition.sdk import SDK
|
||||
import paravision.recognition.utils as pru
|
||||
#from openvino.inference_engine import Engineq
|
||||
|
||||
#from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID
|
||||
@ -21,7 +23,7 @@ class Facematch(object):
|
||||
pass
|
||||
|
||||
# Read an image from a file
|
||||
def load(self, imgpath):
|
||||
def loadiii(self, imgpath):
|
||||
if not os.path.exists(imgpath):
|
||||
print("File not found ",imgpath)
|
||||
return False
|
||||
@ -31,7 +33,7 @@ class Facematch(object):
|
||||
return True
|
||||
|
||||
# Assess the face that was read in
|
||||
def process(self):
|
||||
def processiii(self):
|
||||
# Get all faces metadata
|
||||
print("Finding faces in %s" %(self.imgpath))
|
||||
faces = self.sdk.get_faces([self.image], qualities=True, landmarks=True, embeddings=True)
|
||||
@ -57,15 +59,17 @@ class Facematch(object):
|
||||
|
||||
#
|
||||
def load(self, dev1, dev2, id_image_filepath, photo_image_filepath):
|
||||
print("## loading images", dev1, dev2)
|
||||
self.dev1 = dev1
|
||||
self.dev2 = dev2
|
||||
try:
|
||||
# Load images
|
||||
self.id_image = load_image(id_image_filepath)
|
||||
self.photo_image = load_image(photo_image_filepath)
|
||||
self.id_image = pru.load_image(id_image_filepath)
|
||||
self.photo_image = pru.load_image(photo_image_filepath)
|
||||
print("++++++++++++++++ ",self.id_image)
|
||||
return True
|
||||
except:
|
||||
except Exception as e:
|
||||
print("uk oh loading failed ", e)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@ -25,13 +25,13 @@ class yoloserv(object):
|
||||
device = None
|
||||
imgdir = None
|
||||
outdir = None
|
||||
face_detector = None
|
||||
life_detector = None
|
||||
palm_detector = None
|
||||
face_matcher = None
|
||||
palm_matcher = None
|
||||
facedetector = None
|
||||
lifedetector = None
|
||||
palmdetector = None
|
||||
facematcher = None
|
||||
palmmatcher = None
|
||||
ir_camera = None
|
||||
|
||||
devices = []
|
||||
points = []
|
||||
|
||||
|
||||
@ -47,59 +47,60 @@ class yoloserv(object):
|
||||
def initialise(self):
|
||||
with open("/etc/ukdi.json","r") as f:
|
||||
self.conf = json.loads(f.read())
|
||||
|
||||
print("Init yoloserv: %s @ %s %s " % (self.conf["yolo_devices"], self.conf["yolo_indir"], self.conf["yolo_outdir"]) )
|
||||
self.device_list = self.conf["yolo_devices"].split(",")
|
||||
self.devices = self.conf["yolo_devices"].split(",")
|
||||
self.imgdir = self.conf["yolo_indir"]
|
||||
self.outdir = self.conf["yolo_outdir"]
|
||||
|
||||
# Object (face) matching
|
||||
if "para_facematch" in self.device_list:
|
||||
if "paravision" in self.devices:
|
||||
print("Loading paravision facematch...")
|
||||
from para_facematch import Facematch
|
||||
self.facematcher = Facematch()
|
||||
self.facematcher.init()
|
||||
|
||||
# Image acquisition
|
||||
if "camera" in self.device_list:
|
||||
if "camera" in self.devices:
|
||||
print("AAAAAAAAAAA Loading YUV standard camera...")
|
||||
from camera import Camera
|
||||
self.camera = Camera()
|
||||
self.camera.init()
|
||||
if "seek" in self.device_list:
|
||||
if "seek" in self.devices:
|
||||
print("AAAAAAAAAAA Loading seek IR... [NOT YET IMPLEMETED]")
|
||||
self.ircamera = Seek()
|
||||
self.ircamera.init()
|
||||
if "flir" in self.device_list:
|
||||
if "flir" in self.devices:
|
||||
print("AAAAAAAAAAA Loading flir IR... [NOT YET IMPLEMETED]")
|
||||
self.ircamera = Flir()
|
||||
self.ircamera.init()
|
||||
if "fjpalmvein" in self.device_list:
|
||||
if "fjpalmvein" in self.devices:
|
||||
print("AAAAAAAAAAA Loading fjpalmvein... [NOT YET IMPLEMETED]")
|
||||
self.palmvein = self.FJPalmvein()
|
||||
self.palmvein.init()
|
||||
|
||||
# Simple processing with opencv
|
||||
if "opencv" in self.device_list:
|
||||
if "opencv" in self.devices:
|
||||
print("AAAAAAAAAAA Loading opencv...")
|
||||
from opencv import OpenCV
|
||||
self.opencv = OpenCV()
|
||||
self.opencv.init()
|
||||
|
||||
# Object detection
|
||||
if "yolov5" in self.device_list:
|
||||
if "yolov5" in self.devices:
|
||||
print("AAAAAAAAAAA Loading yolov5 object detection...")
|
||||
from yolov5 import Yolov5
|
||||
self.detector = Yolov5()
|
||||
#self.detector.init(self.conf["yolo_indir"],self.conf["yolo_outdir"])
|
||||
|
||||
if "yolov8" in self.device_list:
|
||||
if "yolov8" in self.devices:
|
||||
print("AAAAAAAAAAA Loading yolov8 object detection...")
|
||||
from yolov8 import Yolov8
|
||||
self.detector = Yolov8()
|
||||
#self.detector.init(self.conf["yolo_indir"],self.conf["yolo_outdir"])
|
||||
|
||||
# Intoxication
|
||||
if "intox" in self.device_list:
|
||||
if "intox" in self.devices:
|
||||
print("AAAAAAAAAAA Loading intoxivision...")
|
||||
self.intox_detector = Intox()
|
||||
self.intox_detector.init()
|
||||
@ -158,10 +159,12 @@ class yoloserv(object):
|
||||
print ("Shutdown on client action")
|
||||
os._exit(0)
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
@cherrypy.expose
|
||||
def facematch(self,dev1,dev2):
|
||||
if self.facematcher is None:
|
||||
return '{ "status":777244, "remark":"suitable yolo_device" }'
|
||||
|
||||
if self.conf["emulate_facematch"]:
|
||||
return '{ "status":0, "remark":"OK(Emulated)", "data":{"device1":"%s","device2":"%s","device1_qual":123,"device2_qual":234,"match_score":600} }' % (dev1,dev2)
|
||||
|
||||
@ -176,21 +179,19 @@ class yoloserv(object):
|
||||
if self.conf["emulate_facematch"]:
|
||||
return '{ "status":0, "remark":"OK", "data":{} }'
|
||||
|
||||
self.devices["facematch"].load(dev1, dev2, img1, img2)
|
||||
status = self.devices["facematch"].get_faces()
|
||||
self.facematcher.load(dev1, dev2, img1, img2)
|
||||
status = self.facematcher.get_faces()
|
||||
if status is not None:
|
||||
return '{ "status":777242, "remark":"face matching failed", "guilty_param":"facematch", "guilty_value":"%s" }' % (status)
|
||||
|
||||
status = self.devices["facematch"].compute_scores()
|
||||
status = self.facematcher.compute_scores()
|
||||
if status is not None:
|
||||
return '{ "status":777243, "remark":"face scoring failed", "guilty_param":"facematch", "guilty_value":"%s" }' % (status)
|
||||
|
||||
jsonstr = self.devices["facematch"].get_scores()
|
||||
jsonstr = self.facematcher.get_scores()
|
||||
return '{ "status":0, "remark":"OK", "data":%s }' % (jsonstr)
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 201133f7dac541fb5a6f52d727b994cc8799a6ee
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user