MadYZR / FC-DenseNet-Keras

Implementation of The One Hundred Layers Tiramisu for semantic segmentation in Keras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shape error

zaher88abd opened this issue · comments

Hi, I tried your code and I got this error and I couldn't figure it out.

  File "testModel.py", line 41, in <module>
    model = Tiramisu()
  File "/home/hallab/Github/project/FC-DenseNet-Keras/tiramisu_net.py", line 79, in Tiramisu
    skip_connection_list[i], block_to_upsample, n_filters_keep)
  File "/home/hallab/Github/project/FC-DenseNet-Keras/layers.py", line 39, in TransitionUp
    l = concatenate([l, skip_connection], axis=-1)
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/layers/merge.py", line 641, in concatenate
    return Concatenate(axis=axis, **kwargs)(inputs)
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/engine/base_layer.py", line 431, in __call__
    self.build(unpack_singleton(input_shapes))
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/layers/merge.py", line 354, in build
    'Got inputs shapes: %s' % (input_shape))
ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 44, 64, 192), (None, 45, 64, 464)]

the only thing I changed in the code is inputShape (360,512,3).

commented

Hi, I tried your code and I got this error and I couldn't figure it out.

  File "testModel.py", line 41, in <module>
    model = Tiramisu()
  File "/home/hallab/Github/project/FC-DenseNet-Keras/tiramisu_net.py", line 79, in Tiramisu
    skip_connection_list[i], block_to_upsample, n_filters_keep)
  File "/home/hallab/Github/project/FC-DenseNet-Keras/layers.py", line 39, in TransitionUp
    l = concatenate([l, skip_connection], axis=-1)
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/layers/merge.py", line 641, in concatenate
    return Concatenate(axis=axis, **kwargs)(inputs)
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/engine/base_layer.py", line 431, in __call__
    self.build(unpack_singleton(input_shapes))
  File "/home/hallab/.local/lib/python3.5/site-packages/keras/layers/merge.py", line 354, in build
    'Got inputs shapes: %s' % (input_shape))
ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 44, 64, 192), (None, 45, 64, 464)]

the only thing I changed in the code is inputShape (360,512,3).

Hi,zaher88abd
Because the number of down-sampling (n_pool ) is 5, so the input shape must be divisible by 32(2^5).
You can change the value of n_pool to fit your inputshape or change the inputshape to fit the original version of Tiramisu.

Thanks, I changed my data size to be 512*512.