我正在做一些与图像字幕相关的任务,我已经加载了这样的初始模型的权重
model = InceptionV3(weights='imagenet')
但我收到这样的错误:
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'
我该怎么办?请帮忙。这是上述代码的完整输出。
1 . -------------------------------------------------- ------------------------- AttributeError Traceback (most recent call last) in () 1 # 加载 inception v3 模型 ----> 2 模型= InceptionV3(include_top=True,weights='imagenet') 3 # InceptionV3(weights='imagenet')
~/anaconda3/lib/python3.6/site-packages/keras/applications/__init__.py
in wrapper(*args, **kwargs)
26 kwargs['models'] = models
27 kwargs['utils'] = utils
---> 28 return base_fun(*args, **kwargs)
29
30 return wrapper
~/anaconda3/lib/python3.6/site-packages/keras/applications/inception_v3.py
in InceptionV3(*args, **kwargs)
9 @keras_modules_injection
10 def InceptionV3(*args, **kwargs):
---> 11 return inception_v3.InceptionV3(*args, **kwargs)
12
13
~/anaconda3/lib/python3.6/site-packages/keras_applications/inception_v3.py
in InceptionV3(include_top, weights, input_tensor, input_shape,
pooling, classes, **kwargs)
155
156 if input_tensor is None:
--> 157 img_input = layers.Input(shape=input_shape)
158 else:
159 if not backend.is_keras_tensor(input_tensor):
~/anaconda3/lib/python3.6/site-packages/keras/engine/input_layer.py
in Input(shape, batch_shape, name, dtype, sparse, tensor)
176 name=name, dtype=dtype,
177 sparse=sparse,
--> 178 input_tensor=tensor)
179 # Return tensor including _keras_shape and _keras_history.
180 # Note that in this case train_output and test_output are the same pointer.
莫回无
神不在的星期二
江户川乱折腾
相关分类