File size: 7,787 Bytes
25ade36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
 * Copyright (c) 2026 EdgeImpulse Inc.
 *
 * Generated by Edge Impulse and licensed under the applicable Edge Impulse
 * Terms of Service. Community and Professional Terms of Service
 * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of
 * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service),
 * according to your product plan subscription (the “License”).
 *
 * This software, documentation and other associated files (collectively referred
 * to as the “Software”) is a single SDK variation generated by the Edge Impulse
 * platform and requires an active paid Edge Impulse subscription to use this
 * Software for any purpose.
 *
 * You may NOT use this Software unless you have an active Edge Impulse subscription
 * that meets the eligibility requirements for the applicable License, subject to
 * your full and continued compliance with the terms and conditions of the License,
 * including without limitation any usage restrictions under the applicable License.
 *
 * If you do not have an active Edge Impulse product plan subscription, or if use
 * of this Software exceeds the usage limitations of your Edge Impulse product plan
 * subscription, you are not permitted to use this Software and must immediately
 * delete and erase all copies of this Software within your control or possession.
 * Edge Impulse reserves all rights and remedies available to enforce its rights.
 *
 * Unless required by applicable law or agreed to in writing, the Software is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing
 * permissions, disclaimers and limitations under the License.
 */

#ifndef _EI_CLASSIFIER_MODEL_VARIABLES_H_
#define _EI_CLASSIFIER_MODEL_VARIABLES_H_

/**
 * @file
 *  Auto-generated complete impulse definitions. The ei_impulse_handle_t should
 *  be passed to ei_run_classifier() function to use this specific impulse.
 *  This file should only be included in ei_run_classifier.h file.
 */

#include <stdint.h>
#include "model_metadata.h"
#include "tflite-model/tflite_learn_1052106_5_compiled.h"
#include "edge-impulse-sdk/classifier/ei_model_types.h"
#include "edge-impulse-sdk/classifier/inferencing_engines/engines.h"
#include "edge-impulse-sdk/classifier/postprocessing/ei_postprocessing_common.h"

const char* ei_classifier_inferencing_categories_1052106_1[] = { "background_noise", "hey_edge", "unknown" };

ei_dsp_named_axis_t ei_dsp_config_1052106_6_named_axes[] = {
    { .name = "Signal", .axis = 0 }
};
size_t ei_dsp_config_1052106_6_named_axes_size = 1;
EI_CLASSIFIER_DSP_AXES_INDEX_TYPE ei_dsp_config_1052106_6_axes[] = { 0 };
const uint32_t ei_dsp_config_1052106_6_axes_size = 1;
ei_dsp_config_mfe_t ei_dsp_config_1052106_6 = {
    6, // uint32_t blockId
    4, // int implementationVersion
    1, // int length of axes
    ei_dsp_config_1052106_6_named_axes, // named axes
    ei_dsp_config_1052106_6_named_axes_size, // size of the named axes array
    0.02f, // float frame_length
    0.01f, // float frame_stride
    40, // int num_filters
    256, // int fft_length
    0, // int low_frequency
    0, // int high_frequency
    101, // int win_size
    -52 // int noise_floor_db
};

const uint8_t ei_dsp_blocks_1052106_1_size = 1;
ei_model_dsp_t ei_dsp_blocks_1052106_1[ei_dsp_blocks_1052106_1_size] = {
    { // DSP block 6
        6,
        3960, // output size
        &extract_mfe_features, // DSP function pointer
        (void*)&ei_dsp_config_1052106_6, // pointer to config struct
        ei_dsp_config_1052106_6_axes, // array of offsets into the input stream, one for each axis
        ei_dsp_config_1052106_6_axes_size, // number of axes
        1, // version
        nullptr, // factory function
        nullptr, // data normalization config
    }
};
const ei_config_tflite_eon_graph_t ei_config_graph_1052106_5 = {
    .implementation_version = 1,
    .model_init = &tflite_learn_1052106_5_init,
    .model_invoke = &tflite_learn_1052106_5_invoke,
    .model_reset = &tflite_learn_1052106_5_reset,
    .model_input = &tflite_learn_1052106_5_input,
    .model_output = &tflite_learn_1052106_5_output,
};

const uint8_t ei_output_tensors_indices_1052106_5[1] = { 0 };
const uint8_t ei_output_tensors_size_1052106_5 = 1;
ei_learning_block_config_tflite_graph_t ei_learning_block_config_1052106_5 = {
    .implementation_version = 1,
    .block_id = 5,
    .output_tensors_indices = ei_output_tensors_indices_1052106_5,
    .output_tensors_size = ei_output_tensors_size_1052106_5,
    .quantized = 1,
    .compiled = 1,
    .graph_config = (void*)&ei_config_graph_1052106_5,
    .dequantize_output = 0,
};

const uint8_t ei_learning_blocks_1052106_1_size = 1;
const uint32_t ei_learning_block_1052106_5_inputs[1] = { 6 };
const uint8_t ei_learning_block_1052106_5_inputs_size = 1;
const ei_learning_block_t ei_learning_blocks_1052106_1[ei_learning_blocks_1052106_1_size] = {
    {
        5,
        &run_nn_inference,
        (void*)&ei_learning_block_config_1052106_5,
        EI_CLASSIFIER_IMAGE_SCALING_NONE,
        ei_learning_block_1052106_5_inputs,
        ei_learning_block_1052106_5_inputs_size,
    },
};

ei_fill_result_classification_i8_config_t ei_fill_result_classification_i8_config_1052106_5 = {
    .zero_point = -128,
    .scale = 0.00390625
};

const size_t ei_postprocessing_blocks_1052106_1_size = 1;
const ei_postprocessing_block_t ei_postprocessing_blocks_1052106_1[ei_postprocessing_blocks_1052106_1_size] = {
    {
        .block_id = 5,
        .type = EI_CLASSIFIER_MODE_CLASSIFICATION,
        .init_fn = NULL,
        .deinit_fn = NULL,
        .postprocess_fn = &process_classification_i8,
        .display_fn = NULL,
        .config = (void*)&ei_fill_result_classification_i8_config_1052106_5,
        .input_block_id = 5
    },
};

const uint8_t freeform_outputs_1052106_1_size = 0;

uint32_t *freeform_outputs_1052106_1 = nullptr;

const ei_impulse_t impulse_1052106_1 = {
    .project_id = 1052106,
    .project_owner = "Eoin",
    .project_name = "Hey Edge - Wake Word / Keyword Spotting (KWS) Model",
    .impulse_id = 1,
    .impulse_name = "Impulse #1",
    .deploy_version = 1,

    .nn_input_frame_size = 3960,
    .raw_sample_count = 16000,
    .raw_samples_per_frame = 1,
    .dsp_input_frame_size = 16000 * 1,
    .input_width = 0,
    .input_height = 0,
    .input_frames = 0,
    .interval_ms = 0.0625,
    .frequency = 16000,

    .dsp_blocks_size = ei_dsp_blocks_1052106_1_size,
    .dsp_blocks = ei_dsp_blocks_1052106_1,

    .learning_blocks_size = ei_learning_blocks_1052106_1_size,
    .learning_blocks = ei_learning_blocks_1052106_1,

    .postprocessing_blocks_size = ei_postprocessing_blocks_1052106_1_size,
    .postprocessing_blocks = ei_postprocessing_blocks_1052106_1,

    .output_tensors_size = 1,

    .inferencing_engine = EI_CLASSIFIER_TFLITE,

    .sensor = EI_CLASSIFIER_SENSOR_MICROPHONE,
    .fusion_string = "audio",
    .slice_size = (16000/4),
    .slices_per_model_window = 4,

    .has_anomaly = EI_ANOMALY_TYPE_UNKNOWN,
    .label_count = 3,
    .categories = ei_classifier_inferencing_categories_1052106_1,
    .results_type = EI_CLASSIFIER_TYPE_CLASSIFICATION,
    .freeform_outputs_size = freeform_outputs_1052106_1_size,
    .freeform_outputs = freeform_outputs_1052106_1
};

ei_impulse_handle_t impulse_handle_1052106_1 = ei_impulse_handle_t( &impulse_1052106_1 );

ei_impulse_handle_t& ei_default_impulse = impulse_handle_1052106_1;
constexpr auto& ei_classifier_inferencing_categories = ei_classifier_inferencing_categories_1052106_1;
const auto ei_dsp_blocks_size = ei_dsp_blocks_1052106_1_size;
ei_model_dsp_t *ei_dsp_blocks = ei_dsp_blocks_1052106_1;
#endif // _EI_CLASSIFIER_MODEL_VARIABLES_H_