- Download Tflite Model and label.txt from Google Cloud
mkdir tmp
gsutil cp gs://tpu-cards-bench-test-bucket/tflite/* tmp
-
Place copy of the labels.txt file in the tmp folder
-
Create an images directory in the tmp directory
-
Place test images in tmp/images
-
Upload to Github (if not previously done)
-
In GCP Cloud Shell, setup VM Variables (Note: May have to run step 4 first, as needed)
export PROJECT_ID=project-2019-3mega-01
export ZONE=us-central1-a
export INSTANCE_NAME=vm-obj-det-tpu-ubuntu
- Start VM
gcloud compute instances start $INSTANCE_NAME --zone $ZONE
gcloud compute instances list
- SSH into VM
gcloud compute ssh --project $PROJECT_ID --zone $ZONE $INSTANCE_NAME
- On GCP VM, install tflite intepreter package for the appropriate Python version (e.g 3.5):
curl https://dl.google.com/coral/python/tflite_runtime-1.14.0-cp35-cp35m-linux_x86_64.whl --output tflite_runtime-1.14.0-cp35-cp35m-linux_x86_64.whl
pip3 install tflite_runtime-1.14.0-cp35-cp35m-linux_x86_64.whl
- Clone the QA test Git directory
git clone https://github.com/mmmwembe/qa_test_tflite_model.git
- Change directory into the "qa_test_tflite_model" directory
cd qa_test_tflite_model
- Run label_image.py with the target tflite model, image and labels txt file
python3 label_image.py \
--image /tmp/images/test-bs-50.jpeg \
--model_file /tmp/detect.tflite \
--label_file /tmp/cards_labels.txt