Skip to content

Commit ab403e4

Browse files
GHORTESSTMGitHub Enterprise
authored andcommitted
Update to v2.1.0
- Upgrade to STEdgeAI 3.0.0
1 parent 133c80e commit ab403e4

File tree

270 files changed

+230050
-112142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+230050
-112142
lines changed

Application/NUCLEO-H743ZI2/Inc/ai_interface.h

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
******************************************************************************
33
* @file ai_interface.h
4-
* @author MDG Application Team
4+
* @author MCD Application Team
55
* @brief Header for ai_interface.c module
66
******************************************************************************
77
* @attention
88
*
9-
* Copyright (c) 2023 STMicroelectronics.
9+
* Copyright (c) 2019 STMicroelectronics.
1010
* All rights reserved.
1111
*
1212
* This software is licensed under terms that can be found in the LICENSE file
@@ -28,23 +28,36 @@ extern "C"
2828
/* Includes ------------------------------------------------------------------*/
2929
#include "network.h"
3030
#include "network_data.h"
31+
#include "ai_platform.h"
3132

3233
/* Exported macros -----------------------------------------------------------*/
33-
#define AI_NET_INPUT_SIZE AI_NETWORK_IN_1_SIZE
34-
#define AI_NET_INPUT_SIZE_BYTES AI_NETWORK_IN_1_SIZE_BYTES
34+
#define AI_NET_INPUT_SIZE STAI_NETWORK_IN_1_SIZE
35+
#define AI_NET_INPUT_SIZE_BYTES STAI_NETWORK_IN_1_SIZE_BYTES
3536

36-
#define AI_NET_OUTPUT_SIZE AI_NETWORK_OUT_1_SIZE
37-
#define AI_NET_OUTPUT_SIZE_BYTES AI_NETWORK_OUT_1_SIZE_BYTES
37+
#define AI_NET_OUTPUT_SIZE STAI_NETWORK_OUT_1_SIZE
38+
#define AI_NET_OUTPUT_SIZE_BYTES STAI_NETWORK_OUT_1_SIZE_BYTES
39+
#define AI_ACTIVATION_SIZE_BYTES_TOTAL STAI_NETWORK_ACTIVATIONS_SIZE_BYTES
40+
#define AI_ACTIVATION_SIZE_BYTES STAI_NETWORK_ACTIVATIONS_SIZE
41+
#define AI_ACTIVATION_1_SIZE_BYTES STAI_NETWORK_ACTIVATION_1_SIZE
42+
#define AI_ACTIVATION_2_SIZE_BYTES STAI_NETWORK_ACTIVATION_2_SIZE
43+
#define AI_ACTIVATION_3_SIZE_BYTES STAI_NETWORK_ACTIVATION_3_SIZE
44+
#define AI_ACTIVATION_BUFFERS_COUNT STAI_NETWORK_ACTIVATIONS_NUM
3845

39-
#define AI_ACTIVATION_SIZE_BYTES AI_NETWORK_DATA_ACTIVATIONS_SIZE
40-
#define AI_WEIGHT_SIZE_BYTES AI_NETWORK_DATA_WEIGHTS_SIZE
46+
/*** @GENERATED CODE START - DO NOT TOUCH@ ***/
47+
#define AI_NETWORK_INPUTS_IN_ACTIVATIONS_INDEX 0
48+
#define AI_NETWORK_INPUTS_IN_ACTIVATIONS_SIZE AI_ACTIVATION_1_SIZE_BYTES
49+
50+
/*** @GENERATED CODE STOP - DO NOT TOUCH@ ***/
51+
52+
53+
#define AI_WEIGHT_SIZE_BYTES STAI_NETWORK_WEIGHTS_SIZE_BYTES
4154

4255
#define AI_NETWORK_IN_SHIFT 1
4356
#define AI_NETWORK_OUT_SHIFT 7
4457

45-
#define AI_NETWORK_WIDTH AI_NETWORK_IN_1_WIDTH
46-
#define AI_NETWORK_HEIGHT AI_NETWORK_IN_1_HEIGHT
47-
#define AI_NETWORK_CHANNEL AI_NETWORK_IN_1_CHANNEL
58+
#define AI_NETWORK_WIDTH STAI_NETWORK_IN_1_WIDTH
59+
#define AI_NETWORK_HEIGHT STAI_NETWORK_IN_1_HEIGHT
60+
#define AI_NETWORK_CHANNEL STAI_NETWORK_IN_1_CHANNEL
4861

4962
/*********Quantization scheme******************/
5063
#define AI_FXP_Q (0x0) /*Fixed Point Qm,n*/
@@ -60,12 +73,12 @@ ai_float ai_get_output_scale(void);
6073
ai_i32 ai_get_output_zero_point(void);
6174
uint32_t ai_get_input_quantization_scheme(void);
6275
uint32_t ai_get_output_quantization_scheme(void);
63-
ai_size ai_get_output_format(void);
64-
ai_size ai_get_input_format(void);
76+
stai_format ai_get_output_format(void);
77+
stai_format ai_get_input_format(void);
6578

66-
void ai_init(void*, ai_handle*, ai_handle*);
79+
void ai_init(uint8_t** activation_buffer, stai_ptr* inputs_buff_Ptr, stai_ptr* outputs_buff_Ptr);
6780
void ai_deinit(void);
68-
void ai_run(void*, void*);
81+
void ai_run(void);
6982

7083
#ifdef __cplusplus
7184
}

Application/NUCLEO-H743ZI2/Inc/main.h

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
******************************************************************************
33
* @file main.h
4-
* @author MDG Application Team
4+
* @author MCD Application Team
55
* @brief Header for main.c module for Cortex-M7.
66
******************************************************************************
77
* @attention
88
*
9-
* Copyright (c) 2023 STMicroelectronics.
9+
* Copyright (c) 2021 STMicroelectronics.
1010
* All rights reserved.
1111
*
1212
* This software is licensed under terms that can be found in the LICENSE file
@@ -33,15 +33,14 @@
3333

3434
#include "ai_model_config.h"
3535

36-
/* Exported macro ------------------------------------------------------------*/
37-
#define WELCOME_MSG_0 AI_NETWORK_ORIGIN_MODEL_NAME
36+
#define WELCOME_MSG_0 STAI_NETWORK_ORIGIN_MODEL_NAME
3837
#define WELCOME_MSG_1 "Model Running in STM32 MCU internal memory"
3938

40-
#if defined (AI_NETWORK_INPUTS_IN_ACTIVATIONS) && defined (AI_NETWORK_OUTPUTS_IN_ACTIVATIONS)
39+
#if (STAI_NETWORK_FLAGS & STAI_FLAG_OUTPUTS) == STAI_FLAG_OUTPUTS && (STAI_NETWORK_FLAGS & STAI_FLAG_INPUTS) == STAI_FLAG_INPUTS
4140
#define WELCOME_MSG_2 "NN Input and Ouput buffers in Activation"
42-
#elif defined (AI_NETWORK_INPUTS_IN_ACTIVATIONS)
41+
#elif (STAI_NETWORK_FLAGS & STAI_FLAG_INPUTS) == STAI_FLAG_INPUTS
4342
#define WELCOME_MSG_2 "NN Input buffer in Activation"
44-
#elif defined (AI_NETWORK_OUTPUTS_IN_ACTIVATIONS)
43+
#elif (STAI_NETWORK_FLAGS & STAI_FLAG_OUTPUTS) == STAI_FLAG_OUTPUTS
4544
#define WELCOME_MSG_2 "NN Output buffer in Activation"
4645
#else
4746
#define WELCOME_MSG_2 "NN Input/Output in dedicated buffers "
@@ -69,6 +68,7 @@
6968

7069
#define NN_OUTPUT_CLASS_NUMBER AI_NET_OUTPUT_SIZE
7170

71+
7272
/****************************/
7373
/***CAMERA related defines***/
7474
/****************************/
@@ -227,10 +227,11 @@ typedef enum
227227
FRAME_PFC = 0x02,
228228
FRAME_PVC = 0x03,
229229
FRAME_INFERENCE = 0x04,
230-
231-
APP_FRAMEOPERATION_NUM
230+
231+
APP_FRAMEOPERATION_NUM
232232
} AppFrameOperation_TypeDef;
233233

234+
/* Exported types ------------------------------------------------------------*/
234235
typedef struct
235236
{
236237
uint16_t x;
@@ -239,52 +240,52 @@ uint32_t rowStride;
239240
} Dma2dCfg_TypeDef;
240241

241242
typedef struct
242-
{
243+
{
243244
/**NN Output**/
244245
uint32_t nn_inference_time;
245246
char const* nn_top1_output_class_name;
246247
float nn_top1_output_class_proba;
247248
int ranking[NN_OUTPUT_CLASS_NUMBER];
248-
249+
249250
/**Camera context**/
250251
volatile uint8_t new_frame_ready;
251252
uint32_t mirror_flip;
252253
uint32_t cropping_enable;
253-
254+
254255
/**Pre-Processing context**/
255256
uint32_t red_blue_swap;
256257
uint32_t PixelFormatConv;
257-
258+
258259
/**Display context**/
259260
volatile uint32_t lcd_sync;
260-
261+
261262
/**Utility context**/
262263
uint32_t Tinf_start;
263264
uint32_t Tinf_stop;
264265
uint32_t Tfps_start;
265266
uint32_t Tfps_stop;
266-
267+
267268
/**AI NN context**/
268269
uint8_t* lut;
269-
uint32_t nn_input_type;
270+
uint32_t nn_input_type;
270271
uint32_t nn_output_type;
271272
const char** nn_output_labels;
272-
273+
273274
/**Application buffers**/
274-
void* nn_output_buffer;
275-
void* nn_input_buffer;
276-
void* activation_buffer;
275+
void* nn_output_buffer[STAI_NETWORK_OUT_NUM];
276+
void* nn_input_buffer[STAI_NETWORK_IN_NUM];
277+
uint8_t* activation_buffer[AI_ACTIVATION_BUFFERS_COUNT];
277278
uint8_t* rescaled_image_buffer;
278279
uint8_t* camera_capture_buffer;
279280
uint8_t* camera_capture_buffer_no_borders;
280281
uint8_t *lcd_frame_buff; /* Only one buffer is used for output to save RAM */
281-
282-
} AppConfig_TypeDef;
283282

284-
/* Exported variables -------------------------------------------------------*/
285-
extern uint8_t NN_Activation_Buffer[];
283+
}AppConfig_TypeDef;
286284

287-
/* Exported functions --------------------------------------------------------*/
285+
/* Exported types ------------------------------------------------------------*/
286+
/* Exported constants --------------------------------------------------------*/
287+
/* Exported macro ------------------------------------------------------------*/
288+
/* Exported functions ------------------------------------------------------- */
288289
extern void Error_Handler(void);
289290

290291
#endif /* __MAIN_H */

0 commit comments

Comments
 (0)