x-linux-ai: recipes-samples: adapt npu samples customizations

NPU samples were reworked in the new X-LINUX-AI v6.0.0 release from the
meta-st-x-linux-ai layer. This commit updates the Digi customizations to align
with the new NPU sample files.

https://onedigi.atlassian.net/browse/DEL-9419

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2024-12-12 11:58:50 +01:00
parent 78d02c2996
commit 8c0d24248f
17 changed files with 234 additions and 227 deletions

View File

@ -5,21 +5,24 @@ Subject: [PATCH 1/3] image-classification: remove weston user check from
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/launch_python_image_classification.sh | 8 +-------
.../tflite/launch_python_image_classification_testdata.sh | 8 +-------
.../files/stai-mpu/launch_python_image_classification.sh | 8 +-------
.../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
diff --git a/stai-mpu/launch_python_image_classification.sh b/stai-mpu/launch_python_image_classification.sh
index ac5efb5..ab0ed4b 100755
--- a/stai-mpu/launch_python_image_classification.sh
+++ b/stai-mpu/launch_python_image_classification.sh
@@ -7,15 +7,9 @@
# 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}')
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"
FRAMEWORK=$1
echo "stai wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.sh
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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"
@ -27,17 +30,20 @@ index 647091d..1b8b75b 100755
- $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
diff --git a/stai-mpu/launch_python_image_classification_testdata.sh b/stai-mpu/launch_python_image_classification_testdata.sh
index 31ac124..a35f615 100755
--- a/stai-mpu/launch_python_image_classification_testdata.sh
+++ b/stai-mpu/launch_python_image_classification_testdata.sh
@@ -7,15 +7,9 @@
# 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}')
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"
FRAMEWORK=$1
echo "stai wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.sh
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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"

View File

@ -4,32 +4,31 @@ Subject: [PATCH 2/3] image-classification: reduce font size for big screens
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_image_classification.py | 8 ++++----
.../files/stai-mpu/stai_mpu_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'
diff --git a/stai-mpu/stai_mpu_image_classification.py b/stai-mpu/stai_mpu_image_classification.py
index 8b433de..a86fcb0 100644
--- a/stai-mpu/stai_mpu_image_classification.py
+++ b/stai-mpu/stai_mpu_image_classification.py
@@ -468,8 +468,8 @@ class MainWindow(Gtk.Window):
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
@@ -640,8 +640,8 @@ class OverlayWindow(Gtk.Window):
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'

View File

@ -4,14 +4,14 @@ Subject: [PATCH 3/3] image-classification: set camera preview to 640x480
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_image_classification.py | 8 ++++++--
.../files/stai-mpu/stai_mpu_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):
diff --git a/stai-mpu/stai_mpu_image_classification.py b/stai-mpu/stai_mpu_image_classification.py
index a86fcb0..f21196b 100644
--- a/stai-mpu/stai_mpu_image_classification.py
+++ b/stai-mpu/stai_mpu_image_classification.py
@@ -536,8 +536,10 @@ class MainWindow(Gtk.Window):
if self.app.enable_camera_preview == True:
# camera preview => gst stream
self.video_widget = self.app.gst_widget
@ -23,7 +23,7 @@ index 368a88d..1a18349 100644
else :
# still picture => openCV picture
self.image = Gtk.Image()
@@ -736,10 +738,12 @@ class OverlayWindow(Gtk.Window):
@@ -709,10 +711,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()
@ -34,6 +34,6 @@ index 368a88d..1a18349 100644
- 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()

View File

@ -1,6 +1,6 @@
# Copyright (C) 2024, Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:"
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:${THISDIR}/files:"
SRC_URI += " \
file://scripts/launch_npu_demo.sh \

View File

@ -4,23 +4,24 @@ Subject: [PATCH 1/3] object-detection: remove weston user check from launch
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../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(-)
.../files/stai-mpu/launch_python_object_detection.sh | 8 +-------
.../stai-mpu/launch_python_object_detection_testdata.sh | 8 +-------
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
--- a/stai-mpu/launch_python_object_detection.sh
+++ b/stai-mpu/launch_python_object_detection.sh
@@ -7,15 +7,9 @@
# in the root directory of this software component.
# If no LICENSE file comes with this software, it is provided AS-IS.
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"
FRAMEWORK=$1
echo "stai_mpu wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.sh
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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"
@ -28,53 +29,20 @@ index 78764c0..5124990 100755
- $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
diff --git a/stai-mpu/launch_python_object_detection_testdata.sh b/stai-mpu/launch_python_object_detection_testdata.sh
index c8e4d5b..bd9a9b9 100755
--- a/stai-mpu/launch_python_object_detection_testdata.sh
+++ b/stai-mpu/launch_python_object_detection_testdata.sh
@@ -7,15 +7,9 @@
# 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}')
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"
FRAMEWORK=$1
echo "stai_mpu wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.sh
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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"

View File

@ -4,32 +4,31 @@ Subject: [PATCH 2/3] object-detection: reduce font size for big screens
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_object_detection.py | 8 ++++----
.../files/stai-mpu/stai_mpu_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'
diff --git a/stai-mpu/stai_mpu_object_detection.py b/stai-mpu/stai_mpu_object_detection.py
index 5a78826..a841093 100644
--- a/stai-mpu/stai_mpu_object_detection.py
+++ b/stai-mpu/stai_mpu_object_detection.py
@@ -462,8 +462,8 @@ class MainWindow(Gtk.Window):
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
@@ -645,8 +645,8 @@ class OverlayWindow(Gtk.Window):
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'

View File

@ -4,14 +4,14 @@ Subject: [PATCH 3/3] object-detection: set camera preview to 640x480
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_object_detection.py | 8 ++++++--
.../files/stai-mpu/stai_mpu_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):
diff --git a/stai-mpu/stai_mpu_object_detection.py b/stai-mpu/stai_mpu_object_detection.py
index a841093..acd5e81 100644
--- a/stai-mpu/stai_mpu_object_detection.py
+++ b/stai-mpu/stai_mpu_object_detection.py
@@ -531,8 +531,10 @@ class MainWindow(Gtk.Window):
if self.app.enable_camera_preview == True:
# camera preview => gst stream
self.video_widget = self.app.gst_widget
@ -23,7 +23,7 @@ index 924143d..4ae2add 100644
else :
# still picture => openCV picture
self.image = Gtk.Image()
@@ -973,10 +975,12 @@ class OverlayWindow(Gtk.Window):
@@ -715,10 +717,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()
@ -34,6 +34,6 @@ index 924143d..4ae2add 100644
- 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()

View File

@ -1,6 +1,6 @@
# Copyright (C) 2024, Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:"
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:${THISDIR}/files:"
SRC_URI += " \
file://scripts/launch_npu_demo.sh \

View File

@ -4,20 +4,25 @@ Subject: [PATCH 1/3] pose-estimation: remove weston user check from launch
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/launch_python_pose_estimation.sh | 8 +-------
.../tflite/launch_python_pose_estimation_testdata.sh | 8 +-------
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/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}')
diff --git a/stai-mpu/launch_python_pose_estimation.sh b/stai-mpu/launch_python_pose_estimation.sh
index a317b58..7c41246 100644
--- a/stai-mpu/launch_python_pose_estimation.sh
+++ b/stai-mpu/launch_python_pose_estimation.sh
@@ -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.
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"
-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
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
@ -25,17 +30,23 @@ index f1edba5..221f47d 100755
-else
- $cmd
-fi
\ No newline at end of file
+$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}')
diff --git a/stai-mpu/launch_python_pose_estimation_testdata.sh b/stai-mpu/launch_python_pose_estimation_testdata.sh
index 9992666..cc2f0b6 100644
--- a/stai-mpu/launch_python_pose_estimation_testdata.sh
+++ b/stai-mpu/launch_python_pose_estimation_testdata.sh
@@ -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.
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"
-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
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
@ -43,4 +54,5 @@ index 957d841..481de89 100755
-else
- $cmd
-fi
\ No newline at end of file
+$cmd

View File

@ -4,32 +4,40 @@ Subject: [PATCH 2/3] pose-estimation: reduce font size for big screens
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_pose_estimation.py | 8 ++++----
stai-mpu/stai_mpu_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'
diff --git a/stai-mpu/stai_mpu_pose_estimation.py b/stai-mpu/stai_mpu_pose_estimation.py
index 3d622f9..25d9dd2 100644
--- a/stai-mpu/stai_mpu_pose_estimation.py
+++ b/stai-mpu/stai_mpu_pose_estimation.py
@@ -468,12 +468,12 @@ class MainWindow(Gtk.Window):
self.ui_cairo_font_size_label = 38
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
def main_ui_creation(self,args):
"""
@@ -640,12 +640,12 @@ class OverlayWindow(Gtk.Window):
self.ui_cairo_font_size_label = 38
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
def overlay_ui_creation(self,args):
"""

View File

@ -4,14 +4,16 @@ Subject: [PATCH 3/3] pose-estimation: set camera preview to 640x480
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_pose_estimation.py | 8 ++++++--
stai-mpu/stai_mpu_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):
diff --git a/stai-mpu/stai_mpu_pose_estimation.py b/stai-mpu/stai_mpu_pose_estimation.py
index 25d9dd2..e6a0198 100644
--- a/stai-mpu/stai_mpu_pose_estimation.py
+++ b/stai-mpu/stai_mpu_pose_estimation.py
@@ -536,12 +536,14 @@ class MainWindow(Gtk.Window):
self.video_box = Gtk.HBox()
self.video_box.set_name("gui_main_video")
if self.app.enable_camera_preview == True:
# camera preview => gst stream
self.video_widget = self.app.gst_widget
@ -23,7 +25,11 @@ index 9d83ae3..ed33d5c 100644
else :
# still picture => openCV picture
self.image = Gtk.Image()
@@ -759,10 +761,12 @@ class OverlayWindow(Gtk.Window):
self.video_box.pack_start(self.image, True, True, 0)
# setup the exit box which contains the exit button
@@ -709,14 +711,16 @@ class OverlayWindow(Gtk.Window):
# to draw over the video stream
self.video_box = Gtk.HBox()
self.video_box.set_name("gui_overlay_video")
self.video_box.set_app_paintable(True)
self.drawing_area = Gtk.DrawingArea()
@ -37,3 +43,5 @@ index 9d83ae3..ed33d5c 100644
# setup the exit box which contains the exit button
self.exit_box = Gtk.VBox()
self.exit_box.set_name("gui_overlay_exit")
self.exit_icon_path = RESOURCES_DIRECTORY + 'exit_' + self.ui_icon_exit_size + 'x' + self.ui_icon_exit_size + '.png'

View File

@ -1,6 +1,6 @@
# Copyright (C) 2024, Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:"
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:${THISDIR}/files:"
SRC_URI += " \
file://scripts/launch_npu_demo.sh \

View File

@ -5,21 +5,24 @@ Subject: [PATCH 1/4] semantic-segmentation: remove weston user check from
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/launch_python_semantic_segmentation.sh | 8 +-------
.../files/stai-mpu/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
diff --git a/stai-mpu/launch_python_semantic_segmentation.sh b/stai-mpu/launch_python_semantic_segmentation.sh
index e3c3a6c..e008572 100755
--- a/stai-mpu/launch_python_semantic_segmentation.sh
+++ b/stai-mpu/launch_python_semantic_segmentation.sh
@@ -7,15 +7,9 @@
# 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}')
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"
FRAMEWORK=$1
echo "stai-mpu wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"
@ -27,21 +30,25 @@ index f4e599c..868c537 100755
- $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
diff --git a/stai-mpu/launch_python_semantic_segmentation_testdata.sh b/stai-mpu/launch_python_semantic_segmentation_testdata.sh
index 2d3db4b..5375e0f 100755
--- a/stai-mpu/launch_python_semantic_segmentation_testdata.sh
+++ b/stai-mpu/launch_python_semantic_segmentation_testdata.sh
@@ -7,15 +7,9 @@
# 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}')
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"
FRAMEWORK=$1
echo "stai-mpu wrapper used : "$FRAMEWORK
source /usr/local/x-linux-ai/resources/config_board.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
- echo "user : "$weston_user
- script -qc "su -l $weston_user -c '$cmd'"
-else
- $cmd
-fi
\ No newline at end of file
+$cmd

View File

@ -4,32 +4,32 @@ Subject: [PATCH 2/4] semantic-segmentation: reduce font size for big screens
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_semantic_segmentation.py | 8 ++++----
.../files/stai-mpu/stai_mpu_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'
diff --git a/stai-mpu/stai_mpu_semantic_segmentation.py b/stai-mpu/stai_mpu_semantic_segmentation.py
index 0c0f242..35b8bea 100644
--- a/stai-mpu/stai_mpu_semantic_segmentation.py
+++ b/stai-mpu/stai_mpu_semantic_segmentation.py
@@ -475,8 +475,8 @@ class MainWindow(Gtk.Window):
self.ui_icon_label_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
self.ui_icon_label_size = '64'
@@ -711,8 +711,8 @@ class OverlayWindow(Gtk.Window):
self.ui_icon_label_size = '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'
self.ui_icon_exit_size = '50'
self.ui_icon_st_size = '160'
self.ui_icon_label_size = '64'

View File

@ -4,27 +4,27 @@ Subject: [PATCH 3/4] semantic-segmentation: adapt sample for root user
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_semantic_segmentation.py | 6 +++---
.../files/stai-mpu/stai_mpu_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):
diff --git a/stai-mpu/stai_mpu_semantic_segmentation.py b/stai-mpu/stai_mpu_semantic_segmentation.py
index 35b8bea..68d554b 100644
--- a/stai-mpu/stai_mpu_semantic_segmentation.py
+++ b/stai-mpu/stai_mpu_semantic_segmentation.py
@@ -884,10 +884,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__':
@@ -1392,7 +1392,7 @@ if __name__ == '__main__':
Gtk.main()
#remove bitmap.png file before closing app
file = 'bitmap.png'

View File

@ -4,14 +4,14 @@ Subject: [PATCH 4/4] semantic-segmentation: set camera preview to 640x480
Signed-off-by: David Escalona <david.escalona@digi.com>
---
.../files/tflite/tflite_semantic_segmentation.py | 8 ++++++--
.../files/stai-mpu/stai_mpu_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):
diff --git a/stai-mpu/stai_mpu_semantic_segmentation.py b/stai-mpu/stai_mpu_semantic_segmentation.py
index 68d554b..83fa895 100644
--- a/stai-mpu/stai_mpu_semantic_segmentation.py
+++ b/stai-mpu/stai_mpu_semantic_segmentation.py
@@ -566,8 +566,10 @@ class MainWindow(Gtk.Window):
if self.app.enable_camera_preview == True:
# camera preview => gst stream
self.video_widget = self.app.gst_widget
@ -23,7 +23,7 @@ index 882d197..3618360 100644
else :
# still picture => openCV picture
self.image = Gtk.Image()
@@ -821,12 +823,14 @@ class OverlayWindow(Gtk.Window):
@@ -804,12 +806,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()
@ -36,6 +36,6 @@ index 882d197..3618360 100644
- 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()

View File

@ -1,6 +1,6 @@
# Copyright (C) 2024, Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:"
FILESEXTRAPATHS:prepend := "${THISDIR}/../common:${THISDIR}/files:"
SRC_URI += " \
file://scripts/launch_npu_demo.sh \