kobiso / CBAM-keras

CBAM implementation on Keras
MIT License
359 stars 134 forks source link

AssertionError: assert avg_pool._keras_shape[-1] == 1 #3

Closed codename1995 closed 5 years ago

codename1995 commented 5 years ago

attention_module.py

    ....
    avg_pool = Lambda(lambda x: K.mean(x, axis=3, keepdims=True))(cbam_feature)
    assert avg_pool._keras_shape[-1] == 1
    ....

The K.mean() seems not to work, cause the _avgpool have the same size with _cbamfeature.

Did you meet this problem?

codename1995 commented 5 years ago

This problem has benn solved. It is caused by using theano as backend. So, it can be fixed by using tensorflow. But I still haven't figured out the essential reason.