2017-05-11 45 views
0

我有一個程序,它已被寫入Keras 1.x.x,我試圖在Keras 2.x.x中重新運行它。然而,當它達到這一點,如何將合併函數轉換爲Keras 2中可讀的?

from keras.layers import Input, merge 

up2 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat', concat_axis=1) 

它顯示了以下錯誤:

UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc. 
    up1 = merge([UpSampling2D(size=(2, 2))(conv3), conv2], mode='concat', concat_axis=1) 
/usr/local/python/3.5.2-gcc4/externalmodules/lib/python3.5/site-packages/keras/legacy/layers.py:456: UserWarning: The `Merge` layer is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc. 
    name=name) 

我並沒有改變任何東西,甚至數據是一樣的。你能指導我如何轉換合併函數在Keras 2.x.x.上可讀?謝謝

回答

0

警告已清除。您應該使用kears.layers.merge.Concatenate而不是merge

from keras.layers.merge import Concatenate 
up2 = Concatenate([UpSampling2D(size=(2, 2))(conv5), conv4], axis=1) 
+1

感謝您的評論。我嘗試了你的建議,它顯示了以下錯誤:'TypeError:__init __()爲參數'axis'提供了多個值 –

相關問題