mrcnn_serving_ready icon indicating copy to clipboard operation
mrcnn_serving_ready copied to clipboard

output_names=[out.op.name for out in model.outputs][:4] should be modified to get the 5 loss nodes

Open cpoptic opened this issue 4 years ago • 2 comments

Line 50 of main.py:

def freeze_model(model, name):
    frozen_graph = freeze_session(
        sess,
        output_names=[out.op.name for out in model.outputs][:4])

Correct me if I'm wrong, but using the first 4 output names [:4] of your output_names is not guaranteed to get the correct output node names.

What we really want are the 5 output nodes regarding Mask RCNN loss:

rpn_class_loss rpn_bbox_loss mrcnn_class_loss mrcnn_bbox_loss mrcnn_mask_loss

When I run [out.op.name for out in keras_model.model.outputs] I get 14 output nodes:

['rpn_class_logits/concat', 'rpn_class/concat', 'rpn_bbox/concat', 'mrcnn_class_logits/Reshape_1', 'mrcnn_class/Reshape_1', 'mrcnn_bbox/Reshape', 'mrcnn_mask/Reshape_1', 'ROI/packed_2', 'output_rois/mul', 'rpn_class_loss/cond/Merge', 'rpn_bbox_loss/cond/Merge', 'mrcnn_class_loss/truediv', 'mrcnn_bbox_loss/Mean', 'mrcnn_mask_loss/Mean']

So, at least for this particular model, the desired output nodes are actually the last 5 of these nodes: `output_names=[out.op.name for out in model.outputs][-5:])

Am I missing something?

cpoptic avatar Oct 16 '19 23:10 cpoptic

When I added and run

# main.py  line no: 48
 print([out.op.name for out in model.outputs])

I am getting this values ['mrcnn_detection/Reshape_1', 'mrcnn_class/Reshape_1', 'mrcnn_bbox/Reshape', 'mrcnn_mask/Reshape_1', 'ROI/packed_2', 'rpn_class/concat', 'rpn_bbox/concat'] So all we need is the first four output values i.e: mrcnn_detection, mrcnn_class, mrcnn_bbox, mrcnn_mask. I am not sure how you got those many values. You can replicate the above print statement and check. `

bendangnuksung avatar Oct 17 '19 16:10 bendangnuksung

I think you are running an older version perhaps. Because. Using the code you have used above, even I am getting 14 tensors for output

sourcedexter avatar Oct 24 '19 08:10 sourcedexter