当我尝试将它附加到InceptionV3时,我无法使GlobalAveragePooling2D工作。有谁看到我做错了什么?我可以让GlobalMaxPooling2D工作。
inceptModel = InceptionV3(include_top=False, input_shape= (162,243, 3))
x = inceptModel.outputs
x = GlobalAveragePooling2D()(x)
结果
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda/anaconda3/lib/python3.5/site-packages/keras/engine/topology.py", line 617, in __call__
output = self.call(inputs, **kwargs)
File "/opt/anaconda/anaconda3/lib/python3.5/site-packages/keras/layers/pooling.py", line 540, in call
return K.mean(inputs, axis=[1, 2])
File "/opt/anaconda/anaconda3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1362, in mean
if x.dtype.base_dtype == tf.bool:
AttributeError: 'list' object has no attribute 'dtype'
但是
GlobalMaxPooling2D()(x)
工作正常。有没有人有想法?
版本:
import keras; print(keras.__version__)
2.1.3
import tensorflow as tf; print(tf.__version__)
1.2.1