我開發(fā)了一個遷移學(xué)習(xí)應(yīng)用程序,我正在為我的數(shù)據(jù)流重新訓(xùn)練 MobileNetV2。我正在使用來自 tensorflow-hub 的retrain.py重新訓(xùn)練模型并且沒有進(jìn)行任何修改。當(dāng)我從終端運行腳本時,在將模型下載到我的用戶配置文件中的臨時目錄后,我會直接收到此警告。Importing a graph with a lower producer version 26 into an existing graph with producer version 27. Shape inference will have run different parts of the graph with different producer versions.在調(diào)試過程中,我創(chuàng)建了一個test.py腳本來找出警告的來源:import tensorflow as tfimport tensorflow_hub as hubdef create_module_graph(module_spec): """Creates a graph and loads Hub Module into it. Args: module_spec: the hub.ModuleSpec for the image module being used. Returns: graph: the tf.Graph that was created. bottleneck_tensor: the bottleneck values output by the module. resized_input_tensor: the input images, resized as expected by the module. wants_quantization: a boolean, whether the module has been instrumented with fake quantization ops. """ FAKE_QUANT_OPS = ('FakeQuantWithMinMaxVars', 'FakeQuantWithMinMaxVarsPerChannel') height, width = hub.get_expected_image_size(module_spec) with tf.Graph().as_default() as graph: resized_input_tensor = tf.placeholder(tf.float32, [None, height, width, 3]) m = hub.Module(module_spec) bottleneck_tensor = m(resized_input_tensor) wants_quantization = any(node.op in FAKE_QUANT_OPS for node in graph.as_graph_def().node) return graph, bottleneck_tensor, resized_input_tensor, wants_quantizationdef main(): module_spec = hub.load_module_spec('https://tfhub.dev/google/imagenet/mobilenet_v2_100_96/classification/2') graph, bottleneck_tensor, resized_input_tensor, wants_quantization = create_module_graph(module_spec)if __name__ =='__main__': main()并發(fā)現(xiàn)它起源create_module_graph于retrain.py. 當(dāng)我使用從終端運行腳本時python test.py,我從上面收到生產(chǎn)者警告。但是,當(dāng)我main()從 ipython 控制臺運行時,我沒有收到生產(chǎn)者版本警告。當(dāng)我所做的只是從 tensorflow-hub 存儲庫創(chuàng)建圖表時,我不確定為什么會發(fā)生這種情況。我查看了版本兼容性文檔,沒有看到與錯誤特別相關(guān)的任何內(nèi)容。查看源代碼,似乎表明我的圖形在構(gòu)建之前已減少到最低版本。這是需要擔(dān)心的嗎?它會改變您加載圖表以進(jìn)行預(yù)測的方式嗎?
添加回答
舉報
0/150
提交
取消