Model_maker_training#
- Model_maker_training.load_data(csv_file_path, images_dir)#
Loads data from the csv file.
- Parameters:
csv_file_path – The file path to the csv file.
images_dir – The directory that contains images.
- Returns:
A Dataloader containing the data of training, validation and test set.
- Model_maker_training.train_model(train_data, validation_data)#
Fine tunes the EfficientDet-Lite0 model on the given dataset.
- Parameters:
train_data – Training dataset, in the form of Dataloader. validation_data: Validation dataset, in the form of Dataloader.
- Returns:
A trained model.
- Model_maker_training.preprocess_image(image_path, input_size)#
Preprocess the input image to feed to the TFLite model
- Parameters:
image_path – path to the input image
input_size – the input size of the model
- Returns:
preprocessed image in the format of (1, input_size, input_size, 3) original image size
- Model_maker_training.detect_objects(interpreter, image, threshold)#
Returns a list of detection results, each a dictionary of object info.
- Parameters:
interpreter – tflite.Interpreter
image – A [1, height, width, 3] Tensor of type tf.uint8.threshold: a
number (floating point) –
- Returns:
a list of dicts
- Model_maker_training.run_odt_and_draw_results(image_path, interpreter, threshold=0.5)#
Run object detection on the input image and draw the detection results
- Parameters:
image_path – path to the input image
interpreter – tflite.Interpreter
threshold – a floating point number