imx-machine-learning: check vela return code

Return an error in case any of the models could not be converted.

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

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2024-12-18 07:15:50 +01:00
parent 25f4fa7641
commit 8ad093c37b
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Tue, 17 Dec 2024 18:34:48 +0100
Subject: [PATCH] check vela return code
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
download_models.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/download_models.py b/download_models.py
index 462f7b755eea..fc5ab234ae47 100644
--- a/download_models.py
+++ b/download_models.py
@@ -103,7 +103,11 @@ def convert_model(model_dir, vela_dir):
if name.endswith(".tflite"):
print('Converting', name)
model = os.path.join(model_dir, name)
- os.system('vela ' + model + " --output-dir " + vela_dir)
+ ret = os.system('vela ' + model + " --output-dir " + vela_dir)
+ if ret != 0:
+ print(f"Error: Failed to convert model {name} with vela")
+ import sys
+ sys.exit(1)
model_dir = 'models'
vela_dir = 'vela_models'

View File

@ -11,6 +11,7 @@ VELA_MODELS_DIR = "vela_models"
SRC_URI += " \
file://0001-Customize-EiQ-demos.patch \
file://0002-improvements-capture-x-windows-and-increase-resoluti.patch \
file://0003-check-vela-return-code.patch \
file://scripts/launch_eiq_demo.sh \
file://service/eiqdemo.service \
"