追加チュートリアルをやってみた。
参照元はここ。
$ DEMO_DIR=/tmp
$ wget -P ${DEMO_DIR} http://download.tensorflow.org/example_images/flower_photos.tgz
$ tar zxf ${DEMO_DIR}/flower_photos.tgz -C ${DEMO_DIR}
$ wget -P ${DEMO_DIR} http://storage.googleapis.com/cloud-iot-edge-pretrained-models/canned_models/mobilenet_v1_1.0_224_quant_embedding_extractor_edgetpu.tflite
$ cd python-tflite-source/edgetpu/
$ python3.5 demo/classification_transfer_learning.py --extractor ${DEMO_DIR}/mobilenet_v1_1.0_224_quant_embedding_extractor_edgetpu.tflite --data ${DEMO_DIR}/flower_photos --output ${DEMO_DIR}/flower_model.tflite --test_ratio 0.95
---------------------- Args ----------------------
Embedding extractor : /tmp/mobilenet_v1_1.0_224_quant_embedding_extractor_edgetpu.tflite
Data set : /tmp/flower_photos
Output path : /tmp/flower_model.tflite
Ratio of test images: 95%
--------------- Parsing data set -----------------
Dataset path: /tmp/flower_photos
Image list successfully parsed! Category Num = 5
---------------- Processing training data ----------------
This process may take more than 30 seconds.
Processing category: daisy
Processing category: sunflowers
Processing category: tulips
Processing category: dandelion
Processing category: roses
---------------- Start training -----------------
---------------- Training finished! -----------------
Model saved as : /tmp/flower_model.tflite
Labels file saved as : /tmp/flower_model.txt
------------------ Start evaluating ------------------
Evaluating category [ daisy ]
Evaluating category [ sunflowers ]
Evaluating category [ tulips ]
Evaluating category [ dandelion ]
Evaluating category [ roses ]
---------------- Evaluation result -----------------
Top 1 : 80%
Top 2 : 91%
Top 3 : 97%
Top 4 : 99%
Top 5 : 100%
wget -O ${DEMO_DIR}/rose.jpg https://c2.staticflickr.com/4/3062/3067374593_f2963e50b7_o.jpg
$ time python3.5 demo/classify_image.py --model ${DEMO_DIR}/flower_model.tflite --label ${DEMO_DIR}/flower_model.txt --image ${DEMO_DIR}/rose.jpg
---------------------------
roses
Score : 0.226562
---------------------------
tulips
Score : 0.207031
---------------------------
daisy
Score : 0.191406
real 0m3.385s
user 0m0.106s
sys 0m0.022s
チュートリアルの性能はこんなものということで・・・