问题1. ImportError: cannot import name ‘_obtain_input_shape’
解决方案:https://stackoverflow.com/questions/49113140/importerror-cannot-import-name-obtain-input-shape-from-keras
原因是 keras 版本太高,把版本降到2.2.0可以解决该问题,不降版本的话,就改一下代码:
from keras.applications.imagenet_utils import _obtain_input_shape
改为
from keras_applications.imagenet_utils import _obtain_input_shape
问题2. TypeError: _obtain_input_shape() got an unexpected keyword argument ‘include_top’
原因还是 keras 版本问题,函数_obtain_input_shape()的参数include_top不再使用,换成了require_flatten,因此把include_top=include_top改为require_flatten=include_top即可。