私は、リテインスクリプトの例(https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py)にInception V4モデルを使用しようとしています。リトレインの例での開始v4の使用
このスクリプトは、Inception V3(2015)とMobilenetsのさまざまなバージョンの再学習をサポートしています。私はこれまで何をやったか
: スクリプトがいるProtobuf(.pb)ファイルではなく、チェックポイント(.ckpt)を使用しているので、私はここからinception_v4.pb
をダウンロード:https://deepdetect.com/models/tf/inception_v4.pb。私が理解する限り、チェックポイントをロードしてフリーズグラフツールを使用して同じファイルを取得することもできます。
次に、tensorflow pythonツールimport_pb_to_tensorboard.py
を使用してグラフをテンソルボードで表示しました。これはtensorflow githubリポジトリにあります。 はInputImage
と呼ばれ、bottleneck_tensor_name
はInceptionV4/Logits/Logits/MatMul
でbottleneck_tensor_size
が1001
であることがわかりました。
elif architecture == 'inception_v4': data_url = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz' #this won't make any difference bottleneck_tensor_name = 'InceptionV4/Logits/Logits/MatMul' bottleneck_tensor_size = 1001 input_width = 299 input_height = 299 input_depth = 3 resized_input_tensor_name = 'InputImage' model_file_name = 'inception_v4.pb' input_mean = 128 input_std = 128
私は、次のコマンドを使用してスクリプトを実行します:
python retrain.py --architecture=inception_v4 --bottleneck_dir=test2/bottlenecks --model_dir=inception_v4 --summaries_dir=test2/summaries/basic --output_graph=test2/graph_flowers.pb --output_labels=test2/labels_flowers.txt --image_dir=datasets/flowers/flower_photos --how_many_training_steps 100
を、私は次のように取得しています、私は追加することにより、再トレーニングスクリプトのcreate_model_info(architecture)
機能を適応しようとしたこの情報を持つ
エラー:
File "retrain.py", line 373, in create_bottleneck_file str(e))) RuntimeError: Error during processing file datasets/flowers/flower_photos/tulips/4546299243_23cd58eb43.jpg (Cannot interpret feed_dict key as Tensor: Can not convert a Operation into a Tensor.)
'data_url =「http://download.tensorflow.org/models/image/imagenet/inception-2015-12 -05.tgz''は違いがあり、 'retrain.py'はあなたのモデルのファイル名を' inception-2015-12-05.tgz'と解釈するので、inception_v4ではなくinception_v3を使います。 –