titu1994 / keras-squeeze-excite-network

Implementation of Squeeze and Excitation Networks in Keras
MIT License
401 stars 118 forks source link

I am getting Nonetype Error (Import issue?) #24

Open kyuheejo opened 3 years ago

kyuheejo commented 3 years ago

Traceback (most recent call last): File "se_resnet.py", line 408, in model = SEResNet50() File "se_resnet.py", line 213, in SEResNet50 classes=classes) File "se_resnet.py", line 138, in SEResNet filters, depth, width, bottleneck, weight_decay, pooling) File "se_resnet.py", line 376, in _create_se_resnet x = _resnet_bottleneck_block(x, filters[0], width) File "se_resnet.py", line 330, in _resnet_bottleneck_block x = squeeze_excite_block(x) File "/home/centos/anaconda3/envs/tensorflow2_p36/lib/python3.6/site-packages/keras_squeeze_excite_network-0.0.4-py3.6.egg/keras_squeeze_excite_network/se.py", line 26, in squeeze_excite_block filters = _tensor_shape(init)[channel_axis] TypeError: 'NoneType' object is not subscriptable

I don't understand why this is not working..

welaury commented 3 years ago

hello, have you found a solution to the problem?

4pygmalion commented 3 years ago

use tf.Tensor.shape attribution, instead of _tensor_shape function `if not isinstance(input_tensor, tf.Tensor): raise ValueError("Input tensor must be tf.Tensor")

filters = input_tensor.shape[channel_axis]`

jizhang02 commented 2 years ago

Hello, to whom may be concerned: During coding, I found that function_tensor_shape is useless. One can just write tensor.shape instead of calling _tensor_shape The Tensorflow version that I use is 2.7.0