I am trying to adapt an example retraining script ( https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py ) to use the Inception V4 model.
The script already supports retraining Inception V3 (2015), as well as various versions of Mobilenets.
What I have done so far: since the script uses protobuf files (.pb) and not breakpoints (.ckpt), I downloaded inception_v4.pb
from here: https://deepdetect.com/models/tf/inception_v4.pb , as I understand it , you could also load a breakpoint and use the graph freeze tool to get the same file.
Then I looked at the graph in tenorboard using the python tool import_pb_to_tensorboard.py
which can be found in the tenorflow github repository. From there (correct me if I'm not mistaken) I found what resized_input_tensor_name
is called InputImage
then bottleneck_tensor_name
- InceptionV4/Logits/Logits/MatMul
with bottleneck_tensor_size
- 1001
.
With this information, I tried to adapt create_model_info(architecture)
the retraining script by adding:
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
I run the script using the following command:
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
and I get the following error:
File โretrain.pyโ, line 373, in create_bottleneck_file str (e))) RuntimeError: Error processing file datasets /flowers/flower_photos/tulips/4546299243_23cd58eb43.jpg (Cannot interpret feed_dict key as tensor: cannot convert operation to Tensor .)
source
share