From 1dd83ed1658dfea89b7b1e2eeb5c293bfd808269 Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Tue, 22 Apr 2025 16:00:41 +0200 Subject: [PATCH] x-linux-ai: update support for new X-LINUX-AI v6.0.1 release This commit introduces the necessary changes in the Digi Embedded Yocto layer to support the X-LINUX-AI v6.0.1 software package from the meta-st-x-linux-ai layer. The update removes support that is now provided directly by the ST layer in this new version and adapts existing recipes to align with the updated mechanisms for AI application integration. These changes ensure compatibility with platforms that feature hardware acceleration (NPU), as well as those that rely solely on CPU-based inference. Signed-off-by: Arturo Buzarra --- meta-digi-arm/conf/layer.conf | 5 +- ...6.0.0.bbappend => stai-mpu_6.0.1.bbappend} | 0 ...tion-remove-weston-user-check-from-l.patch | 18 +++-- ...-remove-weston-user-check-from-launc.patch | 18 +++-- ...remove-weston-user-check-from-launch.patch | 20 +++--- .../resources/application-resources.bbappend | 7 +- ...-add-support-to-STM32MP255-processor.patch | 62 ---------------- ...-support-for-web-camera-with-STM32MP.patch | 70 +++++++++++++++++++ ...-support-for-web-camera-with-STM32MP.patch | 68 ------------------ ...main_isp-fix-support-for-web-camera.patch} | 0 ..._isp-fix-support-for-CSI-DCMIPP-cam.patch} | 0 ...ation-remove-weston-user-check-from-.patch | 16 +++-- .../packagegroup-dey-x-linux-ai.bb | 30 ++++---- 13 files changed, 135 insertions(+), 179 deletions(-) rename meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/stai-mpu/{stai-mpu_6.0.0.bbappend => stai-mpu_6.0.1.bbappend} (100%) delete mode 100644 meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-add-support-to-STM32MP255-processor.patch create mode 100644 meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-fix-support-for-web-camera-with-STM32MP.patch delete mode 100644 meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch rename meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/{0003-setup_camera_main_isp-fix-support-for-web-camera.patch => 0002-setup_camera_main_isp-fix-support-for-web-camera.patch} (100%) rename meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/{0004-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch => 0003-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch} (100%) diff --git a/meta-digi-arm/conf/layer.conf b/meta-digi-arm/conf/layer.conf index 49a615cc7..d0991aeb1 100644 --- a/meta-digi-arm/conf/layer.conf +++ b/meta-digi-arm/conf/layer.conf @@ -53,8 +53,9 @@ BBMASK += " \ # Tweak x-linux-ai dependencies to use ST's machine learning packages LAYERDEPENDS_x-linux-ai:remove = "st-openstlinux" BBMASK += " \ - meta-st-x-linux-ai/recipes-st/images/st-image-ai-userfs.bb \ - meta-st-x-linux-ai/recipes-st/images/st-image-ai.bb \ + meta-st-x-linux-ai/recipes-st/images/st-image-ai-npu-userfs.bb \ + meta-st-x-linux-ai/recipes-st/images/st-image-ai-npu.bb \ + meta-st-x-linux-ai/recipes-st/images/st-image-ai-cpu.bb \ " # Digi's General and Open Source license agreements diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/stai-mpu/stai-mpu_6.0.0.bbappend b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/stai-mpu/stai-mpu_6.0.1.bbappend similarity index 100% rename from meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/stai-mpu/stai-mpu_6.0.0.bbappend rename to meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/stai-mpu/stai-mpu_6.0.1.bbappend diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch index 883b27d94..07953017a 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch @@ -10,17 +10,20 @@ Signed-off-by: David Escalona 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stai-mpu/launch_python_image_classification.sh b/stai-mpu/launch_python_image_classification.sh -index ac5efb5..ab0ed4b 100755 +index 3cb5259..afbedf8 100755 --- a/stai-mpu/launch_python_image_classification.sh +++ b/stai-mpu/launch_python_image_classification.sh -@@ -7,15 +7,9 @@ +@@ -5,18 +5,12 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + CONFIG=$(find /usr/local/x-linux-ai -name "config_board_*.sh") + source $CONFIG cmd="python3 /usr/local/x-linux-ai/image-classification/stai_mpu_image_classification.py -m /usr/local/x-linux-ai/image-classification/models/$IMAGE_CLASSIFICATION_MODEL -l /usr/local/x-linux-ai/image-classification/models/$IMAGE_CLASSIFICATION_LABEL.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $OPTIONS" -if [ "$weston_user" != "root" ]; then @@ -31,17 +34,20 @@ index ac5efb5..ab0ed4b 100755 -fi +$cmd diff --git a/stai-mpu/launch_python_image_classification_testdata.sh b/stai-mpu/launch_python_image_classification_testdata.sh -index 31ac124..a35f615 100755 +index 25388cd..9d68e90 100755 --- a/stai-mpu/launch_python_image_classification_testdata.sh +++ b/stai-mpu/launch_python_image_classification_testdata.sh -@@ -7,15 +7,9 @@ +@@ -5,18 +5,12 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + CONFIG=$(find /usr/local/x-linux-ai -name "config_board_*.sh") + source $CONFIG cmd="python3 /usr/local/x-linux-ai/image-classification/stai_mpu_image_classification.py -m /usr/local/x-linux-ai/image-classification/models/$IMAGE_CLASSIFICATION_MODEL -l /usr/local/x-linux-ai/image-classification/models/$IMAGE_CLASSIFICATION_LABEL.txt -i /usr/local/x-linux-ai/image-classification/models/$IMAGE_CLASSIF_DATA" -if [ "$weston_user" != "root" ]; then diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch index d29b3d9e1..aa3a07f8f 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch @@ -9,17 +9,20 @@ Signed-off-by: David Escalona 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stai-mpu/launch_python_object_detection.sh b/stai-mpu/launch_python_object_detection.sh -index d0332dc..54f5e54 100755 +index e460fb3..b595f7f 100755 --- a/stai-mpu/launch_python_object_detection.sh +++ b/stai-mpu/launch_python_object_detection.sh -@@ -7,15 +7,9 @@ +@@ -5,18 +5,12 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai_mpu wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + CONFIG=$(find /usr/local/x-linux-ai -name "config_board_*.sh") + source $CONFIG cmd="/usr/local/x-linux-ai/object-detection/stai_mpu_object_detection.py -m /usr/local/x-linux-ai/object-detection/models/$OBJ_DETEC_MODEL -l /usr/local/x-linux-ai/object-detection/models/$OBJ_DETEC_MODEL_LABEL.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $OPTIONS" -if [ "$weston_user" != "root" ]; then @@ -30,17 +33,20 @@ index d0332dc..54f5e54 100755 -fi +$cmd diff --git a/stai-mpu/launch_python_object_detection_testdata.sh b/stai-mpu/launch_python_object_detection_testdata.sh -index c8e4d5b..bd9a9b9 100755 +index 7c5a6e5..ca547a4 100755 --- a/stai-mpu/launch_python_object_detection_testdata.sh +++ b/stai-mpu/launch_python_object_detection_testdata.sh -@@ -7,15 +7,9 @@ +@@ -5,18 +5,12 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai_mpu wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + CONFIG=$(find /usr/local/x-linux-ai -name "config_board_*.sh") + source $CONFIG cmd="/usr/local/x-linux-ai/object-detection/stai_mpu_object_detection.py -m /usr/local/x-linux-ai/object-detection/models/$OBJ_DETEC_MODEL -l /usr/local/x-linux-ai/object-detection/models/$OBJ_DETEC_MODEL_LABEL.txt -i /usr/local/x-linux-ai/object-detection/models/$OBJ_DETECT_DATA" -if [ "$weston_user" != "root" ]; then diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch index 22b00d4fa..27b56f469 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch @@ -4,12 +4,12 @@ Subject: [PATCH 1/3] pose-estimation: remove weston user check from launch Signed-off-by: David Escalona --- - stai-mpu/launch_python_pose_estimation.sh | 8 +------- - stai-mpu/launch_python_pose_estimation_testdata.sh | 8 +------- + .../files/stai-mpu/launch_python_pose_estimation.sh | 8 +------- + .../stai-mpu/launch_python_pose_estimation_testdata.sh | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stai-mpu/launch_python_pose_estimation.sh b/stai-mpu/launch_python_pose_estimation.sh -index a317b58..7c41246 100644 +index 61952cf..6c8b5b8 100644 --- a/stai-mpu/launch_python_pose_estimation.sh +++ b/stai-mpu/launch_python_pose_estimation.sh @@ -5,17 +5,11 @@ @@ -17,13 +17,13 @@ index a317b58..7c41246 100644 # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. - + -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + source /usr/local/x-linux-ai/resources/config_board_npu.sh cmd="python3 /usr/local/x-linux-ai/pose-estimation/stai_mpu_pose_estimation.py -m /usr/local/x-linux-ai/pose-estimation/models/$POSE_ESTIMATION_MODEL --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $OPTIONS" - + -if [ "$weston_user" != "root" ]; then - echo "user : "$weston_user - script -qc "su -l $weston_user -c '$cmd'" @@ -33,7 +33,7 @@ index a317b58..7c41246 100644 \ No newline at end of file +$cmd diff --git a/stai-mpu/launch_python_pose_estimation_testdata.sh b/stai-mpu/launch_python_pose_estimation_testdata.sh -index 9992666..cc2f0b6 100644 +index 6ba035b..9a4448e 100644 --- a/stai-mpu/launch_python_pose_estimation_testdata.sh +++ b/stai-mpu/launch_python_pose_estimation_testdata.sh @@ -5,17 +5,11 @@ @@ -41,13 +41,13 @@ index 9992666..cc2f0b6 100644 # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. - + -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + source /usr/local/x-linux-ai/resources/config_board_npu.sh cmd="python3 /usr/local/x-linux-ai/pose-estimation/stai_mpu_pose_estimation.py -m /usr/local/x-linux-ai/pose-estimation/models/$POSE_ESTIMATION_MODEL -i /usr/local/x-linux-ai/pose-estimation/models/$POSE_ESTIMATION_DATA" - + -if [ "$weston_user" != "root" ]; then - echo "user : "$weston_user - script -qc "su -l $weston_user -c '$cmd'" diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/application-resources.bbappend b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/application-resources.bbappend index 4db3150ba..bdc044640 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/application-resources.bbappend +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/application-resources.bbappend @@ -3,8 +3,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI += " \ - file://patches/0001-config_board-add-support-to-STM32MP255-processor.patch \ - file://patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch \ - file://patches/0003-setup_camera_main_isp-fix-support-for-web-camera.patch \ - file://patches/0004-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch \ + file://patches/0001-config_board-fix-support-for-web-camera-with-STM32MP.patch \ + file://patches/0002-setup_camera_main_isp-fix-support-for-web-camera.patch \ + file://patches/0003-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch \ " diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-add-support-to-STM32MP255-processor.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-add-support-to-STM32MP255-processor.patch deleted file mode 100644 index 90b0e5724..000000000 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-add-support-to-STM32MP255-processor.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Arturo Buzarra -Date: Wed, 11 Dec 2024 17:20:22 +0100 -Subject: [PATCH] config_board: add support to STM32MP255 processor - -Signed-off-by: Arturo Buzarra ---- - .../files/resources-files/config_board.sh | 32 +++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/resources-files/config_board.sh b/resources-files/config_board.sh -index a9ce24b..a37981a 100644 ---- a/resources-files/config_board.sh -+++ b/resources-files/config_board.sh -@@ -13,6 +13,7 @@ STM32MP2="stm32mp2" - STM32MP135="stm32mp135" - STM32MP157="stm32mp157" - STM32MP157FEV1="stm32mp157f-ev1st" -+STM32MP255="stm32mp255" - STM32MP257="stm32mp257" - STM32MP257FEV1="stm32mp257f-ev1st" - -@@ -79,6 +80,37 @@ if [[ "$COMPATIBLE" == *"$STM32MP157"* ]]; then - fi - fi - -+if [[ "$COMPATIBLE" == *"$STM32MP255"* ]]; then -+ SEMANTIC_SEGMENTATION_MODEL="deeplabv3/deeplabv3_257_int8_per_tensor$NN_EXT" -+ SEMANTIC_SEGMENTATION_LABEL="deeplabv3/labels_pascalvoc" -+ SEMANTIC_SEGMENTATION_DATA="deeplabv3/testdata/" -+ POSE_ESTIMATION_DATA="yolov8n_pose/testdata/" -+ POSE_ESTIMATION_MODEL="yolov8n_pose/yolov8n_256_quant_pt_uf_pose_coco-st$NN_EXT" -+ FACE_DETECTION_MODEL="blazeface/blazeface_128x128_quant$NN_EXT" -+ FACE_DETECTION_DATA="blazeface/testdata/" -+ FACE_RECO_MODEL="facenet/facenet512_160x160_quant$NN_EXT" -+ FACE_RECO_DATA="facenet/testdata/" -+ FACE_DATABASE="database/" -+ # STM32MP255 settings -+ MACHINE=$STM32MP255 -+ DWIDTH=640 -+ DHEIGHT=480 -+ DFPS=30 -+ COMPUTE_ENGINE="--npu" -+ IMAGE_CLASSIFICATION_MODEL="mobilenet/mobilenet_v2_1.0_224_int8_per_tensor$NN_EXT" -+ IMAGE_CLASSIFICATION_LABEL="mobilenet/labels_imagenet_2012" -+ IMAGE_CLASSIF_DATA="mobilenet/testdata/" -+ if [[ "$NN_EXT" == ".nb" ]]; then -+ OBJ_DETEC_MODEL="coco_ssd_mobilenet/ssd_mobilenet_v2_fpnlite_10_256_int8_per_tensor$NN_EXT" -+ OBJ_DETEC_MODEL_LABEL="coco_ssd_mobilenet/labels_coco_dataset_80" -+ else -+ OBJ_DETEC_MODEL="coco_ssd_mobilenet/ssd_mobilenet_v2_fpnlite_10_256_int8$NN_EXT" -+ OBJ_DETEC_MODEL_LABEL="coco_ssd_mobilenet/labels_coco_dataset_80" -+ fi -+ OBJ_DETECT_DATA="coco_ssd_mobilenet/testdata/" -+ OPTIONS="--dual_camera_pipeline" -+fi -+ - if [[ "$COMPATIBLE" == *"$STM32MP257"* ]]; then - SEMANTIC_SEGMENTATION_MODEL="deeplabv3/deeplabv3_257_int8_per_tensor$NN_EXT" - SEMANTIC_SEGMENTATION_LABEL="deeplabv3/labels_pascalvoc" --- -2.47.1 - diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-fix-support-for-web-camera-with-STM32MP.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-fix-support-for-web-camera-with-STM32MP.patch new file mode 100644 index 000000000..8dea1d258 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0001-config_board-fix-support-for-web-camera-with-STM32MP.patch @@ -0,0 +1,70 @@ +From: Arturo Buzarra +Date: Tue, 22 Apr 2025 14:01:12 +0200 +Subject: [PATCH] config_board: fix support for web camera with STM32MP255 + processor + +This commit disables the dual camera pipeline support for USB cameras, as it is +exclusive to cameras using the DCMIPP peripheral. + +Signed-off-by: Arturo Buzarra +--- + .../files/resources-files/config_board_npu.sh | 29 ++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/resources-files/config_board_npu.sh b/resources-files/config_board_npu.sh +index c89b5ca..38dda50 100644 +--- a/resources-files/config_board_npu.sh ++++ b/resources-files/config_board_npu.sh +@@ -16,10 +16,28 @@ STM32MP251="stm32mp251" + STM32MP235="stm32mp235" + STM32MP233="stm32mp233" + STM32MP231="stm32mp231" + STM32MP2_NPU="stm32mp2x with GPU/NPU" + ++function is_dcmipp_present() { ++ DCMIPP_SENSOR="NOTFOUND" ++ # ov5640 or imx335 camera can be present on csi connector ++ for video in $(find /sys/class/video4linux -name "video*" -type l); ++ do ++ if [ "$(cat $video/name)" = "dcmipp_main_capture" ]; then ++ for sub in $(find /sys/class/video4linux -name "v4l-subdev*" -type l); ++ do ++ subdev_name=$(tr -d '\0' < $sub/name | awk '{print $1}') ++ if [ "$subdev_name" = "ov5640" ] || [ "$subdev_name" = "imx335" ]; then ++ DCMIPP_SENSOR=$subdev_name ++ break; ++ fi ++ done ++ fi ++ done ++} ++ + if [[ "$COMPATIBLE" == *"$STM32MP253"* ]] || [[ "$COMPATIBLE" == *"$STM32MP251"* ]] || [[ "$COMPATIBLE" == *"$STM32MP233"* ]] || [[ "$COMPATIBLE" == *"$STM32MP231"* ]]; then + if [[ "$SOFTWARE" == "AI_NPU" ]]; then + echo "Software X-LINUX-AI installed is not compatible with the board, please install X-LINUX-AI CPU version for plateform without hardware accelerator" + exit 1 + fi +@@ -54,11 +72,20 @@ if [[ "$COMPATIBLE" == *"$STM32MP257"* ]] || [[ "$COMPATIBLE" == *"$STM32MP255"* + MACHINE=$STM32MP2_NPU + DWIDTH=760 + DHEIGHT=568 + DFPS=30 + COMPUTE_ENGINE="--npu" +- OPTIONS="--dual_camera_pipeline" ++ ++ is_dcmipp_present ++ if [ "$DCMIPP_SENSOR" != "NOTFOUND" ]; then ++ # DCMIPP camera ++ OPTIONS="--dual_camera_pipeline" ++ else ++ # Web camera ++ OPTIONS="" ++ fi ++ + IMAGE_CLASSIFICATION_MODEL="mobilenet/mobilenet_v2_1.0_224_int8_per_tensor$NN_EXT" + IMAGE_CLASSIFICATION_LABEL="mobilenet/labels_imagenet_2012" + IMAGE_CLASSIF_DATA="mobilenet/testdata/" + if [[ "$NN_EXT" == ".nb" ]]; then + OBJ_DETEC_MODEL="coco_ssd_mobilenet/ssd_mobilenet_v2_fpnlite_10_256_int8_per_tensor$NN_EXT" +-- +2.34.1 diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch deleted file mode 100644 index f101e2873..000000000 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Arturo Buzarra -Date: Tue, 21 Jan 2025 12:04:52 +0100 -Subject: [PATCH] config_board: fix support for web camera with STM32MP255 - processor - -This commit disables the dual camera pipeline support for USB cameras, as it is -exclusive to cameras using the DCMIPP peripheral. - -Signed-off-by: Arturo Buzarra ---- - .../files/resources-files/config_board.sh | 27 +++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/resources-files/config_board.sh b/resources-files/config_board.sh -index a623086..e7e8b00 100644 ---- a/resources-files/config_board.sh -+++ b/resources-files/config_board.sh -@@ -15,10 +15,28 @@ STM32MP157="stm32mp157" - STM32MP157FEV1="stm32mp157f-ev1st" - STM32MP255="stm32mp255" - STM32MP257="stm32mp257" - STM32MP257FEV1="stm32mp257f-ev1st" - -+function is_dcmipp_present() { -+ DCMIPP_SENSOR="NOTFOUND" -+ # ov5640 or imx335 camera can be present on csi connector -+ for video in $(find /sys/class/video4linux -name "video*" -type l); -+ do -+ if [ "$(cat $video/name)" = "dcmipp_main_capture" ]; then -+ for sub in $(find /sys/class/video4linux -name "v4l-subdev*" -type l); -+ do -+ subdev_name=$(tr -d '\0' < $sub/name | awk '{print $1}') -+ if [ "$subdev_name" = "ov5640" ] || [ "$subdev_name" = "imx335" ]; then -+ DCMIPP_SENSOR=$subdev_name -+ break; -+ fi -+ done -+ fi -+ done -+} -+ - if [[ "$FRAMEWORK" == "nbg" ]]; then - NN_EXT=".nb" - elif [[ "$FRAMEWORK" == "tflite" ]]; then - NN_EXT=".tflite" - elif [[ "$FRAMEWORK" == "onnx" ]]; then -@@ -107,10 +125,19 @@ if [[ "$COMPATIBLE" == *"$STM32MP255"* ]]; then - OBJ_DETEC_MODEL="coco_ssd_mobilenet/ssd_mobilenet_v2_fpnlite_10_256_int8$NN_EXT" - OBJ_DETEC_MODEL_LABEL="coco_ssd_mobilenet/labels_coco_dataset_80" - fi - OBJ_DETECT_DATA="coco_ssd_mobilenet/testdata/" - OPTIONS="--dual_camera_pipeline" -+ -+ is_dcmipp_present -+ if [ "$DCMIPP_SENSOR" != "NOTFOUND" ]; then -+ # DCMIPP camera -+ OPTIONS="--dual_camera_pipeline" -+ else -+ # Web camera -+ OPTIONS="" -+ fi - fi - - if [[ "$COMPATIBLE" == *"$STM32MP257"* ]]; then - SEMANTIC_SEGMENTATION_MODEL="deeplabv3/deeplabv3_257_int8_per_tensor$NN_EXT" - SEMANTIC_SEGMENTATION_LABEL="deeplabv3/labels_pascalvoc" --- -2.34.1 diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0003-setup_camera_main_isp-fix-support-for-web-camera.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-setup_camera_main_isp-fix-support-for-web-camera.patch similarity index 100% rename from meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0003-setup_camera_main_isp-fix-support-for-web-camera.patch rename to meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0002-setup_camera_main_isp-fix-support-for-web-camera.patch diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0004-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0003-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch similarity index 100% rename from meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0004-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch rename to meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/resources/files/patches/0003-setup_camera_main_isp-fix-support-for-CSI-DCMIPP-cam.patch diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch index b94de0be2..8910c2339 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch @@ -10,17 +10,19 @@ Signed-off-by: David Escalona 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/stai-mpu/launch_python_semantic_segmentation.sh b/stai-mpu/launch_python_semantic_segmentation.sh -index e3c3a6c..e008572 100755 +index a1c2479..94cd540 100755 --- a/stai-mpu/launch_python_semantic_segmentation.sh +++ b/stai-mpu/launch_python_semantic_segmentation.sh -@@ -7,15 +7,9 @@ +@@ -5,17 +5,11 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai-mpu wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + source /usr/local/x-linux-ai/resources/config_board_npu.sh cmd="python3 /usr/local/x-linux-ai/semantic-segmentation/stai_mpu_semantic_segmentation.py -m /usr/local/x-linux-ai/semantic-segmentation/models/$SEMANTIC_SEGMENTATION_MODEL -l /usr/local/x-linux-ai/semantic-segmentation/models/$SEMANTIC_SEGMENTATION_LABEL.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $OPTIONS" -if [ "$weston_user" != "root" ]; then @@ -31,17 +33,19 @@ index e3c3a6c..e008572 100755 -fi +$cmd diff --git a/stai-mpu/launch_python_semantic_segmentation_testdata.sh b/stai-mpu/launch_python_semantic_segmentation_testdata.sh -index 2d3db4b..5375e0f 100755 +index bf3ac5e..a02de8f 100755 --- a/stai-mpu/launch_python_semantic_segmentation_testdata.sh +++ b/stai-mpu/launch_python_semantic_segmentation_testdata.sh -@@ -7,15 +7,9 @@ +@@ -5,17 +5,11 @@ + # + # This software is licensed under terms that can be found in the LICENSE file # in the root directory of this software component. # If no LICENSE file comes with this software, it is provided AS-IS. -weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') FRAMEWORK=$1 echo "stai-mpu wrapper used : "$FRAMEWORK - source /usr/local/x-linux-ai/resources/config_board.sh + source /usr/local/x-linux-ai/resources/config_board_npu.sh cmd="python3 /usr/local/x-linux-ai/semantic-segmentation/stai_mpu_semantic_segmentation.py -m /usr/local/x-linux-ai/semantic-segmentation/models/$SEMANTIC_SEGMENTATION_MODEL -l /usr/local/x-linux-ai/semantic-segmentation/models/$SEMANTIC_SEGMENTATION_LABEL.txt -i /usr/local/x-linux-ai/semantic-segmentation/models/$SEMANTIC_SEGMENTATION_DATA" -if [ "$weston_user" != "root" ]; then diff --git a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-st/packagegroups/packagegroup-dey-x-linux-ai.bb b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-st/packagegroups/packagegroup-dey-x-linux-ai.bb index dd096fe12..a7ce9a6d4 100644 --- a/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-st/packagegroups/packagegroup-dey-x-linux-ai.bb +++ b/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-st/packagegroups/packagegroup-dey-x-linux-ai.bb @@ -11,30 +11,30 @@ COMMON_PACKAGES = " \ " TFLITE_PACKAGES = " \ - stai-mpu-image-classification-cpp-tfl \ - stai-mpu-image-classification-python-tfl \ - stai-mpu-object-detection-cpp-tfl \ - stai-mpu-object-detection-python-tfl \ + stai-mpu-image-classification-cpp-tfl-npu \ + stai-mpu-image-classification-python-tfl-npu \ + stai-mpu-object-detection-cpp-tfl-npu \ + stai-mpu-object-detection-python-tfl-npu \ tflite-vx-delegate-example \ " ONNX_PACKAGES = " \ onnxruntime-tools \ - stai-mpu-image-classification-cpp-ort \ - stai-mpu-image-classification-python-ort \ - stai-mpu-object-detection-python-ort \ - stai-mpu-object-detection-cpp-ort \ + stai-mpu-image-classification-cpp-ort-npu \ + stai-mpu-image-classification-python-ort-npu \ + stai-mpu-object-detection-python-ort-npu \ + stai-mpu-object-detection-cpp-ort-npu \ " OPENVX_PACKAGES = " \ nbg-benchmark \ - stai-mpu-image-classification-cpp-ovx \ - stai-mpu-image-classification-python-ovx \ - stai-mpu-object-detection-cpp-ovx \ - stai-mpu-object-detection-python-ovx \ - stai-mpu-semantic-segmentation-python-ovx \ - stai-mpu-pose-estimation-python-ovx \ - stai-mpu-face-recognition-cpp-ovx \ + stai-mpu-image-classification-cpp-ovx-npu \ + stai-mpu-image-classification-python-ovx-npu \ + stai-mpu-object-detection-cpp-ovx-npu \ + stai-mpu-object-detection-python-ovx-npu \ + stai-mpu-semantic-segmentation-python-ovx-npu \ + stai-mpu-pose-estimation-python-ovx-npu \ + stai-mpu-face-recognition-cpp-ovx-npu \ " RDEPENDS:${PN} += " \