如何在Keras 2上将合并功能转换为可读?

时间:2017-05-11 11:17:44

标签: keras keras-layer

我有一个为Keras 1.x.x编写的程序,我试图在Keras 2.x.x重新运行它。但是当它到达这一点时,

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上读取?谢谢

1 个答案:

答案 0 :(得分:0)

警告已退出清除。您应该使用kears.layers.merge.Concatenate代替merge

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