Attend the Women in ML Symposium on December 7 Register now


Stay organized with collections Save and categorize content based on your preferences.

ObjectDetector class for inference and exporting to tflite.

model_spec Specification for the model.
label_map Dict, map label integer ids to string label names such as {1: 'person', 2: 'notperson'}. 0 is the reserved key for background and doesn't need to be included in label_map. Label names can't be duplicated.
representative_data Representative dataset for full integer quantization. Used when converting the keras model to the TFLite model with full interger quantization.



View source

Loads data and train the model for object detection.

train_data Training data.
model_spec Specification for the model.
validation_data Validation data. If None, skips validation process.
epochs Number of epochs for training.
batch_size Batch size for training.
train_whole_model Boolean, False by default. If true, train the whole model. Otherwise, only train the layers that are not match model_spec.config.var_freeze_expr.
do_train Whether to run training.

An instance based on ObjectDetector.


View source


View source

Returns the underlining Keras model for serving.


View source

Evaluates the model.


View source

Evaluate the TFLite model.


View source

Converts the retrained model based on export_format.

export_dir The directory to save exported files.
tflite_filename File name to save tflite model. The full export path is {export_dir}/{tflite_filename}.
label_filename File name to save labels. The full export path is {export_dir}/{label_filename}.
vocab_filename File name to save vocabulary. The full export path is {export_dir}/{vocab_filename}.
saved_model_filename Path to SavedModel or H5 file to save the model. The full export path is {export_dir}/{saved_model_filename}/{saved_model.pb|assets|variables}.
tfjs_folder_name Folder name to save tfjs model. The full export path is {export_dir}/{tfjs_folder_name}.
export_format List of export format that could be saved_model, tflite, label, vocab.
**kwargs Other parameters like quantized_config for TFLITE model.


View source


View source

Feeds the training data for training.