このチュートリアルに従って、機械学習プログラムを作って実践してみました。
https://www.tensorflow.org/hub/tutorials/image_retraining
以下のように学習を実施しています。
python3 retrain.py
--bottleneck_dir=bottlenecks
--how_many_training_steps=100
--model_dir=inception
--summaries_dir=training_summaries/basic
--output_graph=retrained_graph.pb
--output_labels=retrained_labels.txt
--image_dir=gakusyu_data
5種類の動物の画像データを、それぞれ60枚ずつ与えました。
これは問題なく学習完了し、以下のコードを実行すると結果が5種類帰ってきました。
./tensorflow/bin/activate python3 ./train/label_image.py --image $imgfile --graph ./train/retrained_graph_max.pb --labels ./train/retrained_labels_max.txt --input_layer=Placeholder deactivate
$imgfileは与える画像ファイルです。
その後、30種類のデータで各100枚ずつ学習させると、以下のような出力を確認しました。
... (many INFO lines) ... INFO:tensorflow:Initialize variable module/InceptionV3/Mixed_7c/Branch_3/Conv2d_0b_1x1/weights:0 from checkpoint b'/tmp/tfhub_modules/11d9faf945d073033780fd924b2b09ff42155763/variables/variables' with InceptionV3/Mixed_7c/Branch_3/Conv2d_0b_1x1/weights INFO:tensorflow:Restoring parameters from /tmp/_retrain_checkpoint INFO:tensorflow:Froze 378 variables. INFO:tensorflow:Converted 378 variables to const ops.
その後、以下の内容を実行したところ、5種類しか帰ってきませんでした。
./tensorflow/bin/activate python3 ./train/label_image.py --image $imgfile --graph ./train/retrained_graph_max.pb --labels ./train/retrained_labels_max.txt --input_layer=Placeholder deactivate
retrained_labels.txtには全種類の記載があります。
エラーが確認できていないため、事象も把握できていません。
何かヒントはありますでしょうか。
コードはこちらです。
https://github.com/octocatz/tensorflow4cat/tree/staging
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/16 06:38
2018/09/16 07:01 編集
2018/09/16 07:15 編集
2018/09/16 08:05
2018/09/16 11:14
2018/09/16 11:24