1、在导入_obtain_input_shape时,
from keras.applications.imagenet_utils import _obtain_input_shape
出现错误如下:
ImportError: cannot import name '_obtain_input_shape'
原因是在keras 2.2.2中,keras.applications.imagenet_utils模块不再有_obtain_input_shape方法。解决方法:
将导入语句修改如下
from keras_applications.imagenet_utils import _obtain_input_shape
重点:使用keras_applications代替keras.applications
2.在调用_obtain_input_shape时,
# Determine proper input shape.
input_shape = _obtain_input_shape(input_shape,
default_size=224,
min_size=32,
data_format=K.image_data_format(),
include_top=include_top or weights)
出现错误如下:
TypeError: _obtain_input_shape() got an u