Hi guys I just start learning the machine learning and tried to run a RCNN code on Jupyter Notebook
.
I am trying to run the below code. I have google the error and update the tensorflow
version to 2.3.1 and kersa
2.1.6. But it still throw out this TypeError
. I see there is another way to amend the python source code by removing the argument axis
. But how can I change the vgg16 sourcecode on Jupyter Notebook
? I tried to go into /use/local/lib
on my macbook and cannot find out the python source file. Hope someone can help! Cheers
Code:
from keras.application.vgg16 import VGG16
vggmodel = VGG16(weight='imagenet', include_top=True)
vggmodel.summary()
Update: I have found the source file and remove the axis argument. But now another error is threw.
Tensorflow Attribute Error: module tensorflow has no attribute get_default_graph
AttributeError Traceback (most recent call last)
<ipython-input-14-5b351c8334f5> in <module>
----> 1 vggmodel = VGG16(weights='imagenet', include_top=True)
2 vggmodel.summary()
~/.local/lib/python3.7/site-packages/keras/applications/vgg16.py in VGG16(include_top, weights, input_tensor, input_shape, pooling, classes)
107
108 if input_tensor is None:
--> 109 img_input = Input(shape=input_shape)
110 else:
111 if not K.is_keras_tensor(input_tensor):
~/.local/lib/python3.7/site-packages/keras/engine/topology.py in Input(shape, batch_shape, name, dtype, sparse, tensor)
1455 name=name, dtype=dtype,
1456 sparse=sparse,
-> 1457 input_tensor=tensor)
1458 # Return tensor including _keras_shape and _keras_history.
1459 # Note that in this case train_output and test_output are the same pointer.
~/.local/lib/python3.7/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your `' + object_name +
90 '` call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~/.local/lib/python3.7/site-packages/keras/engine/topology.py in __init__(self, input_shape, batch_size, batch_input_shape, dtype, input_tensor, sparse, name)
1317 if not name:
1318 prefix = 'input'
-> 1319 name = prefix + '_' + str(K.get_uid(prefix))
1320 super(InputLayer, self).__init__(dtype=dtype, name=name)
1321
~/.local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py in get_uid(prefix)
66 """
67 global _GRAPH_UID_DICTS
---> 68 graph = tf.get_default_graph()
69 if graph not in _GRAPH_UID_DICTS:
70 _GRAPH_UID_DICTS[graph] = defaultdict(int)
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'