TinyTrainable
 
Loading...
Searching...
No Matches
micro_features_micro_model_settings.h
Go to the documentation of this file.
1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_
17#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_
18
19// Keeping these as constant expressions allow us to allocate fixed-sized arrays
20// on the stack for our working memory.
21
22// The size of the input time series data we pass to the FFT to produce the
23// frequency information. This has to be a power of two, and since we're dealing
24// with 30ms of 16KHz inputs, which means 480 samples, this is the next value.
25constexpr int kMaxAudioSampleSize = 512;
26constexpr int kAudioSampleFrequency = 16000;
27
28// The following values are derived from values used during model training.
29// If you change the way you preprocess the input, update all these constants.
30constexpr int kFeatureSliceSize = 40;
31constexpr int kFeatureSliceCount = 49;
33constexpr int kFeatureSliceStrideMs = 20;
34constexpr int kFeatureSliceDurationMs = 30;
35
36// Variables for the model's output categories.
37constexpr int kSilenceIndex = 0;
38constexpr int kUnknownIndex = 1;
39// If you modify the output categories, you need to update the following values.
40constexpr int kCategoryCount = 4;
41extern const char* kCategoryLabels[kCategoryCount];
42
43#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_
constexpr int kSilenceIndex
Definition: micro_features_micro_model_settings.h:37
constexpr int kMaxAudioSampleSize
Definition: micro_features_micro_model_settings.h:25
constexpr int kFeatureSliceCount
Definition: micro_features_micro_model_settings.h:31
constexpr int kFeatureSliceStrideMs
Definition: micro_features_micro_model_settings.h:33
constexpr int kUnknownIndex
Definition: micro_features_micro_model_settings.h:38
const char * kCategoryLabels[kCategoryCount]
Definition: micro_features_micro_model_settings.cpp:18
constexpr int kFeatureSliceDurationMs
Definition: micro_features_micro_model_settings.h:34
constexpr int kFeatureSliceSize
Definition: micro_features_micro_model_settings.h:30
constexpr int kAudioSampleFrequency
Definition: micro_features_micro_model_settings.h:26
constexpr int kCategoryCount
Definition: micro_features_micro_model_settings.h:40
constexpr int kFeatureElementCount
Definition: micro_features_micro_model_settings.h:32