Skip to content

Commit f2ff28a

Browse files
committed
Version v2.0.0
1 parent b45cf87 commit f2ff28a

File tree

267 files changed

+32343
-23442
lines changed

Some content is hidden

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

267 files changed

+32343
-23442
lines changed

Binary/network_data.hex

Lines changed: 61 additions & 738 deletions
Large diffs are not rendered by default.

Binary/x-cube-n6-ai-power-measurement.hex

Lines changed: 11081 additions & 10965 deletions
Large diffs are not rendered by default.

EWARM/Project.ewd renamed to EWARM/x-cube-n6-ai-power-measurement.ewd

Lines changed: 1619 additions & 1619 deletions
Large diffs are not rendered by default.

EWARM/Project.ewp renamed to EWARM/x-cube-n6-ai-power-measurement.ewp

Lines changed: 1440 additions & 1397 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<workspace>
3-
<project>
4-
<path>$WS_DIR$\Project.ewp</path>
5-
</project>
6-
</workspace>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<workspace>
3+
<project>
4+
<path>$WS_DIR$\x-cube-n6-ai-power-measurement.ewp</path>
5+
</project>
6+
</workspace>

Inc/app_cam.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
******************************************************************************
3-
* @file cam_vd55g1.h
3+
* @file app_cam.h
44
* @author GPM Application Team
55
*
66
******************************************************************************
@@ -15,8 +15,8 @@
1515
*
1616
******************************************************************************
1717
*/
18-
#ifndef CAM_CAMERA
19-
#define CAM_CAMERA
18+
#ifndef APP_CAM_H
19+
#define APP_CAM_H
2020

2121
#define CAMERA_FPS 30
2222

@@ -30,4 +30,4 @@ void CAM_IspUpdate(void);
3030
void CAM_Sensor_Start(void);
3131
void CAM_Sensor_Stop(void);
3232

33-
#endif
33+
#endif /* APP_CAM_H */

Inc/app_config.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676
"person", "not_person"}
7777

7878
/* I/O configuration */
79-
#define AI_OBJDETECT_YOLOV2_PP_NB_CLASSES (1)
80-
#define AI_OBJDETECT_YOLOV2_PP_NB_ANCHORS (5)
81-
#define AI_OBJDETECT_YOLOV2_PP_GRID_WIDTH (7)
82-
#define AI_OBJDETECT_YOLOV2_PP_GRID_HEIGHT (7)
83-
#define AI_OBJDETECT_YOLOV2_PP_NB_INPUT_BOXES (AI_OBJDETECT_YOLOV2_PP_GRID_WIDTH * AI_OBJDETECT_YOLOV2_PP_GRID_HEIGHT)
79+
#define AI_OD_YOLOV2_PP_NB_CLASSES (1)
80+
#define AI_OD_YOLOV2_PP_NB_ANCHORS (5)
81+
#define AI_OD_YOLOV2_PP_GRID_WIDTH (7)
82+
#define AI_OD_YOLOV2_PP_GRID_HEIGHT (7)
83+
#define AI_OD_YOLOV2_PP_NB_INPUT_BOXES (AI_OD_YOLOV2_PP_GRID_WIDTH * AI_OD_YOLOV2_PP_GRID_HEIGHT)
8484

8585
/* Anchor boxes */
86-
static const float32_t AI_OBJDETECT_YOLOV2_PP_ANCHORS[2*AI_OBJDETECT_YOLOV2_PP_NB_ANCHORS] = {
86+
static const float32_t AI_OD_YOLOV2_PP_ANCHORS[2*AI_OD_YOLOV2_PP_NB_ANCHORS] = {
8787
0.9883000000f, 3.3606000000f,
8888
2.1194000000f, 5.3759000000f,
8989
3.0520000000f, 9.1336000000f,
@@ -92,8 +92,8 @@ static const float32_t AI_OBJDETECT_YOLOV2_PP_ANCHORS[2*AI_OBJDETECT_YOLOV2_PP_N
9292
};
9393

9494
/* -------- Tuning below can be modified by the application --------- */
95-
#define AI_OBJDETECT_YOLOV2_PP_CONF_THRESHOLD (0.6f)
96-
#define AI_OBJDETECT_YOLOV2_PP_IOU_THRESHOLD (0.3f)
97-
#define AI_OBJDETECT_YOLOV2_PP_MAX_BOXES_LIMIT (10)
95+
#define AI_OD_YOLOV2_PP_CONF_THRESHOLD (0.6f)
96+
#define AI_OD_YOLOV2_PP_IOU_THRESHOLD (0.3f)
97+
#define AI_OD_YOLOV2_PP_MAX_BOXES_LIMIT (10)
9898

9999
#endif

Inc/postprocess_conf.h

Lines changed: 0 additions & 56 deletions
This file was deleted.

LICENSE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| Component | Copyright | License |
2+
|:--------- |:---------- |:------- |
3+
| CMSIS | Arm Limited | Apache-2.0 |
4+
| STM32N6xx CMSIS | ARM Limited, STMicroelectronics | Apache-2.0 |
5+
| STM32N6xx HAL/LL Drivers | STMicroelectronics | BSD-3-Clause |
6+
| STM32N6570-DK BSP Drivers | STMicroelectronics | BSD-3-Clause |
7+
| BSP Component aps256xx | STMicroelectronics | BSD-3-Clause |
8+
| BSP Component Common | STMicroelectronics | BSD-3-Clause |
9+
| BSP Component mx66uw1g45g | STMicroelectronics | BSD-3-Clause |
10+
| BSP Component rk050hr18 | STMicroelectronics | BSD-3-Clause |
11+
| Inc | STMicroelectronics | SLA0044 |
12+
| Src | STMicroelectronics | SLA0044 |
13+
| Lib/Camera_Middleware | STMicroelectronics | SLA0044 |
14+
| Lib/Camera_Middleware/sensors | STMicroelectronics | BSD-3-Clause |
15+
| Lib/Camera_Middleware/ISP_Library | LACROIX - Impulse, STMicroelectronics | SLA0044 |
16+
| Lib/lib_vision_models_pp/lib_vision_models_pp | STMicroelectronics | SLA0044 |
17+
| Lib/AI_Runtime | STMicroelectronics | SLA0044 |
18+
| Binary | STMicroelectronics | SLA0044 |
19+
| Model | STMicroelectronics | SLA0044 |
20+
| Utilities/pwr_scripts | STMicroelectronics | SLA0044 |

Lib/AI_Runtime/Inc/ai_math_helpers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ AI_INTERFACE_ENTRY void ai_not_equal_buffer_u8(ai_handle out, const ai_handle a,
564564
AI_INTERFACE_ENTRY void ai_squared_diff(ai_handle out, const ai_handle a, const ai_handle b);
565565
AI_INTERFACE_ENTRY void ai_squared_diff_buffer(ai_handle out, const ai_handle a, const ai_handle b, const ai_size loop);
566566

567+
AI_INTERFACE_ENTRY void ai_atan2(ai_handle out, const ai_handle a, const ai_handle b);
568+
AI_INTERFACE_ENTRY void ai_atan2_buffer(ai_handle out, const ai_handle a, const ai_handle b, const ai_size loop);
569+
567570
AI_API_DECLARE_END
568571

569572
#endif /* AI_MATH_HELPERS_H */

Lib/AI_Runtime/Inc/ai_platform.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,16 @@ typedef struct ai_network_report_ {
830830
ai_signature signature;
831831
} ai_network_report;
832832

833+
/*!
834+
* @enum ai_scatter_nd_reduction
835+
* @ingroup ai_platform
836+
* @brief reduction operation in scatter_nd layer
837+
*/
838+
typedef enum {
839+
AI_SCATTER_ND_NONE = 0x0,
840+
AI_SCATTER_ND_OPERATION
841+
} ai_scatter_nd_reduction;
842+
833843
/*!
834844
* @enum ai_upsample_mode
835845
* @ingroup ai_platform

Lib/AI_Runtime/Inc/core_benchmark.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ ai_bool core_timer_start(core_timer* t);
7272
AI_INTERNAL_API
7373
core_timer_ts core_timer_stop(core_timer* t);
7474

75+
#if defined HAS_STM32
76+
void core_timer_init_(void);
77+
core_timer_ts core_timer_ticks_start_(void);
78+
core_timer_ts core_timer_ticks_(void);
79+
#endif
80+
7581
AI_API_DECLARE_END
7682

7783
#endif /*CORE_BENCHMARK_H_*/

Lib/AI_Runtime/Inc/core_datatypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define AI_PLATFORM_RUNTIME_MAJOR (10)
3434
#endif
3535
#ifndef AI_PLATFORM_RUNTIME_MINOR
36-
#define AI_PLATFORM_RUNTIME_MINOR (0)
36+
#define AI_PLATFORM_RUNTIME_MINOR (1)
3737
#endif
3838
#ifndef AI_PLATFORM_RUNTIME_MICRO
3939
#define AI_PLATFORM_RUNTIME_MICRO (0)

Lib/AI_Runtime/Inc/layers_common.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ const char* ai_layer_type_name(const ai_layer_type type);
219219
AI_INTERNAL_API
220220
ai_bool ai_layer_type_is_valid(const ai_layer_type type);
221221

222-
#ifdef HAS_AI_ASSERT
223222

224223
/*!
225224
* @brief check scratch size computed with actual scratch buffer size
@@ -248,6 +247,7 @@ void ai_layer_check_scratch_size( ai_layer_type layer_type, ai_array_format fmt,
248247
ai_bool is_sssa, ai_u32 tensor_scratch_size_bytes,
249248
const char *p_function_name, const int line_nb);
250249

250+
#ifdef HAS_AI_ASSERT
251251
#define CHECK_SCRATCH_BUFFER_SIZE( layer_type, fmt, \
252252
filt_width, filt_height, \
253253
n_channel_in, n_channel_out, \
@@ -261,7 +261,15 @@ void ai_layer_check_scratch_size( ai_layer_type layer_type, ai_array_format fmt,
261261
is_depthwise, is_ch1st, is_ch_wise, \
262262
is_sssa_ch, tensor_scratch_size_bytes, \
263263
__FUNCTION__, __LINE__);
264-
264+
#else
265+
#define CHECK_SCRATCH_BUFFER_SIZE( layer_type, fmt, \
266+
filt_width, filt_height, \
267+
n_channel_in, n_channel_out, \
268+
is_pointwise, is_rgb, \
269+
is_depthwise, is_ch1st, is_ch_wise, \
270+
is_sssa_ch, tensor_scratch_size_bytes) \
271+
AI_WRAP_FUNC(/*NULL*/)
272+
#endif
265273
#define IS_PW 1
266274
#define IS_RGB 1
267275
#define IS_DW 1
@@ -276,7 +284,6 @@ void ai_layer_check_scratch_size( ai_layer_type layer_type, ai_array_format fmt,
276284
#define NOT_CH_WISE 0
277285
#define NOT_SSSA_CH 0
278286

279-
#endif
280287

281288
AI_API_DECLARE_END
282289

Lib/AI_Runtime/Inc/layers_conv2d.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,14 @@ void forward_conv2d_is8os8ws8_sssa_ch(ai_layer *pLayer);
253253
AI_INTERNAL_API
254254
void forward_dw_sssa8_ch(ai_layer *pLayer);
255255

256+
/*!
257+
* @brief Computes the activations of a int8 quantized DW layer
258+
* for SSSA per channel quantized scheme Optimized for HSP
259+
* @ingroup layers_conv2d
260+
* @param layer the convolutional (conv) layer
261+
*/
262+
AI_INTERNAL_API
263+
void forward_dw_hsp_1step_sssa8_ch(ai_layer *pLayer);
256264

257265
/*!
258266
* @brief Computes the activations of a int8 quantized DW layer
@@ -263,6 +271,15 @@ void forward_dw_sssa8_ch(ai_layer *pLayer);
263271
AI_INTERNAL_API
264272
void forward_dw_hsp_sssa8_ch(ai_layer *pLayer);
265273

274+
/*!
275+
* @brief Computes the activations of a int8 quantized DW layer
276+
* for SSSA per channel quantized scheme Optimized for HSP
277+
* @ingroup layers_conv2d
278+
* @param layer the convolutional (conv) layer
279+
*/
280+
AI_INTERNAL_API
281+
void forward_dw_hsp_3step_sssa8_ch(ai_layer *pLayer);
282+
266283
/*!
267284
* @brief Computes the activations of a int8 quantized DW layer
268285
* for SSSA per channel quantized scheme, with 3x3 kernels
@@ -328,6 +345,26 @@ void forward_pw_sssa8_ch(ai_layer *pLayer);
328345
AI_INTERNAL_API
329346
void forward_pw_hsp_sssa8_ch(ai_layer *pLayer);
330347

348+
/*!
349+
* @brief Computes the activations of a int8 quantized PW layer
350+
* for SSSA per channel quantized scheme. Optimized for HSP
351+
* 1Step version (nb input channel <= 4)
352+
* @ingroup layers_conv2d
353+
* @param layer the convolutional (conv) layer
354+
*/
355+
AI_INTERNAL_API
356+
void forward_pw_hsp_1step_sssa8_ch(ai_layer *pLayer);
357+
358+
/*!
359+
* @brief Computes the activations of a int8 quantized PW layer
360+
* for SSSA per channel quantized scheme. Optimized for HSP
361+
* 3 Step variant
362+
* @ingroup layers_conv2d
363+
* @param layer the convolutional (conv) layer
364+
*/
365+
AI_INTERNAL_API
366+
void forward_pw_hsp_3step_sssa8_ch(ai_layer *pLayer);
367+
331368
/*!
332369
* @brief Computes the activations of a int8 quantized dilated Conv2d layer
333370
* for SSSA per channel quantized scheme (valid padding)
@@ -373,9 +410,15 @@ void forward_conv2d_sssa8_ch(ai_layer *pLayer);
373410
* @ingroup layers_conv2d
374411
* @param layer the convolutional (conv) layer
375412
*/
413+
AI_INTERNAL_API
414+
void forward_conv2d_hsp_1step_sssa8_ch(ai_layer *pLayer);
415+
376416
AI_INTERNAL_API
377417
void forward_conv2d_hsp_sssa8_ch(ai_layer *pLayer);
378418

419+
AI_INTERNAL_API
420+
void forward_conv2d_hsp_3step_sssa8_ch(ai_layer *pLayer);
421+
379422

380423
/*!
381424
* @brief Computes the activations of a int8 quantized Conv2d layer
@@ -639,6 +682,15 @@ void forward_dense_integer_SSSA(ai_layer *pLayer);
639682
AI_INTERNAL_API
640683
void forward_dense_hsp_sssa8(ai_layer *pLayer);
641684

685+
/*!
686+
* @brief Computes the activations of a integer dense (fully connected) layer
687+
* for SSSA per layer quantized scheme Optimized for HSP, 3Step loop (out_ch)
688+
* @ingroup layers_dense
689+
* @param layer the dense layer
690+
*/
691+
AI_INTERNAL_API
692+
void forward_dense_hsp_3step_sssa8(ai_layer *pLayer);
693+
642694
/*!
643695
* @brief Computes the activations of a integer dense (fully connected) layer
644696
* for SSSA per channel quantized scheme: HSP variant

Lib/AI_Runtime/Inc/layers_generic.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ typedef AI_ALIGNED_TYPE(struct, 4) ai_layer_tile_{
140140
AI_CONST ai_array* repeats; /*!< numbers of repeated copies along each dimension */
141141
} ai_layer_tile;
142142

143-
144143
/*!
145144
* @struct ai_layer_shape
146145
* @ingroup layers generic
@@ -368,6 +367,22 @@ typedef AI_ALIGNED_TYPE(struct, 4) ai_layer_eltwise_integer_ {
368367
func_buffer_binary_integer buffer_operation; /*!< operation to apply elementwise */
369368
} ai_layer_eltwise_integer;
370369

370+
/*!
371+
* @struct ai_layer_scatter_nd
372+
* @ingroup layers_generic
373+
* @brief ScatterND layer definition
374+
*
375+
* This layer defines the params of a scattering layer (ND). It is intended to be used
376+
* by his associated forward function @ref forward_scatter_nd
377+
*/
378+
typedef AI_ALIGNED_TYPE(struct, 4) ai_layer_scatter_nd_ {
379+
AI_LAYER_COMMON_FIELDS_DECLARE
380+
ai_tensor* indices; /*!< Indices of corrisponding slices of inputs*/
381+
ai_tensor* updates; /*!< Updates of corrisponding slices of inputs*/
382+
func_binary operation; /*!< operation to apply elementwise */
383+
ai_scatter_nd_reduction reduction; /*!< Reduction operation in ScatterND layer*/
384+
} ai_layer_scatter_nd;
385+
371386
/*!
372387
* @struct ai_layer_reduce
373388
* @ingroup layers_generic
@@ -589,6 +604,14 @@ void forward_gather_nd(ai_layer* layer);
589604
AI_INTERNAL_API
590605
void forward_gather_nd_channel_first(ai_layer* layer);
591606

607+
/*!
608+
* @brief ScatterND an input tensor
609+
* @ingroup layers_generic
610+
* @param layer the scattered layer (ND)
611+
*/
612+
AI_INTERNAL_API
613+
void forward_scatter_nd(ai_layer* layer);
614+
592615
/*!
593616
* @brief Slice an input tensors
594617
* @ingroup layers_generic

Lib/AI_Runtime/Inc/layers_list.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ LAYER_ENTRY(POOL_DQNN, LAYER_ID(49), pool_dqnn, forward_maxpool_is1os1, NULL, NU
142142
LAYER_ENTRY(DENSE_DQNN, LAYER_ID(50), dense_dqnn, forward_dense_is1os1ws1, NULL, NULL)
143143
/*!< Reverse layer */
144144
LAYER_ENTRY(REVERSE, LAYER_ID(51), reverse, forward_reverse, NULL, NULL)
145+
/*!< ScatterND layer */
146+
LAYER_ENTRY(SCATTER_ND, LAYER_ID(69), scatter_nd, forward_scatter_nd, NULL, NULL)
145147

146148
/*!< TFLite wrapper */
147149
LAYER_ENTRY(TFLITE_WRAPPER, LAYER_ID(52), tflite_wrapper, NULL, NULL, NULL)

0 commit comments

Comments
 (0)