I am running testing MASK_RCNN on my local computer and on a remote machine.
In inspect_model everything runs fine locally but on the remote machine I get an assertion error at ### 1.b RPN Predictions:
# Run RPN sub-graph
pillar = model.keras_model.get_layer("ROI").output # node to start searching from
rpn = model.run_graph([image], [
("rpn_class", model.keras_model.get_layer("rpn_class").output),
("pre_nms_anchors", model.ancestor(pillar, "ROI/pre_nms_anchors:0")),
("refined_anchors", model.ancestor(pillar, "ROI/refined_anchors:0")),
("refined_anchors_clipped", model.ancestor(pillar, "ROI/refined_anchors_clipped:0")),
("post_nms_anchor_ix", model.ancestor(pillar, "ROI/rpn_non_max_suppression:0")),
("proposals", model.keras_model.get_layer("ROI").output),
])
=>
AssertionError Traceback (most recent call last)
<ipython-input-14-799ca4676404> in <module>()
7 ("refined_anchors_clipped", model.ancestor(pillar, "ROI/refined_anchors_clipped:0")),
8 ("post_nms_anchor_ix", model.ancestor(pillar, "ROI/rpn_non_max_suppression:0")),
----> 9 ("proposals", model.keras_model.get_layer("ROI").output),
10 ])
/home/orestisz/repositories/Mask_RCNN/model.py in run_graph(self, images, outputs)
2296 for o in outputs.values():
2297 print(o)
-> 2298 assert o is not None
2299
2300 # Build a Keras function to run parts of the computation graph
AssertionError:
when printing the outputs:
for o in outputs.values():
print(o)
assert o is not None
I get the following output locally:
Tensor("rpn_class/concat:0", shape=(?, ?, 2), dtype=float32, device=/device:CPU:0)
Tensor("ROI/pre_nms_anchors:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
Tensor("ROI/refined_anchors:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
Tensor("ROI/refined_anchors_clipped:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
Tensor("ROI/rpn_non_max_suppression:0", shape=(?,), dtype=int32, device=/device:CPU:0)
Tensor("ROI/packed_2:0", shape=(1, ?, 4), dtype=float32, device=/device:CPU:0)
and the following remotely:
Tensor("rpn_class/concat:0", shape=(?, ?, 2), dtype=float32, device=/device:CPU:0)
Tensor("ROI/pre_nms_anchors:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
Tensor("ROI/refined_anchors:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
Tensor("ROI/refined_anchors_clipped:0", shape=(1, 10000, 4), dtype=float32, device=/device:CPU:0)
None
So looks like ("post_nms_anchor_ix", model.ancestor(pillar, "ROI/rpn_non_max_suppression:0")) is causing the issue.
Any suggestions? Thanks in advance
I am getting the same error when I run 1.b RPN Predictions

Any suggestions?
Can you provide more details about your setup?
Actually, I think I found the problem. TensorFlow 1.4 introduces a new version of the non-max-suppression operation with a new name. I just pushed a fix to handle the the 1.4 new name.
@waleedka thanks a lot for the fix!
But I think you wanted to type this:
nms_node = (model.ancestor(pillar, "ROI/rpn_non_max_suppression:0")
or model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV2:0"))
instead of:
nms_node = (ancestor(model, pillar, "ROI/rpn_non_max_suppression:0")
or ancestor(model, pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV2:0"))
?
You're right. Thank you. Pushed another fix.
@zamponotiropita Hi, do you meet this issue #285 , when I feed the run_graph with 2 images, it still outputs 1 batch_size. Any suggestion will be appreciated.
Just want to add that with tensorflow 1.9 it is now NonMaxSuppressionV3:0, so the code should be:
nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression:0")
if nms_node is None:
nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV2:0")
if nms_node is None:
nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV3:0")
Just want to add that with tensorflow 1.9 it is now NonMaxSuppressionV3:0, so the code should be:
nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression:0") if nms_node is None: nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV2:0") if nms_node is None: nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV3:0")
Yeah锛宼his helps me a lot,especially there is no answer among the Baidu or Google.I guess this bug due to the "version" will always confuse the newbie like me
Just want to add that with tensorflow 1.9 it is now NonMaxSuppressionV3:0, so the code should be:
nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression:0") if nms_node is None: nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV2:0") if nms_node is None: nms_node = model.ancestor(pillar, "ROI/rpn_non_max_suppression/NonMaxSuppressionV3:0")
Much appreciated for your answer. It works for me
Most helpful comment
Just want to add that with tensorflow 1.9 it is now NonMaxSuppressionV3:0, so the code should be: