It is assummed that you already have a pre-trained YOLOv3 model setup that needs to be converted into TensorFlow Lite.
-
Clone the repository on your local machine.
-
Create a folder named
YOLOv3_TFLite
on your local machine and copy the YOLOv3 model weights i.e.yolov3_training_last.weights
andclasses.txt
files inside it. The directory structure should look something like the following.
YOLOv3_TFLite
|__ yolov3_training_last.weights
|__ classes.txt
-
Sign in to your Google account and upload the
YOLOv3_TFLite
folder on Google Drive. Change the access permission toAnyone with the link
for both the files inside theYOLOv3_TFLite
folder. -
Open Google Colab and upload the
YOLOv3_to_TFLite_Conversion.ipynb
notebook from the repository you had cloned and run the notebook cells one-by-one as instructed. For detailed explain, refer the following document. -
Once the YOLOv3 model is converted into its TF Lite version, download the
detect.tflite
onto your local machine from theYOLOv3_TFLite
folder saved on Google Drive. Copydetect.tflite
andclasses.txt
inside theYOLOv3-to-TensorFlow-Lite-Conversion
repository you had cloned earlier. -
Create a folder named
test_images
inside the repository and add some images inside it which you would like to test the model on. -
Open
test_tflite.py
file and edit Line 151 by replacing<your_test_image>
with the name of image file you want to test. -
Run the following command:
python test_tflite.py
- Read the Medium blog for step-by-step implementation.