Issues with custom model object-detection on STM32N6570-DK
I want to flash a custom object detection model on the STM32N6570-DK board. I followed these steps:
1-I selected the model ST_YOLOXN_D033_W025_416_INT8_OBJECT_DETECTION_COCO_2017_PERSON.TFLITE from ST Edge AI Cloud, with the following parameters: input: 1×416×416×3 (8-bit), output: multiple outputs, model type: STAI_FORMAT_U8. I then generated the corresponding C files.
2-I followed this path: ModelZoo service → application_code → object_detection → STM32N6 → Model → STM32N6570-DK, and replaced the original files with my custom model. The files I modified are:
- network.c
- network_ecblobs.h
- network_atonbuf.xSPI2.bin
- stai_network.c
- stai_network.h
3- In STM32CubeIDE, I configured the app.config.h file
#define POSTPROCESS_TYPE POSTPROCESS_OD_ST_YOLOX_UI
#define NN_HEIGHT (416)
#define NN_WIDTH (416)
#define NN_BPP (3)
#define COLOR_BGR (0)
#define COLOR_RGB (1)
#define COLOR_MODE COLOR_RGB
/* Classes */
#define NB_CLASSES (1)
#define CLASSES_TABLE const char* classes_table[NB_CLASSES] = {\
"person"}\
/* I/O configuration */
/* Postprocessing ST_YOLO_X configuration */
#define AI_OD_ST_YOLOX_PP_NB_CLASSES (1)
#define AI_OD_ST_YOLOX_PP_L_GRID_WIDTH (52) // Para 416x416
#define AI_OD_ST_YOLOX_PP_L_GRID_HEIGHT (52)
#define AI_OD_ST_YOLOX_PP_L_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_L_GRID_WIDTH * AI_OD_ST_YOLOX_PP_L_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_M_GRID_WIDTH (26)
#define AI_OD_ST_YOLOX_PP_M_GRID_HEIGHT (26)
#define AI_OD_ST_YOLOX_PP_M_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_M_GRID_WIDTH * AI_OD_ST_YOLOX_PP_M_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_S_GRID_WIDTH (13)
#define AI_OD_ST_YOLOX_PP_S_GRID_HEIGHT (13)
#define AI_OD_ST_YOLOX_PP_S_NB_INPUT_BOXES (AI_OD_ST_YOLOX_PP_S_GRID_WIDTH * AI_OD_ST_YOLOX_PP_S_GRID_HEIGHT)
#define AI_OD_ST_YOLOX_PP_NB_ANCHORS (3)
static const float32_t AI_OD_ST_YOLOX_PP_L_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {26.000000, 26.000000, 3.640000, 13.000000, 11.960000, 36.400000};
static const float32_t AI_OD_ST_YOLOX_PP_M_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {13.000000, 13.000000, 1.820000, 6.500000, 5.980000, 18.200000};
static const float32_t AI_OD_ST_YOLOX_PP_S_ANCHORS[2*AI_OD_ST_YOLOX_PP_NB_ANCHORS] = {6.500000, 6.500000, 0.910000, 3.250000, 2.990000, 9.100000};
#define AI_OD_ST_YOLOX_PP_IOU_THRESHOLD (0.5)
#define AI_OD_ST_YOLOX_PP_CONF_THRESHOLD (0.6)
#define AI_OD_ST_YOLOX_PP_MAX_BOXES_LIMIT (100)4-I opened STM32CubeProgrammer and flashed the model weights at address 0x7038000 using the MX66UW1G45G_STM32N6570-DK external loader. Then, I started debugging the STM32N6570-DK Getting Started Object Detection project.
However, during debugging, I encountered the following issues:
STM32N6570-DK_GettingStarted_ObjectDetection [STM32 C/C++ Application] arm-none-eabi-gdb (14.2.90.20240526)
Temporary breakpoint 1, main() at C:/ST/stm32ai-modelzoo-services-main/application_code/object_detection/STM32N6/Application/STM32N6570-DK/Src/main.c:265
MEMSYSCTL->MSCR |= MEMSYSCTL_MSCR_ICACTIVE_Msk;
After this, I selected the Resume boton to continue with the debug and then this happened:
Program received signal SIGTRAP, Trace/breakpoint trap.
HardFault_Handler() at C:/ST/stm32ai-modelzoo-services-main/application_code/object_detection/STM32N6/Application/STM32N6570-DK/Src/stm32n6xx_it.c:42
while (1)
I don't know what I'm doing wrong.
