2016-12-15 84 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

相關問題