OpenMV N6 -Yolo8n model trained with Ultralytics issues

I’ve trained a model YOLO8n with just one class ( person) to test with N& but I’ve two king of issues :
A) the output files that I’m tring to load into the ROMFS are “yolo_best_int8.tflite” quantized 8 bit and when I try to add into the ROMFS I got many errors ad described in the error log file attached , while the file “yolo_best_integer_quant.tflite” is processed by the ST Edge AI Core.
error_log.zip (5.1 MB)
B) tring to use the “yolo_best_integer_quant.tflite” model in this script I got the error "ESError[Error2]ENOENT "

# This work is licensed under the MIT license.
# Copyright (c) 2013-2025 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# TensorFlow Lite YOLO V8 Example
#
# This example runs a YOLO V8 person detection model.
#
# NOTE: This exaxmple requires an OpenMV Cam with an NPU like the AE3 or N6 to run real-time.

import csi
import time
import ml
from ml.postprocessing.ultralytics import YoloV8

# Initialize the sensor.
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.VGA)
csi0.window((400, 400))

# Load YOLO V8 model from ROM FS.
model = ml.Model("/rom/yolo_best_integer_quant.tflite", postprocess=YoloV8(threshold=0.4))
print(model)

# Visualization parameters.
n = len(model.labels)
model_class_colors = [(int(255 * i // n), int(255 * (n - i - 1) // n), 255) for i in range(n)]

clock = time.clock()
while True:
    clock.tick()
    img = csi0.snapshot()

    # boxes is a list of list per class of ((x, y, w, h), score) tuples
    boxes = model.predict([img])

    # Draw bounding boxes around the detected objects
    for i, class_detections in enumerate(boxes):
        rects = [r for r, score in class_detections]
        labels = [model.labels[i] for j in range(len(rects))]
        colors = [model_class_colors[i] for j in range(len(rects))]
        ml.utils.draw_predictions(img, rects, labels, colors, format=None)

    print(clock.fps(), "fps")

Where I’m wrong ? Do I’ve to train a Yolo8 instead than Yolo8n or whet else ?

Hi, the error output from running ST’s tools shows the model is completely not quantized:

C:/Program Files/OpenMv IDE470/share/qtcreator/stedgeai/Utilities/windows/stedgeai.exe generate --model C:\Yolo\runs\train\yolov8n_custom\weights\best_saved_model\yolo_best_int8.tflite --relocatable --target stm32n6 --st-neural-art default@neuralart.json
This command takes a while to execute. Please be patient.
ST Edge AI Core v2.1.0-20194 329b0e98d
WARNING: pad_0 is not quantized
WARNING: conv2d_1 is not quantized
WARNING: nl_2 is not quantized
WARNING: eltwise_3 is not quantized
WARNING: pad_4 is not quantized
WARNING: conv2d_5 is not quantized
WARNING: nl_6 is not quantized
WARNING: eltwise_7 is not quantized
WARNING: conv2d_8 is not quantized
WARNING: nl_9 is not quantized
WARNING: eltwise_10 is not quantized
WARNING: slice_12 is not quantized
WARNING: conv2d_13 is not quantized
WARNING: nl_14 is not quantized
WARNING: eltwise_15 is not quantized
WARNING: conv2d_16 is not quantized
WARNING: nl_17 is not quantized
WARNING: eltwise_18 is not quantized
WARNING: eltwise_19 is not quantized
WARNING: slice_11 is not quantized
WARNING: concat_20 is not quantized
WARNING: conv2d_21 is not quantized
WARNING: nl_22 is not quantized
WARNING: eltwise_23 is not quantized
WARNING: pad_24 is not quantized
WARNING: conv2d_25 is not quantized
WARNING: nl_26 is not quantized
WARNING: eltwise_27 is not quantized
WARNING: conv2d_28 is not quantized
WARNING: nl_29 is not quantized
WARNING: eltwise_30 is not quantized
WARNING: slice_32 is not quantized
WARNING: conv2d_33 is not quantized
WARNING: nl_34 is not quantized
WARNING: eltwise_35 is not quantized
WARNING: conv2d_36 is not quantized
WARNING: nl_37 is not quantized
WARNING: eltwise_38 is not quantized
WARNING: eltwise_39 is not quantized
WARNING: conv2d_40 is not quantized
WARNING: nl_41 is not quantized
WARNING: eltwise_42 is not quantized
WARNING: conv2d_43 is not quantized
WARNING: nl_44 is not quantized
WARNING: eltwise_45 is not quantized
WARNING: eltwise_46 is not quantized
WARNING: slice_31 is not quantized
WARNING: concat_47 is not quantized
WARNING: conv2d_48 is not quantized
WARNING: nl_49 is not quantized
WARNING: eltwise_50 is not quantized
WARNING: pad_51 is not quantized
WARNING: conv2d_52 is not quantized
WARNING: nl_53 is not quantized
WARNING: eltwise_54 is not quantized
WARNING: conv2d_55 is not quantized
WARNING: nl_56 is not quantized
WARNING: eltwise_57 is not quantized
WARNING: slice_59 is not quantized
WARNING: conv2d_60 is not quantized
WARNING: nl_61 is not quantized
WARNING: eltwise_62 is not quantized
WARNING: conv2d_63 is not quantized
WARNING: nl_64 is not quantized
WARNING: eltwise_65 is not quantized
WARNING: eltwise_66 is not quantized
WARNING: conv2d_67 is not quantized
WARNING: nl_68 is not quantized
WARNING: eltwise_69 is not quantized
WARNING: conv2d_70 is not quantized
WARNING: nl_71 is not quantized
WARNING: eltwise_72 is not quantized
WARNING: eltwise_73 is not quantized
WARNING: slice_58 is not quantized
WARNING: concat_74 is not quantized
WARNING: conv2d_75 is not quantized
WARNING: nl_76 is not quantized
WARNING: eltwise_77 is not quantized
WARNING: pad_78 is not quantized
WARNING: conv2d_79 is not quantized
WARNING: nl_80 is not quantized
WARNING: eltwise_81 is not quantized
WARNING: conv2d_82 is not quantized
WARNING: nl_83 is not quantized
WARNING: eltwise_84 is not quantized
WARNING: slice_86 is not quantized
WARNING: conv2d_87 is not quantized
WARNING: nl_88 is not quantized
WARNING: eltwise_89 is not quantized
WARNING: conv2d_90 is not quantized
WARNING: nl_91 is not quantized
WARNING: eltwise_92 is not quantized
WARNING: eltwise_93 is not quantized
WARNING: slice_85 is not quantized
WARNING: concat_94 is not quantized
WARNING: conv2d_95 is not quantized
WARNING: nl_96 is not quantized
WARNING: eltwise_97 is not quantized
WARNING: conv2d_98 is not quantized
WARNING: pool_99 is not quantized
WARNING: pool_100 is not quantized
WARNING: pool_101 is not quantized
WARNING: concat_102 is not quantized
WARNING: conv2d_103 is not quantized
WARNING: nl_104 is not quantized
WARNING: eltwise_105 is not quantized
WARNING: resize_106 is not quantized
WARNING: concat_107 is not quantized
WARNING: conv2d_108 is not quantized
WARNING: nl_109 is not quantized
WARNING: eltwise_110 is not quantized
WARNING: slice_112 is not quantized
WARNING: conv2d_113 is not quantized
WARNING: nl_114 is not quantized
WARNING: eltwise_115 is not quantized
WARNING: conv2d_116 is not quantized
WARNING: nl_117 is not quantized
WARNING: eltwise_118 is not quantized
WARNING: slice_111 is not quantized
WARNING: concat_119 is not quantized
WARNING: conv2d_120 is not quantized
WARNING: nl_121 is not quantized
WARNING: eltwise_122 is not quantized
WARNING: resize_123 is not quantized
WARNING: concat_124 is not quantized
WARNING: conv2d_125 is not quantized
WARNING: nl_126 is not quantized
WARNING: eltwise_127 is not quantized
WARNING: slice_129 is not quantized
WARNING: conv2d_130 is not quantized
WARNING: nl_131 is not quantized
WARNING: eltwise_132 is not quantized
WARNING: conv2d_133 is not quantized
WARNING: nl_134 is not quantized
WARNING: eltwise_135 is not quantized
WARNING: slice_128 is not quantized
WARNING: concat_136 is not quantized
WARNING: conv2d_137 is not quantized
WARNING: nl_138 is not quantized
WARNING: eltwise_139 is not quantized
WARNING: conv2d_238 is not quantized
WARNING: nl_239 is not quantized
WARNING: eltwise_240 is not quantized
WARNING: conv2d_241 is not quantized
WARNING: nl_242 is not quantized
WARNING: eltwise_243 is not quantized
WARNING: conv2d_244 is not quantized
WARNING: reshape_245 is not quantized
WARNING: conv2d_214 is not quantized
WARNING: nl_215 is not quantized
WARNING: eltwise_216 is not quantized
WARNING: conv2d_217 is not quantized
WARNING: nl_218 is not quantized
WARNING: eltwise_219 is not quantized
WARNING: conv2d_220 is not quantized
WARNING: transpose_221 is not quantized
WARNING: reshape_222 is not quantized
WARNING: pad_140 is not quantized
WARNING: conv2d_141 is not quantized
WARNING: nl_142 is not quantized
WARNING: eltwise_143 is not quantized
WARNING: concat_144 is not quantized
WARNING: conv2d_145 is not quantized
WARNING: nl_146 is not quantized
WARNING: eltwise_147 is not quantized
WARNING: slice_149 is not quantized
WARNING: conv2d_150 is not quantized
WARNING: nl_151 is not quantized
WARNING: eltwise_152 is not quantized
WARNING: conv2d_153 is not quantized
WARNING: nl_154 is not quantized
WARNING: eltwise_155 is not quantized
WARNING: slice_148 is not quantized
WARNING: concat_156 is not quantized
WARNING: conv2d_157 is not quantized
WARNING: nl_158 is not quantized
WARNING: eltwise_159 is not quantized
WARNING: conv2d_206 is not quantized
WARNING: nl_207 is not quantized
WARNING: eltwise_208 is not quantized
WARNING: conv2d_209 is not quantized
WARNING: nl_210 is not quantized
WARNING: eltwise_211 is not quantized
WARNING: conv2d_212 is not quantized
WARNING: reshape_213 is not quantized
WARNING: conv2d_197 is not quantized
WARNING: nl_198 is not quantized
WARNING: eltwise_199 is not quantized
WARNING: conv2d_200 is not quantized
WARNING: nl_201 is not quantized
WARNING: eltwise_202 is not quantized
WARNING: conv2d_203 is not quantized
WARNING: transpose_204 is not quantized
WARNING: reshape_205 is not quantized
WARNING: pad_160 is not quantized
WARNING: conv2d_161 is not quantized
WARNING: nl_162 is not quantized
WARNING: eltwise_163 is not quantized
WARNING: concat_164 is not quantized
WARNING: conv2d_165 is not quantized
WARNING: nl_166 is not quantized
WARNING: eltwise_167 is not quantized
WARNING: slice_169 is not quantized
WARNING: conv2d_170 is not quantized
WARNING: nl_171 is not quantized
WARNING: eltwise_172 is not quantized
WARNING: conv2d_173 is not quantized
WARNING: nl_174 is not quantized
WARNING: eltwise_175 is not quantized
WARNING: slice_168 is not quantized
WARNING: concat_176 is not quantized
WARNING: conv2d_177 is not quantized
WARNING: nl_178 is not quantized
WARNING: eltwise_179 is not quantized
WARNING: conv2d_189 is not quantized
WARNING: nl_190 is not quantized
WARNING: eltwise_191 is not quantized
WARNING: conv2d_192 is not quantized
WARNING: nl_193 is not quantized
WARNING: eltwise_194 is not quantized
WARNING: conv2d_195 is not quantized
WARNING: reshape_196 is not quantized
WARNING: concat_246 is not quantized
WARNING: nl_247 is not quantized
WARNING: conv2d_180 is not quantized
WARNING: nl_181 is not quantized
WARNING: eltwise_182 is not quantized
WARNING: conv2d_183 is not quantized
WARNING: nl_184 is not quantized
WARNING: eltwise_185 is not quantized
WARNING: conv2d_186 is not quantized
WARNING: transpose_187 is not quantized
WARNING: reshape_188 is not quantized
WARNING: concat_223 is not quantized
WARNING: reshape_224 is not quantized
WARNING: transpose_225 is not quantized
WARNING: nl_226 is not quantized
WARNING: conv2d_227 is not quantized
WARNING: reshape_228 is not quantized
WARNING: eltwise_229 is not quantized
WARNING: reshape_230 is not quantized
WARNING: slice_233 is not quantized
WARNING: eltwise_234 is not quantized
WARNING: slice_231 is not quantized
WARNING: eltwise_232 is not quantized
WARNING: eltwise_237 is not quantized
WARNING: eltwise_235 is not quantized
WARNING: eltwise_236 is not quantized
WARNING: concat_248 is not quantized
 >>>> EXECUTING NEURAL ART COMPILER
   C:/Program Files/OpenMv IDE470/share/qtcreator/stedgeai/Utilities/windows/atonn.exe -i "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_output/yolo_best_int8_OE_3_2_0.onnx" --json-quant-file "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_output/yolo_best_int8_OE_3_2_0_Q.json" -g "network.c" --load-mdesc "C:/Program Files/OpenMv IDE470/share/qtcreator/stedgeai/Utilities/configs/stm32n6.mdesc" --load-mpool "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/stm32n6.mpool" --save-mpool-file "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_ws/neural_art__network/stm32n6.mpool" --out-dir-prefix "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_ws/neural_art__network/" --native-float --cache-maintenance --Ocache-opt --enable-virtual-mem-pools --Os --Oauto-sched --all-buffers-info --csv-file "network.csv" --enable-epoch-controller --optimization 3 --output-info-file "c_info.json"
      >>> Shell execution has FAILED (returned code = 1)
      $ C:\Program Files\OpenMv IDE470\share\qtcreator\stedgeai\Utilities\windows\atonn.exe -i C:\Users\User\AppData\Local\Temp\OpenMVIDE-aYHOqZ\st_ai_output\yolo_best_int8_OE_3_2_0.onnx --json-quant-file C:\Users\User\AppData\Local\Temp\OpenMVIDE-aYHOqZ\st_ai_output\yolo_best_int8_OE_3_2_0_Q.json -g network.c --load-mdesc C:\Program Files\OpenMv IDE470\share\qtcreator\stedgeai\Utilities\configs\stm32n6.mdesc --load-mpool C:\Users\User\AppData\Local\Temp\OpenMVIDE-aYHOqZ\stm32n6.mpool --save-mpool-file C:\Users\User\AppData\Local\Temp\OpenMVIDE-aYHOqZ\st_ai_ws\neural_art__network\stm32n6.mpool --out-dir-prefix C:\Users\User\AppData\Local\Temp\OpenMVIDE-aYHOqZ\st_ai_ws\neural_art__network/ --native-float --cache-maintenance --Ocache-opt --enable-virtual-mem-pools --Os --Oauto-sched --all-buffers-info --csv-file network.csv --enable-epoch-controller --optimization 3 --output-info-file c_info.json
      saving memory pool description "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_ws/neural_art__network/stm32n6.mpool"
      Warning: Oauto did not find valid compile options: aborting
      <<<
   E103(CliRuntimeError): Error calling the Neural Art compiler - ['', 'saving memory pool description "C:/Users/User/AppData/Local/Temp/OpenMVIDE-aYHOqZ/st_ai_ws/neural_art__network/stm32n6.mpool"', 'Warning: Oauto did not find valid compile options: aborting']
Failure - Press Cancel to close the window

Then, unless the model was written back to ROMFS it’s not going to be under /rom/yolo_best_integer_quant.tflite

How did you retrain the model?

I’ve used this python script developed with Claude AI.It use Ultralytivs module. Is just a tentative to train a models without use Robotflow or Edge Impulse.
train_yolov8_v3.py (12.6 KB)

Hi Bob,

If you’re now using EdgeImpulse or Roboflow it’s going to be hard to get this working. However, ST has published a lot of material: GitHub - STMicroelectronics/stm32ai-modelzoo-services: AI Model Zoo services for STM32 devices · GitHub