Skip to content

p4是否无法使用wn9_hilexin (AIS-2275) #188

@675849dbk

Description

@675849dbk

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • Provided a clear description of your suggestion.
  • Included any relevant context or examples.

Issue or Suggestion Description

我参考官方的案例写了一个p4的wn9_hilexin唤醒词,但是模型初始化一直不成功,以下是我遇到的错误

I (336) MODEL_LOADER: The storage free size is 65088 KB
I (336) MODEL_LOADER: The partition size is 7900 KB
I (346) MODEL_LOADER: Successfully load srmodels
I (346) i2s_es8311: Loaded model: wn9_hilexin
Guru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled.

下面是初始化的代码,期待你的回复!

//模型初始化
static esp_err_t wakenet_init(void)
{
// 初始化模型分区
int start_size = heap_caps_get_free_size(MALLOC_CAP_8BIT);
int start_internal_size = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
models = esp_srmodel_init("model");
if (!models) {
ESP_LOGE(TAG, "Failed to initialize models");
return ESP_FAIL;
}

  // 过滤出唤醒词模型
  model_name = esp_srmodel_filter(models, ESP_WN_PREFIX, NULL);
  if (!model_name) {
      ESP_LOGE(TAG, "No wake word model found");
      return ESP_FAIL;
  }

  ESP_LOGI(TAG, "Loaded model: %s", model_name);

  // 获取唤醒词模型接口
  wakenet = (esp_wn_iface_t*)esp_wn_handle_from_name(model_name);
  if (!wakenet) {
      ESP_LOGE(TAG, "Failed to get wake word model handle");
      return ESP_FAIL;
  }
  struct timeval tv_start, tv_end;
  gettimeofday(&tv_start, NULL);
  model_data = wakenet->create(model_name, DET_MODE_2CH_90);
  gettimeofday(&tv_end, NULL);
  int tv_ms = (tv_end.tv_sec - tv_start.tv_sec) * 1000 + (tv_end.tv_usec - tv_start.tv_usec) / 1000;
  printf("create latency:%d ms\n", tv_ms);

  // 检查模型数据是否创建成功
  if (model_data == NULL) {
      ESP_LOGE(TAG, "Failed to create model data");
      return ESP_FAIL;
  }

  ESP_LOGI(TAG, "Model data created successfully at %p", model_data);

  return ESP_OK;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions