densenet
densenet copied to clipboard
Concatenate error
@seasonyc Hi, I try to run the DenseNet, and It occurs the following error when the input shape is (28,28,1).
Using TensorFlow backend. Creating DenseNet ############################################# Dense blocks: 3 Layers per dense block: [12, 12, 12] ############################################# D:\Anaconda3\envs\py36\lib\site-packages\numpy\lib\type_check.py:546: DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead 'a.item() instead', DeprecationWarning, stacklevel=1) WARNING:tensorflow:From D:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. 2019-06-17 21:26:10.660894: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 2019-06-17 21:26:10.661957: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance. WARNING:tensorflow:From D:\Anaconda3\envs\py36\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use
rate
instead ofkeep_prob
. Rate should be set torate = 1 - keep_prob
.Ran 1 test in 0.183s
FAILED (errors=1)
Error Traceback (most recent call last): File "D:\Anaconda3\envs\py36\lib\unittest\case.py", line 59, in testPartExecutor yield File "D:\Anaconda3\envs\py36\lib\unittest\case.py", line 605, in run testMethod() File "G:\Workspace\workspace_python\3DUnetCNN\test\test_model.py", line 29, in test_group_normalization bottleneck=False, compression=1.0, weight_decay=1e-4, depth=40) File "G:\Workspace\workspace_python\3DUnetCNN\unet3d\model\densenet.py", line 70, in DenseNet x, nb_channels = dense_block(x, dense_layers[block], nb_channels, growth_rate, dropout_rate, bottleneck, weight_decay) File "G:\Workspace\workspace_python\3DUnetCNN\unet3d\model\densenet.py", line 107, in dense_block x = Concatenate(axis=-1)(x_list) File "D:\Anaconda3\envs\py36\lib\site-packages\keras\engine\base_layer.py", line 431, in call self.build(unpack_singleton(input_shapes)) File "D:\Anaconda3\envs\py36\lib\site-packages\keras\layers\merge.py", line 362, 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, 24, 28, 1), (None, 12, 28, 1)]
You have to crop one. Use cropping2D to solve this.