ccimx93: update ML package for NXP release 6.6.36-2.1.0
https://onedigi.atlassian.net/browse/DEL-9257 Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
c0bd349874
commit
d83cb9b914
|
|
@ -9,16 +9,18 @@ Just do the changes in the scripts to:
|
|||
* Option to set the window in full screen
|
||||
* Fix some exceptions of the demos
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
|
||||
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||
---
|
||||
dms/main.py | 79 +++++++++++++++++++++++++++------------
|
||||
face_recognition/main.py | 44 ++++++++++++++++++----
|
||||
face_recognition/main.py | 43 +++++++++++++++++----
|
||||
gesture_detection/main.py | 32 ++++++++++++++--
|
||||
object_detection/main.py | 40 ++++++++++++++++----
|
||||
4 files changed, 153 insertions(+), 42 deletions(-)
|
||||
4 files changed, 152 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/dms/main.py b/dms/main.py
|
||||
index 6e04dc3..8ba99b2 100644
|
||||
index 902ea1819620..e74b6be1b938 100644
|
||||
--- a/dms/main.py
|
||||
+++ b/dms/main.py
|
||||
@@ -14,10 +14,16 @@ from eye_landmark import EyeMesher
|
||||
|
|
@ -27,7 +29,7 @@ index 6e04dc3..8ba99b2 100644
|
|||
|
||||
-MODEL_PATH = pathlib.Path("../models/")
|
||||
-DETECT_MODEL = "face_detection_front_128_full_integer_quant.tflite"
|
||||
-LANDMARK_MODEL = "face_landmark_192_integer_quant.tflite"
|
||||
-LANDMARK_MODEL = "face_landmark_192_full_integer_quant.tflite"
|
||||
-EYE_MODEL = "iris_landmark_quant.tflite"
|
||||
+WIDTH=640
|
||||
+HEIGH=480
|
||||
|
|
@ -37,7 +39,7 @@ index 6e04dc3..8ba99b2 100644
|
|||
+# Always enforce the Ethos NPU, use the converted vela models
|
||||
+MODEL_PATH = pathlib.Path("../vela_models/")
|
||||
+DETECT_MODEL = "face_detection_front_128_full_integer_quant_vela.tflite"
|
||||
+LANDMARK_MODEL = "face_landmark_192_integer_quant_vela.tflite"
|
||||
+LANDMARK_MODEL = "face_landmark_192_full_integer_quant_vela.tflite"
|
||||
+EYE_MODEL = "iris_landmark_quant_vela.tflite"
|
||||
|
||||
# turn on camera
|
||||
|
|
@ -146,7 +148,7 @@ index 6e04dc3..8ba99b2 100644
|
|||
time.sleep(2)
|
||||
cap.release()
|
||||
diff --git a/face_recognition/main.py b/face_recognition/main.py
|
||||
index acc838e..33ffa71 100644
|
||||
index e917c0aae8c3..c3eed09aad31 100644
|
||||
--- a/face_recognition/main.py
|
||||
+++ b/face_recognition/main.py
|
||||
@@ -13,6 +13,11 @@ from face_detection import YoloFace
|
||||
|
|
@ -188,7 +190,7 @@ index acc838e..33ffa71 100644
|
|||
key = cv2.waitKey(20) & 0xFF
|
||||
if key == 13 or key == 141:
|
||||
break
|
||||
@@ -68,13 +75,28 @@ if args.input.isdigit():
|
||||
@@ -68,17 +75,31 @@ if args.input.isdigit():
|
||||
cap_input = int(args.input)
|
||||
else:
|
||||
cap_input = args.input
|
||||
|
|
@ -197,13 +199,16 @@ index acc838e..33ffa71 100644
|
|||
+# vid = cv2.VideoCapture("v4l2src device=%s ! imxvideoconvert_pxp ! video/x-raw,format=RGB16,width=%d,height=%d " \
|
||||
+# "! videoconvert ! appsink" % (args.input, WIDTH, HEIGH))
|
||||
vid = cv2.VideoCapture(cap_input)
|
||||
if (not vid.isOpened()):
|
||||
print("Can't read frame from source file ", args.input)
|
||||
exit(1)
|
||||
+vid.set(cv2.CAP_PROP_FRAME_WIDTH, WIDTH)
|
||||
+vid.set(cv2.CAP_PROP_FRAME_HEIGHT, HEIGH)
|
||||
+
|
||||
+if FORMAT == 0:
|
||||
+ fourcc = cv2.VideoWriter_fourcc(*'MJPG')
|
||||
+ vid.set(cv2.CAP_PROP_FOURCC, fourcc)
|
||||
+
|
||||
|
||||
PADDING = 10
|
||||
tips = "Press 'a' to add person, 'd' to delete person, 'p' to print database"
|
||||
+
|
||||
|
|
@ -217,7 +222,7 @@ index acc838e..33ffa71 100644
|
|||
if (ret == False):
|
||||
break
|
||||
boxes = detector.detect(img)
|
||||
@@ -97,12 +119,20 @@ while True:
|
||||
@@ -101,12 +122,20 @@ while True:
|
||||
|
||||
cv2.putText(img, tips, (30, 30),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3)
|
||||
|
|
@ -240,7 +245,7 @@ index acc838e..33ffa71 100644
|
|||
elif (key == ord('d')):
|
||||
msg = "DEL. Please input name:"
|
||||
name = get_inputs(img, msg)
|
||||
@@ -110,7 +140,7 @@ while True:
|
||||
@@ -114,7 +143,7 @@ while True:
|
||||
elif (key == ord('p')):
|
||||
names = ",".join(database.get_names())
|
||||
print_longtext(img, names + " Press any key to continue.")
|
||||
|
|
@ -250,7 +255,7 @@ index acc838e..33ffa71 100644
|
|||
pass
|
||||
|
||||
diff --git a/gesture_detection/main.py b/gesture_detection/main.py
|
||||
index da83ce0..15b8597 100644
|
||||
index ea99a021236a..52f23b9600f4 100644
|
||||
--- a/gesture_detection/main.py
|
||||
+++ b/gesture_detection/main.py
|
||||
@@ -9,8 +9,9 @@ import time
|
||||
|
|
@ -319,7 +324,7 @@ index da83ce0..15b8597 100644
|
|||
ret, frame = capture.read()
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
diff --git a/object_detection/main.py b/object_detection/main.py
|
||||
index 1356111..efa614e 100644
|
||||
index 1356111046fd..efa614ebd44b 100644
|
||||
--- a/object_detection/main.py
|
||||
+++ b/object_detection/main.py
|
||||
@@ -13,7 +13,13 @@ import argparse
|
||||
|
|
@ -5,6 +5,8 @@ Subject: [PATCH] improvements: capture "x" windows and increase resolution
|
|||
When running in window mode (no fullscreen), stop the application.
|
||||
Increase the camera resolution to 1280x720.
|
||||
|
||||
Upstream-Status: Inappropriate [DEY specific]
|
||||
|
||||
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
|
||||
---
|
||||
dms/main.py | 13 +++++++++----
|
||||
|
|
@ -20,7 +22,7 @@ index e74b6be1b938..99b501ca2194 100644
|
|||
@@ -14,10 +14,10 @@ from eye_landmark import EyeMesher
|
||||
from face_landmark import FaceMesher
|
||||
from utils import *
|
||||
|
||||
|
||||
-WIDTH=640
|
||||
-HEIGH=480
|
||||
-FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
|
|
@ -29,7 +31,7 @@ index e74b6be1b938..99b501ca2194 100644
|
|||
+HEIGH=720
|
||||
+FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
+FORMAT=None # None, skip (YUYV, default), 0 MJPG (for usb camera)
|
||||
|
||||
|
||||
# Always enforce the Ethos NPU, use the converted vela models
|
||||
MODEL_PATH = pathlib.Path("../vela_models/")
|
||||
@@ -197,6 +197,11 @@ while ret:
|
||||
|
|
@ -45,13 +47,13 @@ index e74b6be1b938..99b501ca2194 100644
|
|||
except Exception as err:
|
||||
# Ignore exceptions
|
||||
diff --git a/face_recognition/main.py b/face_recognition/main.py
|
||||
index 33ffa7161fac..40ca9f8afb91 100644
|
||||
index c3eed09aad31..907643501bfa 100644
|
||||
--- a/face_recognition/main.py
|
||||
+++ b/face_recognition/main.py
|
||||
@@ -13,10 +13,10 @@ from face_detection import YoloFace
|
||||
from face_recognition import Facenet
|
||||
from face_database import FaceDatabase
|
||||
|
||||
|
||||
-WIDTH=640
|
||||
-HEIGH=480
|
||||
-FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
|
|
@ -60,13 +62,13 @@ index 33ffa7161fac..40ca9f8afb91 100644
|
|||
+HEIGH=720
|
||||
+FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
+FORMAT=None # None, skip (YUYV, default), 0 MJPG (for usb camera)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
@@ -144,6 +144,10 @@ while True:
|
||||
@@ -147,6 +147,10 @@ while True:
|
||||
while cv2.waitKey(100) & 0xFF == 0xFF:
|
||||
pass
|
||||
|
||||
|
||||
+ if cv2.getWindowProperty(window_name, cv2.WND_PROP_AUTOSIZE):
|
||||
+ # Window closed by click 'X'
|
||||
+ break
|
||||
|
|
@ -75,13 +77,13 @@ index 33ffa7161fac..40ca9f8afb91 100644
|
|||
vid.release()
|
||||
cv2.destroyAllWindows()
|
||||
diff --git a/gesture_detection/main.py b/gesture_detection/main.py
|
||||
index 15b85976fd72..8ad2c9bd409b 100644
|
||||
index 52f23b9600f4..9a31e32f7d7a 100644
|
||||
--- a/gesture_detection/main.py
|
||||
+++ b/gesture_detection/main.py
|
||||
@@ -63,10 +63,10 @@ if args.input.isdigit():
|
||||
else:
|
||||
cap_input = args.input
|
||||
|
||||
|
||||
-WIDTH=640
|
||||
-HEIGH=480
|
||||
-FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
|
|
@ -90,11 +92,11 @@ index 15b85976fd72..8ad2c9bd409b 100644
|
|||
+HEIGH=720
|
||||
+FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
+FORMAT=None # None, skip (YUYV, default), 0 MJPG (for usb camera)
|
||||
|
||||
|
||||
# This pipeline for the OV5640 camera in case the other command fails
|
||||
# capture = cv2.VideoCapture("v4l2src device=%s ! imxvideoconvert_pxp ! video/x-raw,format=RGB16,width=%d,height=%d " \
|
||||
@@ -100,6 +100,11 @@ while ret:
|
||||
|
||||
|
||||
ret, frame = capture.read()
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
+ # "q" key pressed
|
||||
|
|
@ -103,16 +105,16 @@ index 15b85976fd72..8ad2c9bd409b 100644
|
|||
+ if cv2.getWindowProperty(window_name, cv2.WND_PROP_AUTOSIZE):
|
||||
+ # Window closed by click 'X'
|
||||
break
|
||||
|
||||
|
||||
cv2.waitKey(2000)
|
||||
diff --git a/object_detection/main.py b/object_detection/main.py
|
||||
index efa614ebd44b..34ba17eddffb 100644
|
||||
--- a/object_detection/main.py
|
||||
+++ b/object_detection/main.py
|
||||
@@ -13,10 +13,10 @@ import argparse
|
||||
|
||||
|
||||
from labels import label2string
|
||||
|
||||
|
||||
-WIDTH=640
|
||||
-HEIGH=480
|
||||
-FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
|
|
@ -121,7 +123,7 @@ index efa614ebd44b..34ba17eddffb 100644
|
|||
+HEIGH=720
|
||||
+FLIP=None # None, skip, 0: Flip vertically, 1: Flip horizontally (around the y-axis), -1: Flip both vertically and horizontally
|
||||
+FORMAT=None # None, skip (YUYV, default), 0 MJPG (for usb camera)
|
||||
|
||||
|
||||
# Always enforce the Ethos NPU, use the converted vela models
|
||||
MODEL_PATH = "../vela_models/ssd_mobilenet_v1_quant_vela.tflite"
|
||||
@@ -122,6 +122,11 @@ while ret:
|
||||
|
|
@ -134,5 +136,5 @@ index efa614ebd44b..34ba17eddffb 100644
|
|||
+ if cv2.getWindowProperty(window_name, cv2.WND_PROP_AUTOSIZE):
|
||||
+ # Window closed by click 'X'
|
||||
break
|
||||
|
||||
|
||||
cv2.waitKey(2000)
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
# Copyright (C) 2024, Digi International Inc.
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
|
||||
|
||||
# Directory for models.
|
||||
MODELS_DIR = "models"
|
||||
|
||||
|
|
@ -7,10 +9,8 @@ MODELS_DIR = "models"
|
|||
VELA_MODELS_DIR = "vela_models"
|
||||
|
||||
SRC_URI += " \
|
||||
file://patches/0001-Customize-EiQ-demos.patch \
|
||||
file://patches/0002-dms-update-the-demo-to-use-the-landmark-full-model.patch \
|
||||
file://patches/0003-download_models-update-the-download-location-of-some.patch \
|
||||
file://patches/0004-improvements-capture-x-windows-and-increase-resoluti.patch \
|
||||
file://0001-Customize-EiQ-demos.patch \
|
||||
file://0002-improvements-capture-x-windows-and-increase-resoluti.patch \
|
||||
file://scripts/launch_eiq_demo.sh \
|
||||
file://service/eiqdemo.service \
|
||||
"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# Copyright 2024 Digi International Inc.
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:ccimx93 = " file://ethosu_firmware"
|
||||
|
||||
do_install:ccimx93 () {
|
||||
install -d ${D}${nonarch_base_libdir}/firmware
|
||||
install -m 0644 ${WORKDIR}/ethosu_firmware ${D}${nonarch_base_libdir}/firmware/ethosu_firmware
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright 2024 Digi International Inc.
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
|
||||
|
||||
SRC_URI:append:ccimx93 = " file://ethosu_firmware"
|
||||
|
||||
UNPACK_POSTFUNC = ""
|
||||
UNPACK_POSTFUNC:ccimx93 = "copy_ethos_u_fw"
|
||||
copy_ethos_u_fw() {
|
||||
cp -f ${WORKDIR}/ethosu_firmware ${S}
|
||||
}
|
||||
do_unpack[postfuncs] += "${UNPACK_POSTFUNC}"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# Copyright (C) 2024, Digi International Inc.
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From: David Escalona <david.escalona@digi.com>
|
||||
Date: Thu, 5 Sep 2024 11:04:19 +0200
|
||||
Subject: [PATCH] dms: update the demo to use the landmark full model
|
||||
|
||||
Signed-off-by: David Escalona <david.escalona@digi.com>
|
||||
---
|
||||
dms/main.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dms/main.py b/dms/main.py
|
||||
index 8ba99b2..e74b6be 100644
|
||||
--- a/dms/main.py
|
||||
+++ b/dms/main.py
|
||||
@@ -22,7 +22,7 @@ FORMAT=0 # None, skip (YUYV, default), 0 MJPG (for usb camera)
|
||||
# Always enforce the Ethos NPU, use the converted vela models
|
||||
MODEL_PATH = pathlib.Path("../vela_models/")
|
||||
DETECT_MODEL = "face_detection_front_128_full_integer_quant_vela.tflite"
|
||||
-LANDMARK_MODEL = "face_landmark_192_integer_quant_vela.tflite"
|
||||
+LANDMARK_MODEL = "face_landmark_192_full_integer_quant_vela.tflite"
|
||||
EYE_MODEL = "iris_landmark_quant_vela.tflite"
|
||||
|
||||
# turn on camera
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
From: David Escalona <david.escalona@digi.com>
|
||||
Date: Wed, 11 Sep 2024 17:25:05 +0200
|
||||
Subject: [PATCH] download_models: update the download location of some models
|
||||
|
||||
Signed-off-by: David Escalona <david.escalona@digi.com>
|
||||
---
|
||||
download_models.py | 43 ++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 26 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/download_models.py b/download_models.py
|
||||
index 3111f29..462f7b7 100644
|
||||
--- a/download_models.py
|
||||
+++ b/download_models.py
|
||||
@@ -35,21 +35,33 @@ def download_all_models(model_dir, vela_dir):
|
||||
os.makedirs(model_dir, exist_ok=True)
|
||||
os.makedirs(vela_dir, exist_ok=True)
|
||||
|
||||
+ github_url = 'https://raw.githubusercontent.com/'
|
||||
+
|
||||
#Download gesture models
|
||||
#https://github.com/PINTO0309/PINTO_model_zoo
|
||||
- url = 'https://drive.google.com/uc?export=download&&id=1yjWyXsac5CbGWYuHWYhhnr_9cAwg3uNI'
|
||||
- path = os.path.join(model_dir, 'gesture_models.tar.gz')
|
||||
- download_file('gesture recognition', url, path)
|
||||
- decompress(path, model_dir)
|
||||
+ #url = 'https://drive.google.com/uc?export=download&&id=1yjWyXsac5CbGWYuHWYhhnr_9cAwg3uNI'
|
||||
+ #path = os.path.join(model_dir, 'gesture_models.tar.gz')
|
||||
+ #download_file('gesture recognition', url, path)
|
||||
+ #decompress(path, model_dir)
|
||||
+
|
||||
+ #Download gesture models
|
||||
+ #https://github.com/terryky/tflite_gles_app
|
||||
+ url = github_url + 'terryky/tflite_gles_app/master/gl2handpose/handpose_model/'
|
||||
+ file_name = 'palm_detection_builtin_256_integer_quant.tflite'
|
||||
+ path = os.path.join(model_dir, file_name)
|
||||
+ download_file('hand landmark', url + file_name, path)
|
||||
+ file_name = 'hand_landmark_3d_256_integer_quant.tflite'
|
||||
+ path = os.path.join(model_dir, file_name)
|
||||
+ download_file('hand detection', url + file_name, path)
|
||||
|
||||
#Download face recognition models
|
||||
#https://github.com/imuncle/yoloface-50k
|
||||
- url = 'https://raw.githubusercontent.com/imuncle/yoloface-50k/main/tflite/yoloface_int8.tflite'
|
||||
+ url = github_url + 'imuncle/yoloface-50k/main/tflite/yoloface_int8.tflite'
|
||||
path = os.path.join(model_dir, 'yoloface_int8.tflite')
|
||||
download_file('face detection', url, path)
|
||||
|
||||
#https://github.com/shubham0204/FaceRecognition_With_FaceNet_Android
|
||||
- url = 'https://raw.githubusercontent.com/shubham0204/FaceRecognition_With_FaceNet_Android/master/app/src/main/assets/facenet_512_int_quantized.tflite'
|
||||
+ url = github_url + 'shubham0204/FaceRecognition_With_FaceNet_Android/master/app/src/main/assets/facenet_512_int_quantized.tflite'
|
||||
path = os.path.join(model_dir, 'facenet_512_int_quantized.tflite')
|
||||
download_file('face recognition', url, path)
|
||||
|
||||
@@ -67,17 +79,14 @@ def download_all_models(model_dir, vela_dir):
|
||||
decompress(path, model_dir)
|
||||
|
||||
#Download dms models
|
||||
- #https://github.com/PINTO0309/PINTO_model_zoo
|
||||
- url = "https://drive.google.com/uc?export=download&id=1YEAgUuHyJ7_fTY9XyDaALDidM6Sbzhd8"
|
||||
- path = os.path.join(model_dir, 'dms_face_detection.tar.gz')
|
||||
- download_file('DMS face detection', url, path)
|
||||
- decompress(path, model_dir)
|
||||
-
|
||||
- #https://github.com/PINTO0309/PINTO_model_zoo
|
||||
- url = "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/043_face_landmark/resources.tar.gz"
|
||||
- path = os.path.join(model_dir, 'dms_face_landmark.tar.gz')
|
||||
- download_file('DMS face landmark', url, path)
|
||||
- decompress(path, model_dir)
|
||||
+ #https://github.com/terryky/tflite_gles_app
|
||||
+ url = github_url + 'terryky/tflite_gles_app/master/gl2facemesh/facemesh_model/'
|
||||
+ file_name = 'face_detection_front_128_full_integer_quant.tflite'
|
||||
+ path = os.path.join(model_dir, file_name)
|
||||
+ download_file('DMS face detection', url + file_name, path)
|
||||
+ file_name = 'face_landmark_192_full_integer_quant.tflite'
|
||||
+ path = os.path.join(model_dir, file_name)
|
||||
+ download_file('DMS face landmark', url + file_name, path)
|
||||
|
||||
#https://github.com/PINTO0309/PINTO_model_zoo
|
||||
url = "https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/049_iris_landmark/resources.tar.gz"
|
||||
Loading…
Reference in New Issue