- import keras
- from keras.layers.merge import Concatenate
- from keras.models import Model
- from keras.layers import Input, Dense
- from keras.layers import Dropout
- from keras.layers.core import Dense, Activation, Lambda, Reshape,Flatten
- from keras.layers import Conv2D, MaxPooling2D, Reshape, ZeroPadding2D
-
- input_img = Input(shape=(3, 6, 3))
-
- conv2d_1_1 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_1" )(input_img)
- conv2d_2_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_1)
- conv2d_3_1 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_1)
- conv2d_4_1 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_1)
- conv2d_4_1_flatten = Flatten()(conv2d_4_1)
-
- conv2d_1_2 = Conv2D(filters = 32, kernel_size = (3,3) , padding = "same" , activation = 'relu' , name = "conv2d_1_2")(input_img)
- conv2d_2_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_1_2)
- conv2d_3_2 = Conv2D(filters = 64, kernel_size = (3,3) , padding = "same" , activation = 'relu' )(conv2d_2_2)
- conv2d_4_2 = Conv2D(filters = 32, kernel_size = (1,1) , padding = "same" , activation = 'relu' )(conv2d_3_2)
- conv2d_4_2_flatten = Flatten()(conv2d_4_2)
-
-
- merge = keras.layers.concatenate([conv2d_4_1_flatten, conv2d_4_2_flatten])
-
- dense1 = Dense(100, activation = 'relu')(merge)
- dense2 = Dense(50,activation = 'relu')(dense1)
- dense3 = Dense(1 ,activation = 'softmax')(dense2)
-
-
- model = Model(inputs = [conv2d_1_1 , conv2d_1_2] , outputs = dense3)
- model.compile(loss="crossentropy", optimizer="adam")
-
- print model.summary()
- /usr/local/lib/python2.7/dist-packages/keras/engine/topology.py:1509: UserWarning: Model inputs must come from a Keras Input layer, they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to "model_1" was not an Input tensor, it was generated by layer conv2d_1_1.
- Note that input tensors are instantiated via `tensor = Input(shape)`.
- The tensor that caused the issue was: conv2d_1_1/Relu:0
- str(x.name))
- /usr/local/lib/python2.7/dist-packages/keras/engine/topology.py:1509: UserWarning: Model inputs must come from a Keras Input layer, they cannot be the output of a previous non-Input layer. Here, a tensor specified as input to "model_1" was not an Input tensor, it was generated by layer conv2d_1_2.
- Note that input tensors are instantiated via `tensor = Input(shape)`.
- The tensor that caused the issue was: conv2d_1_2/Relu:0
- str(x.name))
- Traceback (most recent call last):
- File "test_model.py", line 32, in <module>
- model = Model(inputs = [conv2d_1_1 , conv2d_1_2] , outputs = dense3)
- File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
- return func(*args, **kwargs)
- File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1562, in __init__
- if layer.is_placeholder:
- AttributeError: 'Conv2D' object has no attribute 'is_placeholder'
--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/bb46ebd7-095f-4ca1-8fb4-59fbede53404%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.