39 #if !defined(__MTB_ML_MODEL_H__) 40 #define __MTB_ML_MODEL_H__ 42 #include "mtb_ml_common.h" 43 #include "mtb_ml_model_defs.h" 45 #if defined(__cplusplus) 52 #define MEM_FLAG_SHIFT_PERSISTENT (0) 53 #define MEM_FLAG_SHIFT_SCRATCH (1) 55 #define MTB_ML_MEM_DYNAMIC_PERSISTENT (1 << MEM_FLAG_SHIFT_PERSISTENT) 56 #define MTB_ML_MEM_DYNAMIC_SCRATCH (1 << MEM_FLAG_SHIFT_SCRATCH) 58 #define MTB_ML_MODEL_NAME_LEN 64 94 char name[MTB_ML_MODEL_NAME_LEN];
96 #if defined(COMPONENT_ML_TFLM) 100 const uint8_t * model_bin;
106 #if defined(COMPONENT_ML_TFLM_LESS) 110 tflm_rmf_apis_t rmf_bin;
125 char name[MTB_ML_MODEL_NAME_LEN];
134 int model_time_steps;
148 #if defined(COMPONENT_U55) || \ 149 defined(COMPONENT_NNLITE2) 154 uint64_t m_npu_cycles;
155 uint64_t m_npu_sum_cycles;
156 uint32_t m_npu_peak_frame;
157 uint64_t m_npu_peak_cycles;
160 #if defined(COMPONENT_ML_TFLM) 167 #if defined(COMPONENT_ML_TFLM_LESS) 302 #if defined(__cplusplus) int output_size
Definition: mtb_ml_model.h:129
int recurrent_ts_size
Definition: mtb_ml_model.h:135
uint64_t m_cpu_cycles
Definition: mtb_ml_model.h:141
bool is_rnn_streaming
Definition: mtb_ml_model.h:146
uint64_t m_cpu_peak_cycles
Definition: mtb_ml_model.h:145
Definition: mtb_ml_model.h:73
mtb_ml_profile_config_t profiling
Definition: mtb_ml_model.h:140
Definition: mtb_ml_model.h:88
uint8_t * arena_buffer
Definition: mtb_ml_model.h:165
const int arena_size
Definition: mtb_ml_model.h:103
cy_rslt_t mtb_ml_model_get_output(const mtb_ml_model_t *object, MTB_ML_DATA_T **out_pptr, int *size_ptr)
: Get NN model output buffer and size
cy_rslt_t mtb_ml_model_profile_log(mtb_ml_model_t *object)
: Generate MTB ML profiling log
cy_rslt_t mtb_ml_model_rnn_reset_all_parameters(mtb_ml_model_t *object)
: Reset model parameters
uint64_t m_cpu_sum_cycles
Definition: mtb_ml_model.h:143
cy_rslt_t mtb_ml_model_profile_config(mtb_ml_model_t *object, mtb_ml_profile_config_t config)
: Update MTB ML inference profiling setting
int mtb_ml_model_profile_get_tsc(uint64_t *val)
: Read time stamp counter (TSC) .
uint32_t m_sum_frames
Definition: mtb_ml_model.h:142
Definition: mtb_ml_model.h:119
size_t tensor_arena_size
Definition: mtb_ml_model.h:81
cy_rslt_t mtb_ml_model_init(const mtb_ml_model_bin_t *bin, const mtb_ml_model_buffer_t *buffer, mtb_ml_model_t **object)
: Allocate and initialize NN model runtime object based on model data. Only intended to be called onc...
MTB_ML_DATA_T * input
Definition: mtb_ml_model.h:132
MTB_ML_DATA_T * output
Definition: mtb_ml_model.h:131
float input_scale
Definition: mtb_ml_model.h:137
uint8_t * tensor_arena
Definition: mtb_ml_model.h:80
void * mtb_ml_model_get_inference_object(const mtb_ml_model_t *object)
: Get MTB ML inference runtime object
int input_size
Definition: mtb_ml_model.h:128
int output_zero_point
Definition: mtb_ml_model.h:138
int lib_error
Definition: mtb_ml_model.h:130
float output_scale
Definition: mtb_ml_model.h:139
int buffer_size
Definition: mtb_ml_model.h:127
uint32_t m_cpu_peak_frame
Definition: mtb_ml_model.h:144
int input_zero_point
Definition: mtb_ml_model.h:136
tflm_rmf_apis_t rmf_apis
Definition: mtb_ml_model.h:172
cy_rslt_t mtb_ml_model_run(mtb_ml_model_t *object, MTB_ML_DATA_T *input)
: Perform NN model inference
void * tflm_obj
Definition: mtb_ml_model.h:133
int mtb_ml_model_get_input_size(const mtb_ml_model_t *object)
: Get NN model input data size
const unsigned int model_size
Definition: mtb_ml_model.h:102
int model_size
Definition: mtb_ml_model.h:126
cy_rslt_t mtb_ml_model_deinit(mtb_ml_model_t *object)
: Delete NN model runtime object and free all dynamically allocated memory. Only intended to be calle...