TensorFlow Lite Model Maker 库,可以简化使用自定义数据集训练 TensorFlow Lite 模型的过程。该库使用迁移学习来减少所需的训练数据量并缩短训练时间。
例,图像分类,四行代码
# Load input data specific to an on-device ML app.
data = ImageClassifierDataLoader.from_folder('flower_photos/')
train_data, test_data = data.split(0.9)
# Customize the TensorFlow model.
model = image_classifier.create(train_data)
# Evaluate the model.
loss, accuracy = model.evaluate(test_data)
# Export to Tensorflow Lite model and label file in `export_dir`.
model.export(export_dir='/tmp/')
安装
pip install tflite-model-maker
cd examples/tensorflow_examples/lite/model_maker/pip_package
pip install -e .