使用tensorflow的retrain.py訓練圖片分類器


參考

https://hackernoon.com/creating-insanely-fast-image-classifiers-with-mobilenet-in-tensorflow-f030ce0a2991

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py

https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/#0

https://www.tensorflow.org/tutorials/image_retraining

 

准備圖片

images/label1/1.jpg

      /2.jpg

images/label2/1.jpg

      /2.jpg

 

開始訓練,默認Inception v3 model

python retrain.py \
  --bottleneck_dir=bottlenecks \
  --how_many_training_steps=500 \
  --model_dir=inception \
  --summaries_dir=training_summaries/basic \
  --output_graph=retrained_graph.pb \
  --output_labels=retrained_labels.txt \
  --image_dir=flower_photos

也可以使用其他模型

詳細參數查看

python retrain.py -h

使用訓練結果進行預測

參考https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/#5

 

這樣在訓練好的inception-2015-12-05數據基礎上

僅重新訓練最后一層

用較短的時間達到分類效果

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM