I am trying to use the matterport code for Mask-RCNN of as modified for tensorflow 2.0 in [https://github.com/ahmedfgad/Mask-RCNN-TF2][1]
but i am getting this error:
Traceback (most recent call last):
File "samples/balloon/tumour.py", line 386, in <module>
model = modellib.MaskRCNN(mode="training", config=config,
File "/usr/local/lib/python3.8/dist-packages/mask_rcnn_tf2-1.0-py3.8.egg/mrcnn/model.py", line 1837, in __init__
File "/usr/local/lib/python3.8/dist-packages/mask_rcnn_tf2-1.0-py3.8.egg/mrcnn/model.py", line 1934, in build
File "/home/tzikos/.local/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 922, in __call__
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/home/tzikos/.local/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 889, in call
self._check_variables(created_variables, tape.watched_variables())
File "/home/tzikos/.local/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 916, in _check_variables
raise ValueError(error_str)
ValueError:
The following Variables were created within a Lambda layer (anchors)
but are not tracked by said layer:
<tf.Variable 'anchors/Variable:0' shape=(2, 261888, 4) dtype=float32>
The layer cannot safely ensure proper Variable reuse across multiple
calls, and consquently this behavior is disallowed for safety. Lambda
layers are not well suited to stateful computation; instead, writing a
subclassed Layer is the recommend way to define layers with
Variables.
Now i tried out this solutions:
[https://stackoverflow.com/questions/65073434/why-keras-lambda-layer-cause-problem-mask-rcnn][2] and here:[https://github.com/matterport/Mask_RCNN/issues/1930][3]
where they modify a specific line.
I changed that in both instances of model.py i found in the directory of mask-rcnn but i could not find the case specified in the usr/local/bin/.... . It errored that it did not recognize the mrcnn directory.
The error persists and i cannot find or think of anything else to use . Can you please help me ?
[1]: https://github.com/ahmedfgad/Mask-RCNN-TF2
[2]: Why Keras Lambda-Layer cause problem Mask_RCNN?
[3]: https://github.com/matterport/Mask_RCNN/issues/1930
question from:
https://stackoverflow.com/questions/65860271/error-with-lambda-layer-in-tensorflow-2-0-using-mask-rcnn 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…