mirror of
https://github.com/espressif/esp-sr.git
synced 2025-09-15 15:28:44 +08:00
feat(AFE): Add Time Delay Evaluation function in AEC
This commit is contained in:
parent
1e80c761ce
commit
1092ad3323
1029
Kconfig.projbuild
1029
Kconfig.projbuild
File diff suppressed because it is too large
Load Diff
@ -50,6 +50,16 @@ dl_convq8_queue_t *dl_convq8_queue_alloc(int n, int c);
|
||||
*/
|
||||
dl_convq8_queue_t *dl_convq8_queue_alloc_mc(int n, int c, int nch);
|
||||
|
||||
/**
|
||||
* @brief Allocate a bit fixed-point convolution queue from PSRAM
|
||||
*
|
||||
* @param n The length of queue
|
||||
* @param c The number of elements in the queue
|
||||
* @param nch The channel of queue
|
||||
* @return The convolution queue, or NULL if out of memory
|
||||
*/
|
||||
dl_convq8_queue_t *dl_convq8_queue_alloc_mc_from_psram(int n, int c, int nch);
|
||||
|
||||
/**
|
||||
* @brief Free a fixed-point convolution queue
|
||||
*
|
||||
@ -64,6 +74,16 @@ void dl_convq8_queue_free(dl_convq8_queue_t *cq);
|
||||
*/
|
||||
void dl_convq8_queue_bzero(dl_convq8_queue_t *cqm);
|
||||
|
||||
/**
|
||||
* @brief Move the front pointer of queue forward,
|
||||
the First(oldest) element become the last(newest) element,
|
||||
*
|
||||
* @param cq Input fixed-point convolution queue
|
||||
* @return Pointer of oldest element
|
||||
*/
|
||||
q8tp_t *dl_convq8_queue_pop(dl_convq8_queue_t *cq);
|
||||
q8tp_t *dl_convq8_queue_popn(dl_convq8_queue_t *cq, int n);
|
||||
|
||||
/**
|
||||
* @brief Insert the float-point element at the end of queue.
|
||||
* The precision of fixed-point numbers is described by the Qm.f notation,
|
||||
|
||||
@ -93,8 +93,8 @@ void dl_convq_queue_bzero(dl_convq_queue_t *cq);
|
||||
* @param cq Input fixed-point convolution queue
|
||||
* @return Pointer of oldest element
|
||||
*/
|
||||
inline qtp_t *dl_convq_queue_pop(dl_convq_queue_t *cq);
|
||||
inline qtp_t *dl_convq_queue_popn(dl_convq_queue_t *cq, int n);
|
||||
qtp_t *dl_convq_queue_pop(dl_convq_queue_t *cq);
|
||||
qtp_t *dl_convq_queue_popn(dl_convq_queue_t *cq, int n);
|
||||
/**
|
||||
* @brief Remove the oldest element, then insert the input element at the end of queue
|
||||
*
|
||||
@ -125,7 +125,7 @@ dl_conv_queue_t *dl_queue_from_convq(dl_convq_queue_t *cq1);
|
||||
* @param last_num Offset from the front of the queue
|
||||
* @return Pointer of the element
|
||||
*/
|
||||
inline qtp_t *dl_get_queue_itemq(dl_convq_queue_t *cq, int last_num);
|
||||
qtp_t *dl_get_queue_itemq(dl_convq_queue_t *cq, int last_num);
|
||||
|
||||
/**
|
||||
* @brief Get the pointer of element in the queue by offset
|
||||
|
||||
@ -17,6 +17,17 @@ typedef enum {
|
||||
ESP_MN_STATE_TIMEOUT = 2, // time out
|
||||
} esp_mn_state_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_MN_GREEDY_SEARCH = 0, // greedy search
|
||||
ESP_MN_BEAM_SEARCH = 1, // beam search
|
||||
ESP_MN_BEAM_SEARCH_WITH_TRIE = 2, // beam search with trie language model
|
||||
} esp_mn_search_method_t;
|
||||
|
||||
typedef enum {
|
||||
CHINESE_ID = 1, // Chinese language
|
||||
ENGLISH_ID = 2, // English language
|
||||
} language_id_t;
|
||||
|
||||
// Return all possible recognition results
|
||||
typedef struct{
|
||||
esp_mn_state_t state;
|
||||
@ -24,8 +35,10 @@ typedef struct{
|
||||
int command_id[ESP_MN_RESULT_MAX_NUM]; // The list of command id.
|
||||
int phrase_id[ESP_MN_RESULT_MAX_NUM]; // The list of phrase id.
|
||||
float prob[ESP_MN_RESULT_MAX_NUM]; // The list of probability.
|
||||
char string[256];
|
||||
} esp_mn_results_t;
|
||||
|
||||
|
||||
typedef struct{
|
||||
int16_t num; // The number of error phrases, which can not added into model
|
||||
int16_t phrase_idx[ESP_MN_MAX_PHRASE_NUM]; // The error phrase index in singly linked list.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -28,12 +28,15 @@ if __name__ == '__main__':
|
||||
with io.open(sdkconfig_path, "r") as f:
|
||||
WN_STRING = ''
|
||||
MN_STRING = ''
|
||||
NSN_STRING = ''
|
||||
for label in f:
|
||||
label = label.strip("\n")
|
||||
if 'CONFIG_SR_WN' in label and label[0] != '#':
|
||||
WN_STRING += label
|
||||
if 'CONFIG_SR_MN' in label and label[0] != '#':
|
||||
MN_STRING += label
|
||||
if 'CONFIG_SR_NSN' in label and label[0] != '#':
|
||||
NSN_STRING += label
|
||||
|
||||
wakenet_model = []
|
||||
if "CONFIG_SR_WN_WN7Q8_XIAOAITONGXUE" in WN_STRING:
|
||||
@ -73,11 +76,18 @@ if "CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION_QUANT8" in MN_STRING and len(mu
|
||||
multinet_model.append('mn5q8_en')
|
||||
elif "CONFIG_SR_MN_EN_MULTINET5_SINGLE_RECOGNITION" in MN_STRING and len(multinet_model) < 2:
|
||||
multinet_model.append('mn5_en')
|
||||
elif "CONFIG_SR_MN_EN_MULTINET6_QUANT" in MN_STRING and len(multinet_model) < 2:
|
||||
multinet_model.append('mn6_en')
|
||||
|
||||
nsnet_model = ''
|
||||
if "CONFIG_SR_NSN_NSNET1" in NSN_STRING:
|
||||
nsnet_model = 'nsnet1'
|
||||
|
||||
print(wakenet_model)
|
||||
print(multinet_model)
|
||||
print(nsnet_model)
|
||||
|
||||
target_model = args.project_path + '/target'
|
||||
target_model = model_path + '/target'
|
||||
if os.path.exists(target_model):
|
||||
shutil.rmtree(target_model)
|
||||
os.makedirs(target_model)
|
||||
@ -87,6 +97,8 @@ if len(wakenet_model) != 0:
|
||||
if len(multinet_model) != 0:
|
||||
for multinet_model_item in multinet_model:
|
||||
shutil.copytree(model_path + '/multinet_model/' + multinet_model_item, target_model+'/'+multinet_model_item)
|
||||
if nsnet_model != '':
|
||||
shutil.copytree(model_path + '/nsnet_model/' + nsnet_model, target_model+'/'+nsnet_model)
|
||||
|
||||
# os.system("cp %s %s" % (wakenet_model+'/_MODEL_INFO_', target_model))
|
||||
|
||||
|
||||
2
model/multinet_model/mn6_en/_MODEL_INFO_
Normal file
2
model/multinet_model/mn6_en/_MODEL_INFO_
Normal file
@ -0,0 +1,2 @@
|
||||
# (neural network type)_(model data version)_(lable1_detection windown length_threshold for 90%_threshold for 95%)_(lable2 ...)_...
|
||||
MN6_v1_english_8_0.9_0.90
|
||||
BIN
model/multinet_model/mn6_en/mn6_data
Normal file
BIN
model/multinet_model/mn6_en/mn6_data
Normal file
Binary file not shown.
BIN
model/multinet_model/mn6_en/mn6_index
Normal file
BIN
model/multinet_model/mn6_en/mn6_index
Normal file
Binary file not shown.
@ -12,42 +12,42 @@ void check_chip_config(void)
|
||||
{
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3
|
||||
#ifndef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240
|
||||
ESP_LOGE(TAG, "CPU freq should be 240MHz");
|
||||
ESP_LOGW(TAG, "CPU freq should be 240MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||
ESP_LOGE(TAG, "Flash freq should be 80MHz");
|
||||
#if (! defined CONFIG_ESPTOOLPY_FLASHFREQ_80M) && (! defined CONFIG_ESPTOOLPY_FLASHFREQ_120M)
|
||||
ESP_LOGW(TAG, "Flash freq should be not less than 80MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPIRAM_SPEED_80M
|
||||
ESP_LOGE(TAG, "PSRAM freq should be 80MHz");
|
||||
#if (! defined CONFIG_SPIRAM_SPEED_80M) && (! defined CONFIG_SPIRAM_SPEED_120M)
|
||||
ESP_LOGW(TAG, "PSRAM freq should be not less than 80MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESP32S3_DATA_CACHE_64KB
|
||||
ESP_LOGE(TAG, "Data cache should be 64KB");
|
||||
ESP_LOGW(TAG, "Data cache recommends 64KB");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESP32S3_DATA_CACHE_LINE_64B
|
||||
ESP_LOGE(TAG, "Data cache line should be 64B");
|
||||
ESP_LOGW(TAG, "Data cache line recommends 64B");
|
||||
#endif
|
||||
#elif CONFIG_IDF_TARGET_ESP32
|
||||
#ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_240
|
||||
ESP_LOGE(TAG, "CPU freq should be 240MHz");
|
||||
ESP_LOGW(TAG, "CPU freq should be 240MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPIRAM_SPEED_80M
|
||||
ESP_LOGE(TAG, "PSRAM freq should be 80MHz");
|
||||
ESP_LOGW(TAG, "PSRAM freq should be 80MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||
ESP_LOGE(TAG, "Flash freq should be 80MHz");
|
||||
ESP_LOGW(TAG, "Flash freq should be 80MHz");
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ESPTOOLPY_FLASHMODE_QIO
|
||||
ESP_LOGE(TAG, "Flash mode should be QIO");
|
||||
ESP_LOGW(TAG, "Flash mode should be QIO");
|
||||
#endif
|
||||
#else
|
||||
ESP_LOGE(TAG, "ESP-SR-AFE only support ESP32/ESP32S3");
|
||||
ESP_LOGW(TAG, "ESP-SR-AFE only support ESP32/ESP32S3");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user