python - Keras error with merge layer -


i trying build model colorize images. using lab color space. input model l channel , model trained predict , b channels. want run l channel through few convolutions , split off 2 other models independently calculate , b channels. @ end want merge them output.

model = sequential() model.add(inputlayer((1, h, w)))  model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) last = convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu') model.add(last)  a_model = sequential() a_model.add(last) a_model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) a_model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) a_model.add(convolution2d(1, 3, 3, border_mode = 'same', activation = 'sigmoid'))  b_model = sequential() b_model.add(last) b_model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) b_model.add(convolution2d(64, 5, 5, border_mode = 'same', activation = 'relu')) b_model.add(convolution2d(1, 3, 3, border_mode = 'same', activation = 'sigmoid'))  model.add(merge((a_model, b_model), mode = 'concat')) 

i following error when try create merge layer.

using theano backend. using gpu device 0: geforce gtx titan (cnmem disabled, cudnn 5004) traceback (most recent call last):   file "/home/chase/workspace/colorizer/colorizer2.py", line 79, in <module>     model.add(merge((a_model, b_model), mode = 'concat'))   file "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 1118, in __init__     self.add_inbound_node(layers, node_indices, tensor_indices)   file "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 524, in add_inbound_node     assert len(node_indices) == len(inbound_layers) assertionerror 

i want outut of model (2, h, w) h , w image height , width.

the sequential model doesn't allow create forks in network. use functional api (new in keras 1.0) instead. can follow this tutorial.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -