View source on GitHub |
Model good at detecting speech commands, using Browser FFT spectrum.
tflite_model_maker.audio_classifier.BrowserFftSpec(
model_dir=None, strategy=None
)
Used in the notebooks
Used in the tutorials |
---|
Attributes | |
---|---|
target_sample_rate
|
Methods
create_model
create_model(
num_classes, train_whole_model=False
)
create_serving_model
create_serving_model(
training_model
)
Create a model for serving.
export_tflite
export_tflite(
model,
tflite_filepath,
with_metadata=True,
export_metadata_json_file=True,
index_to_label=None,
quantization_config=None
)
Converts the retrained model to tflite format and saves it.
This method overrides the default CustomModel._export_tflite
method, and
include the pre-processing in the exported TFLite library since support
library can't handle audio tasks yet.
Args | |
---|---|
model
|
An instance of the keras classification model to be exported. |
tflite_filepath
|
File path to save tflite model. |
with_metadata
|
Whether the output tflite model contains metadata. |
export_metadata_json_file
|
Whether to export metadata in json file. If
True, export the metadata in the same directory as tflite model.Used
only if with_metadata is True.
|
index_to_label
|
A list that map from index to label class name. |
quantization_config
|
Configuration for post-training quantization. |
get_default_quantization_config
get_default_quantization_config()
Gets the default quantization configuration.
preprocess_ds
preprocess_ds(
ds, is_training=False, cache_fn=None
)
Returns a preprocessed dataset.
run_classifier
run_classifier(
model, epochs, train_ds, validation_ds, **kwargs
)
Class Variables | |
---|---|
EXPECTED_WAVEFORM_LENGTH |
44032
|