2016-12-15 72 views
0

classify_image.py,输入图像在如何将预训练模型的输入连接到tf.train.shuffle_batch的输出?

predictions = sess.run(softmax_tensor,{'DecodeJpeg/contents:0': image_data})

喂加载图像如果我想新的图层添加到开始模式并重新训练整个模型?从classify_image_graph_def.pb加载的变量是否可以训练?我看到freeze_graph.py使用了convert_variables_to_constants来产生冻结图。那么这些负载的重物可以再次训练吗,它们是常量吗?我怎样才能将输入('shuffle_batch:0')连接到初始模型到输出tf.train.shuffle_batch

回答

0

classify_image.py中使用的模型将其变量冻结为常量,并且没有任何渐变操作,所以很难将其转化为可训练的东西。您可以看到我们如何移除一层,并将其替换为可在此训练的东西: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py

虽然很难概括。你最好在这里看一些微调的例子: https://github.com/tensorflow/models/tree/master/inception#how-to-fine-tune-a-pre-trained-model-on-a-new-task

+0

谢谢,这些例子帮助我很多。 – Tao

相关问题