feat: Add mutex lock when loading model parameter

This commit is contained in:
sxy 2023-03-20 19:53:48 +08:00
parent 0cf2db1540
commit bca14a02f7
10 changed files with 23 additions and 7 deletions

View File

@ -1,8 +1,13 @@
# Change log for esp-sr
## Unreleased
## 1.2.1
- Fix bugs in model loader
- Read all parameters sequentially, which reduces about 5x in model loading time.
- Use esp_partition_mmap to replace spiffs file system, which further reduces about 3x in model loading time
- Add WakeNet API unity test
- Add MultiNet API unity test
## 1.2.0
- ESP-DSP dependency is now installed from the component registry

View File

@ -1,4 +1,4 @@
version: "1.2.0"
version: "1.2.1"
description: esp_sr provides basic algorithms for Speech Recognition applications
url: https://github.com/espressif/esp-sr
dependencies:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -874,7 +874,9 @@ char *get_id_name_en(int i)
esp_mn_error_t* esp_mn_commands_update_from_sdkconfig(const esp_mn_iface_t *multinet, model_iface_data_t *model_data)
{
#ifdef CONFIG_SR_MN_CN_MULTINET6_QUANT || CONFIG_SR_MN_EN_MULTINET6_QUANT
#ifdef CONFIG_SR_MN_CN_MULTINET6_QUANT
return NULL;
#else if CONFIG_SR_MN_EN_MULTINET6_QUANT
return NULL;
#endif

View File

@ -51,14 +51,15 @@ TEST_CASE("multinet create/destroy API & memory leak", "[mn]")
int mem_leak = start_size - last_end_size;
printf("create&destroy times:%d, memory leak:%d\n", 1, mem_leak);
for (int i=0; i<3; i++) {
for (int i=0; i<5; i++) {
printf("init partition ...\n");
models = esp_srmodel_init("model");
model_name = esp_srmodel_filter(models, ESP_MN_PREFIX, NULL);
multinet = esp_mn_handle_from_name(model_name);
printf("create ...\n");
model_data = multinet->create(model_name, 6000);
int time_out = 3000+i*2000;
printf("create ..., time out = %d\n", time_out);
model_data = multinet->create(model_name, time_out);
printf("destroy ...\n");
multinet->destroy(model_data);

View File

@ -50,14 +50,22 @@ TEST_CASE("wakenet create/destroy API & memory leak", "[wn]")
int mem_leak = start_size - last_end_size;
printf("create&destroy times:%d, memory leak:%d\n", 1, mem_leak);
for (int i=0; i<3; i++) {
for (int i=0; i<6; i++) {
printf("init partition ...\n");
models = esp_srmodel_init("model");
model_name = esp_srmodel_filter(models, ESP_WN_PREFIX, NULL);
wakenet = esp_wn_handle_from_name(model_name);
printf("create ...\n");
model_data = wakenet->create(model_name, DET_MODE_3CH_95);
// typedef enum {
// DET_MODE_90 = 0, // Normal
// DET_MODE_95 = 1, // Aggressive
// DET_MODE_2CH_90 = 2,
// DET_MODE_2CH_95 = 3,
// DET_MODE_3CH_90 = 4,
// DET_MODE_3CH_95 = 5,
// } det_mode_t;
model_data = wakenet->create(model_name, i);
printf("destroy ...\n");
wakenet->destroy(model_data);