tflite_model_maker.audio_classifier.BrowserFftSpec

Model good at detecting speech commands, using Browser FFT spectrum.

Used in the notebooks

Used in the tutorials

model_dir The location to save the model checkpoint files.
strategy An instance of TF distribute strategy. If none, it will use the default strategy (either SingleDeviceStrategy or the current scoped strategy.

target_sample_rate

Methods

create_model

View source

create_serving_model

View source

Create a model for serving.

export_tflite

View source

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

View source

Gets the default quantization configuration.

preprocess_ds

View source

Returns a preprocessed dataset.

run_classifier

View source

EXPECTED_WAVEFORM_LENGTH 44032