feat(MN): Fix the memory leak of MN; Modify the method of resetting speech commands

This commit is contained in:
Wang Wang Wang 2022-02-17 14:23:09 +08:00
parent 66a12ee570
commit c873a359e7
7 changed files with 20 additions and 9 deletions

View File

@ -5,6 +5,7 @@
// Return all possible recognition results
#define ESP_MN_RESULT_MAX_NUM 5
#define ESP_MN_MAX_PHRASE_NUM 200
typedef enum {
ESP_MN_STATE_DETECTING = 0, // detecting
ESP_MN_STATE_DETECTED = 1, // detected
@ -19,6 +20,11 @@ typedef struct{
float prob[ESP_MN_RESULT_MAX_NUM]; // The list of probability.
} esp_mn_results_t;
typedef struct{
int16_t err_id_num;
int16_t err_id[ESP_MN_MAX_PHRASE_NUM];
} esp_mn_phrase_err_id_t;
/**
* @brief Initialze a model instance with specified model coefficient.
*
@ -109,17 +115,21 @@ typedef int (*esp_mn_iface_op_get_det_phrase_id_t)(model_iface_data_t *model);
*/
typedef void (*esp_mn_iface_op_destroy_t)(model_iface_data_t *model);
/**
* @brief Reset the speech commands recognition model
* @brief Reset the speech commands
*
* @param model_data The model object to query.
* @param command_str The string of new commands.
* @param command_id -1 means modify all commands with new command_str, 0-200 means modify the corresponding command
*
* @return The error ID structure
*/
typedef void (*esp_mn_iface_op_reset_t)(model_iface_data_t *model_data, char *command_str, char *err_phrase_id);
typedef esp_mn_phrase_err_id_t* (*esp_mn_iface_op_reset_t)(model_iface_data_t *model_data, char *command_str, int command_id);
/**
* @brief Get recognition results
*
* @param model The Model object to destroy
* @param model The Model object to query
*
* @return The current results.
*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
9e777b2eec6a13b689949a64d918ba5949812f56
187f935f

View File

@ -54,13 +54,14 @@ if "CONFIG_SR_WN_WN8_HIESP" in WN_STRING and len(wakenet_model) < 2:
multinet_model = []
if "CONFIG_SR_MN_CN_MULTINET3_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
multinet_model.append('mn3cn')
if "CONFIG_SR_MN_CN_MULTINET4_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
elif "CONFIG_SR_MN_CN_MULTINET4_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
multinet_model.append('mn4cn')
if "CONFIG_SR_MN_CN_MULTINET4_5_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
elif "CONFIG_SR_MN_CN_MULTINET4_5_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
multinet_model.append('mn4_5cn')
if "CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8" in MN_STRING and len(multinet_model) < 2:
multinet_model.append('mn5q8en')
if "CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
elif "CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
multinet_model.append('mn5en')
print(wakenet_model)
@ -80,4 +81,4 @@ if len(multinet_model) != 0:
# os.system("cp %s %s" % (wakenet_model+'/_MODEL_INFO_', target_model))
total_size = calculate_total_size(target_model)
print("Recommended model partition size: ", str(int((total_size / 1024 + 900) / 4 ) * 4) + 'KB')
print("Recommended model partition size: ", str(int((total_size / 1024 + 900) / 4 ) * 4) + 'KB')