diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/common/scripts/launch_npu_demo.sh b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/common/scripts/launch_npu_demo.sh new file mode 100644 index 000000000..1e6c6257a --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/common/scripts/launch_npu_demo.sh @@ -0,0 +1,72 @@ +#!/bin/sh +#=============================================================================== +# +# Copyright (C) 2024 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: Launch script for ST NPU demos +# +#=============================================================================== + +# Default demo to launch. +DEFAULT_DEMO="pose_estimation" + +# Prepare MIPI camera. +media-ctl -d /dev/media2 --set-v4l2 "'ov5640 0-003c':0[fmt:SBGGR8_1X8/1280x720]" +media-ctl -d /dev/media2 --set-v4l2 "'stm32_csi2host.48020000.csi2hos':1[fmt:SBGGR8_1X8/1280x720]" +media-ctl -d /dev/media2 --set-v4l2 "'dcmipp_main_isp':1[fmt:RGB888_1X24/1280x720 field:none]" +media-ctl -d /dev/media2 --set-v4l2 "'dcmipp_main_postproc':0[compose:(0,0)/640x480]" +media-ctl -d /dev/media2 --set-v4l2 "'dcmipp_main_postproc':1[fmt:RGB565_2X8_LE/640x480]" + +# Mirror the image. +v4l2-ctl -d /dev/v4l-subdev6 --set-ctrl "horizontal_flip=1" +#v4l2-ctl -d /dev/v4l-subdev6 --set-ctrl "vertical_flip=1" + +# Configure Wayland/Weston settings. +export "DISPLAY=:0.0" +export "XDG_RUNTIME_DIR=/run/user/0" +export "WAYLAND_DISPLAY=wayland-1" + +# Wait until Wayland framework is ready. +wait_for_wayland() { + local count=20 + local wayland_socket="/run/user/0/${WAYLAND_DISPLAY}" + + while [ ! -S "${wayland_socket}" ]; do + sleep 1 + count=$((count-1)) + if [ "${count}" = 0 ]; then + return 1 + fi + done + return 0 +} +[ -d "/usr/share/wayland" ] && wait_for_wayland + +# Try to extract the demo to launch from the script name. +DEMO=${DEFAULT_DEMO} +DEMO_FROM_NAME="$(basename "${0}" | sed -n 's/^launch_npu_demo_\(.*\)\.sh$/\1/p')" + +# Check if the demo to launch was passed as argument. +if [ -n "${1}" ]; then + DEMO=${1} +elif [ -n "${DEMO_FROM_NAME}" ]; then + DEMO=${DEMO_FROM_NAME} +fi + +# Build the demo folder name. +DEMO_FOLDER_NAME="$(echo "${DEMO}" | sed 's/_/-/g')" + +# Build the demo full path. +DEMO_DIR="/usr/local/demo-ai/${DEMO_FOLDER_NAME}" + +# Verify that the demo directory exists. +[ -d "${DEMO_DIR}" ] || { echo "Error: Demo ${DEMO} does not exist"; exit 1; } + +# Execute the demo. +"${DEMO_DIR}/tflite/launch_python_${DEMO}.sh" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch new file mode 100644 index 000000000..0b104f0aa --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0001-image-classification-remove-weston-user-check-from-l.patch @@ -0,0 +1,47 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:42:29 +0200 +Subject: [PATCH 1/3] image-classification: remove weston user check from + launch + +Signed-off-by: David Escalona +--- + .../files/tflite/launch_python_image_classification.sh | 8 +------- + .../tflite/launch_python_image_classification_testdata.sh | 8 +------- + 2 files changed, 2 insertions(+), 14 deletions(-) + +diff --git a/tflite/launch_python_image_classification.sh b/tflite/launch_python_image_classification.sh +index 647091d..1b8b75b 100755 +--- a/tflite/launch_python_image_classification.sh ++++ b/tflite/launch_python_image_classification.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/image-classification/tflite/tflite_image_classification.py -m /usr/local/demo-ai/image-classification/models/mobilenet/$IMAGE_CLASSIFICATION_MODEL.tflite -l /usr/local/demo-ai/image-classification/models/mobilenet/$IMAGE_CLASSIFICATION_LABEL.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_image_classification_testdata.sh b/tflite/launch_python_image_classification_testdata.sh +index e6bfb2f..cf4a191 100755 +--- a/tflite/launch_python_image_classification_testdata.sh ++++ b/tflite/launch_python_image_classification_testdata.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/image-classification/tflite/tflite_image_classification.py -m /usr/local/demo-ai/image-classification/models/mobilenet/$IMAGE_CLASSIFICATION_MODEL.tflite -l /usr/local/demo-ai/image-classification/models/mobilenet/$IMAGE_CLASSIFICATION_LABEL.txt -i /usr/local/demo-ai/image-classification/models/mobilenet/testdata/ $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0002-image-classification-reduce-font-size-for-big-screen.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0002-image-classification-reduce-font-size-for-big-screen.patch new file mode 100644 index 000000000..b24d6528c --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0002-image-classification-reduce-font-size-for-big-screen.patch @@ -0,0 +1,35 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:43:08 +0200 +Subject: [PATCH 2/3] image-classification: reduce font size for big screens + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_image_classification.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tflite/tflite_image_classification.py b/tflite/tflite_image_classification.py +index 8e4575f..368a88d 100644 +--- a/tflite/tflite_image_classification.py ++++ b/tflite/tflite_image_classification.py +@@ -476,8 +476,8 @@ class MainWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' +@@ -659,8 +659,8 @@ class OverlayWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0003-image-classification-set-camera-preview-to-640x480.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0003-image-classification-set-camera-preview-to-640x480.patch new file mode 100644 index 000000000..cfc3732a0 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/files/patches/0003-image-classification-set-camera-preview-to-640x480.patch @@ -0,0 +1,39 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:43:55 +0200 +Subject: [PATCH 3/3] image-classification: set camera preview to 640x480 + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_image_classification.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tflite/tflite_image_classification.py b/tflite/tflite_image_classification.py +index 368a88d..1a18349 100644 +--- a/tflite/tflite_image_classification.py ++++ b/tflite/tflite_image_classification.py +@@ -552,8 +552,10 @@ class MainWindow(Gtk.Window): + if self.app.enable_camera_preview == True: + # camera preview => gst stream + self.video_widget = self.app.gst_widget ++ self.video_widget.set_size_request(640, 480); + self.video_widget.set_app_paintable(True) +- self.video_box.pack_start(self.video_widget, True, True, 0) ++ self.video_box.pack_start(self.video_widget, True, False, 0) ++ self.video_box.set_center_widget(self.video_widget) + else : + # still picture => openCV picture + self.image = Gtk.Image() +@@ -736,10 +738,12 @@ class OverlayWindow(Gtk.Window): + self.video_box.set_name("gui_overlay_video") + self.video_box.set_app_paintable(True) + self.drawing_area = Gtk.DrawingArea() ++ self.drawing_area.set_size_request(640, 480); + self.drawing_area.connect("draw", self.drawing) + self.drawing_area.set_name("overlay_draw") + self.drawing_area.set_app_paintable(True) +- self.video_box.pack_start(self.drawing_area, True, True, 0) ++ self.video_box.pack_start(self.drawing_area, True, False, 0) ++ self.video_box.set_center_widget(self.drawing_area) + + # setup the exit box which contains the exit button + self.exit_box = Gtk.VBox() diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/files/mobilenet_v3_large_100_224_quant.tflite b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/files/mobilenet_v3_large_100_224_quant.tflite new file mode 100644 index 000000000..71938c22f Binary files /dev/null and b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/files/mobilenet_v3_large_100_224_quant.tflite differ diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/tflite-models-mobilenetv3.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/tflite-models-mobilenetv3.bbappend new file mode 100644 index 000000000..14bf2c234 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/models/tflite-models-mobilenetv3.bbappend @@ -0,0 +1,13 @@ +# Copyright (C) 2024, Digi International Inc. + +SRC_URI:remove = "https://tfhub.dev/iree/lite-model/mobilenet_v3_large_100_224/uint8/1?lite-format=tflite;subdir=mobilenet_v3_large_100_224_quant;name=mobilenet_v3_large_100_224_quant" +SRC_URI:append = "file://mobilenet_v3_large_100_224_quant.tflite" + +do_install() { + install -d ${D}${prefix}/local/demo-ai/image-classification/models/mobilenet + install -d ${D}${prefix}/local/demo-ai/image-classification/models/mobilenet/testdata + + # install mobilenetV3 model + corresponding label file + install -m 0644 ${S}/label*.txt ${D}${prefix}/local/demo-ai/image-classification/models/mobilenet/labels_mobilenet_v3.txt + install -m 0644 ${WORKDIR}/mobilenet_v3_large_100_224_quant.tflite ${D}${prefix}/local/demo-ai/image-classification/models/mobilenet/ +} diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/tflite-image-classification-python_%.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/tflite-image-classification-python_%.bbappend new file mode 100644 index 000000000..fa0e4f57f --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/image-classification/tflite-image-classification-python_%.bbappend @@ -0,0 +1,29 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/../common:" + +SRC_URI += " \ + file://scripts/launch_npu_demo.sh \ + file://patches/0001-image-classification-remove-weston-user-check-from-l.patch \ + file://patches/0002-image-classification-reduce-font-size-for-big-screen.patch \ + file://patches/0003-image-classification-set-camera-preview-to-640x480.patch \ +" + +do_install:append () { + # Install the generic launch script. + install -d ${D}${sysconfdir}/demos/scripts + install -m 755 ${WORKDIR}/scripts/launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/ + # Create launch symlink for the demo. + ln -sf launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/launch_npu_demo_image_classification.sh +} + +RDEPENDS:${PN} += " \ + libdrm-tests \ +" + +FILES:${PN} += " \ + ${systemd_unitdir}/demos/scripts/* \ +" + +# Make this recipe available only for the CCMP25 platform. +COMPATIBLE_MACHINE = "(ccmp25)" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch new file mode 100644 index 000000000..9ed64e1f8 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0001-object-detection-remove-weston-user-check-from-launc.patch @@ -0,0 +1,84 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:44:24 +0200 +Subject: [PATCH 1/3] object-detection: remove weston user check from launch + +Signed-off-by: David Escalona +--- + .../files/tflite/launch_python_object_detection.sh | 8 +------- + .../files/tflite/launch_python_object_detection_mp2.sh | 8 +------- + .../tflite/launch_python_object_detection_testdata.sh | 8 +------- + .../tflite/launch_python_object_detection_testdata_mp2.sh | 8 +------- + 4 files changed, 4 insertions(+), 28 deletions(-) + +diff --git a/tflite/launch_python_object_detection.sh b/tflite/launch_python_object_detection.sh +index 78764c0..5124990 100755 +--- a/tflite/launch_python_object_detection.sh ++++ b/tflite/launch_python_object_detection.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/object-detection/tflite/tflite_object_detection.py -m /usr/local/demo-ai/object-detection/models/coco_ssd_mobilenet/coco_ssd_mobilenet.tflite -l /usr/local/demo-ai/object-detection/models/coco_ssd_mobilenet/labels_coco_ssd_mobilenet.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_object_detection_mp2.sh b/tflite/launch_python_object_detection_mp2.sh +index ac4b43b..0e39c90 100755 +--- a/tflite/launch_python_object_detection_mp2.sh ++++ b/tflite/launch_python_object_detection_mp2.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/object-detection/tflite/tflite_object_detection.py -m /usr/local/demo-ai/object-detection/models/yolov4-tiny/yolov4_tiny_416_quant.tflite -l /usr/local/demo-ai/object-detection/models/yolov4-tiny/labels_yolov4_tiny.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_object_detection_testdata.sh b/tflite/launch_python_object_detection_testdata.sh +index fc94284..a193a95 100755 +--- a/tflite/launch_python_object_detection_testdata.sh ++++ b/tflite/launch_python_object_detection_testdata.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/object-detection/tflite/tflite_object_detection.py -m /usr/local/demo-ai/object-detection/models/coco_ssd_mobilenet/coco_ssd_mobilenet.tflite -l /usr/local/demo-ai/object-detection/models/coco_ssd_mobilenet/labels_coco_ssd_mobilenet.txt -i /usr/local/demo-ai/object-detection/models/coco_ssd_mobilenet/testdata/ $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_object_detection_testdata_mp2.sh b/tflite/launch_python_object_detection_testdata_mp2.sh +index 780325e..e5e4922 100755 +--- a/tflite/launch_python_object_detection_testdata_mp2.sh ++++ b/tflite/launch_python_object_detection_testdata_mp2.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/object-detection/tflite/tflite_object_detection.py -m /usr/local/demo-ai/object-detection/models/yolov4-tiny/yolov4_tiny_416_quant.tflite -l /usr/local/demo-ai/object-detection/models/yolov4-tiny/labels_yolov4_tiny.txt -i /usr/local/demo-ai/object-detection/models/yolov4-tiny/testdata/ $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0002-object-detection-reduce-font-size-for-big-screens.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0002-object-detection-reduce-font-size-for-big-screens.patch new file mode 100644 index 000000000..b980ec633 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0002-object-detection-reduce-font-size-for-big-screens.patch @@ -0,0 +1,35 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:45:01 +0200 +Subject: [PATCH 2/3] object-detection: reduce font size for big screens + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_object_detection.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tflite/tflite_object_detection.py b/tflite/tflite_object_detection.py +index bbdfb8c..924143d 100644 +--- a/tflite/tflite_object_detection.py ++++ b/tflite/tflite_object_detection.py +@@ -703,8 +703,8 @@ class MainWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' +@@ -895,8 +895,8 @@ class OverlayWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0003-object-detection-set-camera-preview-to-640x480.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0003-object-detection-set-camera-preview-to-640x480.patch new file mode 100644 index 000000000..cab5963f1 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/files/patches/0003-object-detection-set-camera-preview-to-640x480.patch @@ -0,0 +1,39 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:45:23 +0200 +Subject: [PATCH 3/3] object-detection: set camera preview to 640x480 + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_object_detection.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tflite/tflite_object_detection.py b/tflite/tflite_object_detection.py +index 924143d..4ae2add 100644 +--- a/tflite/tflite_object_detection.py ++++ b/tflite/tflite_object_detection.py +@@ -781,8 +781,10 @@ class MainWindow(Gtk.Window): + if self.app.enable_camera_preview == True: + # camera preview => gst stream + self.video_widget = self.app.gst_widget ++ self.video_widget.set_size_request(640, 480); + self.video_widget.set_app_paintable(True) +- self.video_box.pack_start(self.video_widget, True, True, 0) ++ self.video_box.pack_start(self.video_widget, True, False, 0) ++ self.video_box.set_center_widget(self.video_widget) + else : + # still picture => openCV picture + self.image = Gtk.Image() +@@ -973,10 +975,12 @@ class OverlayWindow(Gtk.Window): + self.video_box.set_name("gui_overlay_video") + self.video_box.set_app_paintable(True) + self.drawing_area = Gtk.DrawingArea() ++ self.drawing_area.set_size_request(640, 480); + self.drawing_area.connect("draw", self.drawing) + self.drawing_area.set_name("overlay_draw") + self.drawing_area.set_app_paintable(True) +- self.video_box.pack_start(self.drawing_area, True, True, 0) ++ self.video_box.pack_start(self.drawing_area, True, False, 0) ++ self.video_box.set_center_widget(self.drawing_area) + + # setup the exit box which contains the exit button + self.exit_box = Gtk.VBox() diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/tflite-object-detection-python_%.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/tflite-object-detection-python_%.bbappend new file mode 100644 index 000000000..5a27c090c --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/object-detection/tflite-object-detection-python_%.bbappend @@ -0,0 +1,29 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/../common:" + +SRC_URI += " \ + file://scripts/launch_npu_demo.sh \ + file://patches/0001-object-detection-remove-weston-user-check-from-launc.patch \ + file://patches/0002-object-detection-reduce-font-size-for-big-screens.patch \ + file://patches/0003-object-detection-set-camera-preview-to-640x480.patch \ +" + +do_install:append () { + # Install the generic launch script. + install -d ${D}${sysconfdir}/demos/scripts + install -m 755 ${WORKDIR}/scripts/launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/ + # Create launch symlink for the demo. + ln -sf launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/launch_npu_demo_object_detection.sh +} + +RDEPENDS:${PN} += " \ + libdrm-tests \ +" + +FILES:${PN} += " \ + ${systemd_unitdir}/demos/scripts/* \ +" + +# Make this recipe available only for the CCMP25 platform. +COMPATIBLE_MACHINE = "(ccmp25)" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch new file mode 100644 index 000000000..65f470deb --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch @@ -0,0 +1,46 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:45:59 +0200 +Subject: [PATCH 1/3] pose-estimation: remove weston user check from launch + +Signed-off-by: David Escalona +--- + .../files/tflite/launch_python_pose_estimation.sh | 8 +------- + .../tflite/launch_python_pose_estimation_testdata.sh | 8 +------- + 2 files changed, 2 insertions(+), 14 deletions(-) + +diff --git a/tflite/launch_python_pose_estimation.sh b/tflite/launch_python_pose_estimation.sh +index f1edba5..221f47d 100755 +--- a/tflite/launch_python_pose_estimation.sh ++++ b/tflite/launch_python_pose_estimation.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/pose-estimation/tflite/tflite_pose_estimation.py -m /usr/local/demo-ai/pose-estimation/models/movenet/movenet_singlepose_lightning.tflite --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_pose_estimation_testdata.sh b/tflite/launch_python_pose_estimation_testdata.sh +index 957d841..481de89 100755 +--- a/tflite/launch_python_pose_estimation_testdata.sh ++++ b/tflite/launch_python_pose_estimation_testdata.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/pose-estimation/tflite/tflite_pose_estimation.py -m /usr/local/demo-ai/pose-estimation/models/movenet/movenet_singlepose_lightning.tflite -i /usr/local/demo-ai/pose-estimation/models/movenet/testdata/ $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0002-pose-estimation-reduce-font-size-for-big-screens.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0002-pose-estimation-reduce-font-size-for-big-screens.patch new file mode 100644 index 000000000..2f175c331 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0002-pose-estimation-reduce-font-size-for-big-screens.patch @@ -0,0 +1,35 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:47:16 +0200 +Subject: [PATCH 2/3] pose-estimation: reduce font size for big screens + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_pose_estimation.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tflite/tflite_pose_estimation.py b/tflite/tflite_pose_estimation.py +index 6f34bc9..9d83ae3 100644 +--- a/tflite/tflite_pose_estimation.py ++++ b/tflite/tflite_pose_estimation.py +@@ -503,8 +503,8 @@ class MainWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' +@@ -688,8 +688,8 @@ class OverlayWindow(Gtk.Window): + self.ui_icon_st_height = '160' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0003-pose-estimation-set-camera-preview-to-640x480.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0003-pose-estimation-set-camera-preview-to-640x480.patch new file mode 100644 index 000000000..d0dcbfa33 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/files/patches/0003-pose-estimation-set-camera-preview-to-640x480.patch @@ -0,0 +1,39 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:47:43 +0200 +Subject: [PATCH 3/3] pose-estimation: set camera preview to 640x480 + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_pose_estimation.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tflite/tflite_pose_estimation.py b/tflite/tflite_pose_estimation.py +index 9d83ae3..ed33d5c 100644 +--- a/tflite/tflite_pose_estimation.py ++++ b/tflite/tflite_pose_estimation.py +@@ -574,8 +574,10 @@ class MainWindow(Gtk.Window): + if self.app.enable_camera_preview == True: + # camera preview => gst stream + self.video_widget = self.app.gst_widget ++ self.video_widget.set_size_request(640, 480); + self.video_widget.set_app_paintable(True) +- self.video_box.pack_start(self.video_widget, True, True, 0) ++ self.video_box.pack_start(self.video_widget, True, False, 0) ++ self.video_box.set_center_widget(self.video_widget) + else : + # still picture => openCV picture + self.image = Gtk.Image() +@@ -759,10 +761,12 @@ class OverlayWindow(Gtk.Window): + self.video_box.set_name("gui_overlay_video") + self.video_box.set_app_paintable(True) + self.drawing_area = Gtk.DrawingArea() ++ self.drawing_area.set_size_request(640, 480); + self.drawing_area.connect("draw", self.drawing) + self.drawing_area.set_name("overlay_draw") + self.drawing_area.set_app_paintable(True) +- self.video_box.pack_start(self.drawing_area, True, True, 0) ++ self.video_box.pack_start(self.drawing_area, True, False, 0) ++ self.video_box.set_center_widget(self.drawing_area) + + # setup the exit box which contains the exit button + self.exit_box = Gtk.VBox() diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/files/movenet_singlepose_lightning.tflite b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/files/movenet_singlepose_lightning.tflite new file mode 100644 index 000000000..67a2124a1 Binary files /dev/null and b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/files/movenet_singlepose_lightning.tflite differ diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/tflite-models-movenet-singlepose-lightning.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/tflite-models-movenet-singlepose-lightning.bbappend new file mode 100644 index 000000000..5ec38d517 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/models/tflite-models-movenet-singlepose-lightning.bbappend @@ -0,0 +1,14 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:remove = " https://tfhub.dev/google/lite-model/movenet/singlepose/lightning/tflite/int8/4?lite-format=tflite;subdir=${BPN}-${PV}/movenet_singlepose_lightning_quant;name=movenet_singlepose_lightning_quant" +SRC_URI:append = " file://movenet_singlepose_lightning.tflite" + +do_install() { + install -d ${D}${prefix}/local/demo-ai/pose-estimation/models/movenet + install -d ${D}${prefix}/local/demo-ai/pose-estimation/models/movenet/testdata + + # install movenet model + install -m 0644 ${WORKDIR}/movenet_singlepose_lightning.tflite ${D}${prefix}/local/demo-ai/pose-estimation/models/movenet/ +} diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/tflite-pose-estimation-python_%.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/tflite-pose-estimation-python_%.bbappend new file mode 100644 index 000000000..eda851df4 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/pose-estimation/tflite-pose-estimation-python_%.bbappend @@ -0,0 +1,29 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/../common:" + +SRC_URI += " \ + file://scripts/launch_npu_demo.sh \ + file://patches/0001-pose-estimation-remove-weston-user-check-from-launch.patch \ + file://patches/0002-pose-estimation-reduce-font-size-for-big-screens.patch \ + file://patches/0003-pose-estimation-set-camera-preview-to-640x480.patch \ +" + +do_install:append () { + # Install the generic launch script. + install -d ${D}${sysconfdir}/demos/scripts + install -m 755 ${WORKDIR}/scripts/launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/ + # Create launch symlink for the demo. + ln -sf launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/launch_npu_demo_pose_estimation.sh +} + +RDEPENDS:${PN} += " \ + libdrm-tests \ +" + +FILES:${PN} += " \ + ${systemd_unitdir}/demos/scripts/* \ +" + +# Make this recipe available only for the CCMP25 platform. +COMPATIBLE_MACHINE = "(ccmp25)" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/resources/files/resources-files/config_board.sh b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/resources/files/resources-files/config_board.sh index f18598cdd..2c5d54940 100644 --- a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/resources/files/resources-files/config_board.sh +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/resources/files/resources-files/config_board.sh @@ -5,6 +5,7 @@ STM32MP135="stm32mp135" STM32MP157="stm32mp157" STM32MP157FEV1="stm32mp157f-ev1st" STM32MP257="stm32mp257" +STM32MP255="stm32mp255" if [[ "$COMPATIBLE" == *"$STM32MP135"* ]]; then MACHINE=$STM32MP135 @@ -46,4 +47,14 @@ if [[ "$COMPATIBLE" == *"$STM32MP257"* ]]; then IMAGE_CLASSIFICATION_LABEL="labels_mobilenet_v3" fi +if [[ "$COMPATIBLE" == *"$STM32MP255"* ]]; then + MACHINE=$STM32MP255 + DWIDTH=640 + DHEIGHT=480 + DFPS=30 + COMPUTE_ENGINE="--npu" + IMAGE_CLASSIFICATION_MODEL="mobilenet_v3_large_100_224_quant" + IMAGE_CLASSIFICATION_LABEL="labels_mobilenet_v3" +fi + echo "machine used = "$MACHINE diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch new file mode 100644 index 000000000..5c5fec0cb --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch @@ -0,0 +1,47 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:48:10 +0200 +Subject: [PATCH 1/4] semantic-segmentation: remove weston user check from + launch + +Signed-off-by: David Escalona +--- + .../files/tflite/launch_python_semantic_segmentation.sh | 8 +------- + .../launch_python_semantic_segmentation_testdata.sh | 8 +------- + 2 files changed, 2 insertions(+), 14 deletions(-) + +diff --git a/tflite/launch_python_semantic_segmentation.sh b/tflite/launch_python_semantic_segmentation.sh +index f4e599c..868c537 100755 +--- a/tflite/launch_python_semantic_segmentation.sh ++++ b/tflite/launch_python_semantic_segmentation.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/semantic-segmentation/tflite/tflite_semantic_segmentation.py -m /usr/local/demo-ai/semantic-segmentation/models/deeplabv3/deeplabv3.tflite -l /usr/local/demo-ai/semantic-segmentation/models/deeplabv3/labelmap.txt --framerate $DFPS --frame_width $DWIDTH --frame_height $DHEIGHT $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd +diff --git a/tflite/launch_python_semantic_segmentation_testdata.sh b/tflite/launch_python_semantic_segmentation_testdata.sh +index cb39131..4322b4e 100755 +--- a/tflite/launch_python_semantic_segmentation_testdata.sh ++++ b/tflite/launch_python_semantic_segmentation_testdata.sh +@@ -1,12 +1,6 @@ + #!/bin/sh +-weston_user=$(ps aux | grep '/usr/bin/weston '|grep -v 'grep'|awk '{print $1}') + + source /usr/local/demo-ai/resources/config_board.sh + cmd="python3 /usr/local/demo-ai/semantic-segmentation/tflite/tflite_semantic_segmentation.py -m /usr/local/demo-ai/semantic-segmentation/models/deeplabv3/deeplabv3.tflite -l /usr/local/demo-ai/semantic-segmentation/models/deeplabv3/labelmap.txt -i /usr/local/demo-ai/semantic-segmentation/models/deeplabv3/testdata $COMPUTE_ENGINE" + +-if [ "$weston_user" != "root" ]; then +- echo "user : "$weston_user +- script -qc "su -l $weston_user -c '$cmd'" +-else +- $cmd +-fi ++$cmd diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0002-semantic-segmentation-reduce-font-size-for-big-scree.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0002-semantic-segmentation-reduce-font-size-for-big-scree.patch new file mode 100644 index 000000000..16f238f25 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0002-semantic-segmentation-reduce-font-size-for-big-scree.patch @@ -0,0 +1,35 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:58:22 +0200 +Subject: [PATCH 2/4] semantic-segmentation: reduce font size for big screens + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_semantic_segmentation.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tflite/tflite_semantic_segmentation.py b/tflite/tflite_semantic_segmentation.py +index eed2ae1..04b1f61 100644 +--- a/tflite/tflite_semantic_segmentation.py ++++ b/tflite/tflite_semantic_segmentation.py +@@ -480,8 +480,8 @@ class MainWindow(Gtk.Window): + self.ui_icon_label_height = '64' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' +@@ -725,8 +725,8 @@ class OverlayWindow(Gtk.Window): + self.ui_icon_label_height = '64' + elif window_constraint <= 1080: + #Display 1920x1080 +- self.ui_cairo_font_size = 33 +- self.ui_cairo_font_size_label = 48 ++ self.ui_cairo_font_size = 23 ++ self.ui_cairo_font_size_label = 38 + self.ui_icon_exit_width = '50' + self.ui_icon_exit_height = '50' + self.ui_icon_st_width = '130' diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0003-semantic-segmentation-adapt-sample-for-root-user.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0003-semantic-segmentation-adapt-sample-for-root-user.patch new file mode 100644 index 000000000..8b6b6c35f --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0003-semantic-segmentation-adapt-sample-for-root-user.patch @@ -0,0 +1,35 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:59:12 +0200 +Subject: [PATCH 3/4] semantic-segmentation: adapt sample for root user + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_semantic_segmentation.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tflite/tflite_semantic_segmentation.py b/tflite/tflite_semantic_segmentation.py +index 04b1f61..882d197 100644 +--- a/tflite/tflite_semantic_segmentation.py ++++ b/tflite/tflite_semantic_segmentation.py +@@ -901,10 +901,10 @@ class OverlayWindow(Gtk.Window): + size = (int(preview_width),int(preview_height)) + img = img.resize(size) + img_alpha = img.copy() +- img_alpha.save("/home/weston/bitmap.png","PNG") ++ img_alpha.save("/home/root/bitmap.png","PNG") + + #load the bitmap to display it as overlay +- pixbuf = GdkPixbuf.Pixbuf.new_from_file('/home/weston/bitmap.png') ++ pixbuf = GdkPixbuf.Pixbuf.new_from_file('/home/root/bitmap.png') + img = Gdk.cairo_set_source_pixbuf(cr, pixbuf.copy(),int(offset), int(vertical_offset)) + cr.paint() + if (self.app.enable_camera_preview == False): +@@ -1385,7 +1385,7 @@ if __name__ == '__main__': + Gtk.main() + #remove bitmap.png file before closing app + file = 'bitmap.png' +- location = "/home/weston" ++ location = "/home/root" + path = os.path.join(location,file) + os.remove(path) + print("gtk main finished") diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0004-semantic-segmentation-set-camera-preview-to-640x480.patch b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0004-semantic-segmentation-set-camera-preview-to-640x480.patch new file mode 100644 index 000000000..d19f0b6dd --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/files/patches/0004-semantic-segmentation-set-camera-preview-to-640x480.patch @@ -0,0 +1,41 @@ +From: David Escalona +Date: Mon, 16 Sep 2024 18:59:41 +0200 +Subject: [PATCH 4/4] semantic-segmentation: set camera preview to 640x480 + +Signed-off-by: David Escalona +--- + .../files/tflite/tflite_semantic_segmentation.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tflite/tflite_semantic_segmentation.py b/tflite/tflite_semantic_segmentation.py +index 882d197..3618360 100644 +--- a/tflite/tflite_semantic_segmentation.py ++++ b/tflite/tflite_semantic_segmentation.py +@@ -574,8 +574,10 @@ class MainWindow(Gtk.Window): + if self.app.enable_camera_preview == True: + # camera preview => gst stream + self.video_widget = self.app.gst_widget ++ self.video_widget.set_size_request(640, 480); + self.video_widget.set_app_paintable(True) +- self.video_box.pack_start(self.video_widget, True, True, 0) ++ self.video_box.pack_start(self.video_widget, True, False, 0) ++ self.video_box.set_center_widget(self.video_widget) + else : + # still picture => openCV picture + self.image = Gtk.Image() +@@ -821,12 +823,14 @@ class OverlayWindow(Gtk.Window): + self.video_box.set_name("gui_overlay_video") + self.video_box.set_app_paintable(True) + self.drawing_area = Gtk.DrawingArea() ++ self.drawing_area.set_size_request(640, 480); + self.drawing_area.connect("draw", self.drawing) + self.drawing_area.connect("touch-event", self.touch_event_cb) + self.drawing_area.add_events(Gdk.EventMask.TOUCH_MASK) + self.drawing_area.set_name("overlay_draw") + self.drawing_area.set_app_paintable(True) +- self.video_box.pack_start(self.drawing_area, True, True, 0) ++ self.video_box.pack_start(self.drawing_area, True, False, 0) ++ self.video_box.set_center_widget(self.drawing_area) + + # # setup the exit box which contains the exit button + self.exit_box = Gtk.VBox() diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/tflite-semantic-segmentation-python_%.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/tflite-semantic-segmentation-python_%.bbappend new file mode 100644 index 000000000..79a0ef07c --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-samples/semantic-segmentation/tflite-semantic-segmentation-python_%.bbappend @@ -0,0 +1,30 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/../common:" + +SRC_URI += " \ + file://scripts/launch_npu_demo.sh \ + file://patches/0001-semantic-segmentation-remove-weston-user-check-from-.patch \ + file://patches/0002-semantic-segmentation-reduce-font-size-for-big-scree.patch \ + file://patches/0003-semantic-segmentation-adapt-sample-for-root-user.patch \ + file://patches/0004-semantic-segmentation-set-camera-preview-to-640x480.patch \ +" + +do_install:append () { + # Install the generic launch script. + install -d ${D}${sysconfdir}/demos/scripts + install -m 755 ${WORKDIR}/scripts/launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/ + # Create launch symlink for the demo. + ln -sf launch_npu_demo.sh ${D}${sysconfdir}/demos/scripts/launch_npu_demo_semantic_segmentation.sh +} + +RDEPENDS:${PN} += " \ + libdrm-tests \ +" + +FILES:${PN} += " \ + ${systemd_unitdir}/demos/scripts/* \ +" + +# Make this recipe available only for the CCMP25 platform. +COMPATIBLE_MACHINE = "(ccmp25)" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend index 86dfc2dff..b331021b3 100644 --- a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend @@ -9,3 +9,27 @@ RDEPENDS:packagegroup-x-linux-ai-tflite-edgetpu:remove:ccmp13 = " \ tflite-cv-apps-edgetpu-image-classification-c++ \ tflite-cv-apps-edgetpu-object-detection-c++ \ " + +PACKAGES:remove:ccmp25 = " \ + packagegroup-x-linux-ai-tflite-edgetpu \ + packagegroup-x-linux-ai-onnxruntime \ +" + +RDEPENDS:packagegroup-x-linux-ai:remove:ccmp25 = " \ + packagegroup-x-linux-ai-tflite-edgetpu \ + packagegroup-x-linux-ai-onnxruntime \ +" + +RDEPENDS:packagegroup-x-linux-ai-tflite:remove:ccmp25 = " \ + tflite-cv-apps-image-classification-c++ \ + tflite-cv-apps-image-classification-python \ + tflite-cv-apps-object-detection-c++ \ + tflite-cv-apps-object-detection-python \ +" + +RDEPENDS:packagegroup-x-linux-ai-tflite:append:ccmp25 = " \ + tflite-image-classification-python \ + tflite-object-detection-python \ + tflite-pose-estimation-python \ + tflite-semantic-segmentation-python \ +"