我试图实施this paper中描述的模型
我遇到问题的一个项目是设置输入,这应该是堆叠的两个图像,这意味着,我有一组连续的(i & i+1)
图像 2048x2048x1 (单色) ,因此输入张量将 2048x2048x2 ,但神经网络的每个连续输入将是以下一组图像(i+1 & i+2)
。
到目前为止我已经
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Concatenate, Activation, Conv2D, MaxPooling2D, Flatten, Input
from keras.klayers import Embedding,LSTM
inp1 = Input((2048,2048,1))
inp2 = Input((2048,2048,1))
deepVO = Sequential()
deepVO.add(Concatenate(inp1,inp2,-1))
deepVO.add(Conv2D(64,(2,2)))
deepVO.add(Activation('relu'))
#....continue to add other layers
我在deepVO_CNN.add(Concatenate(inp1,inp2,-1))
得到的错误是:
TypeError:__ init __()取1到2个位置参数,但是给出了4个。
答案 0 :(得分:3)
尝试这样的keras api模式:
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, Conv2D, MaxPooling2D, Flatten, Input, concatenate
from keras.models import Model
inp1 = Input((2048,2048,1))
inp2 = Input((2048,2048,1))
deepVO = concatenate([inp1, inp2],axis=-1)
deepVO = Conv2D(64,(2,2))(deepVO)
deepVO = Activation('relu')(deepVO)
...
...
outputs = Dense(num_classes, activation='softmax')(deepVO)
deepVO = Model([inp1, inp2], outputs)
#deepVO.summary()