FastMaskRCNN icon indicating copy to clipboard operation
FastMaskRCNN copied to clipboard

how to test data ??

Open iFighting opened this issue 7 years ago • 2 comments

how to test data ??

iFighting avatar Aug 17 '17 03:08 iFighting

I can load the model from this Checkpoint (https://github.com/CharlesShang/FastMaskRCNN/issues/86#issuecomment-309022377), and get predictions from it. However, I can only get predictions for an output_tensor before the ROIAlign layer, but not for any tensor in the graph after that layer. Example:

# this works
output_tensor = graph.get_tensor_by_name("pyramid_1/ROIAlign_2/Crop:0")
# this doesn't work
output_tensor = graph.get_tensor_by_name("pyramid_1/ROIAlign_2/Reshape_2:0")

There's a bug in the ROIAlign layer with the py_func used to generate anchors.

  • My understanding is that the py_fun is not stored in the graph and cannot be reconstructed.
  • Or is this bug related to casting anchor coordinates to ints?
  • Can anyone here (@amirbar, @sairin1202 , @hari-sikchi , @Cangrc , @mariolew , @cuihuitao) try to load the graph this way, and reproduce the error / find a workaround ?
tf.reset_default_graph()
checkpoint_dir = "/my/directory/for/segmentation/FastMaskRCNN/output/mask_rcnn/500k/"
meta_file_path = checkpoint_dir + "coco_resnet50_model.ckpt-499999.meta"
ckpt_file_path = checkpoint_dir + "coco_resnet50_model.ckpt-499999"

# load graph
saver = tf.train.import_meta_graph(meta_file_path, clear_devices=True)
graph = tf.get_default_graph()

# initialize and load weights
sess =  tf.Session()
sess.run(tf.global_variables_initializer())
saver.restore(sess, ckpt_file_path)

# Input images
input_tensor = graph.get_tensor_by_name("Reshape_2:0")
output_tensor = graph.get_tensor_by_name("pyramid_2/MaskEncoder/Reshape_2:0")

# Mask output 
results = sess.run(
    [output_tensor],
    #[tf.reduce_mean(input_tensor)],
    feed_dict={input_tensor:images}
)

simaoh avatar Aug 18 '17 18:08 simaoh

@simaoh Hi,simaoh , have you fixed it? are you able to test your own image now?

y-dep avatar Sep 24 '17 12:09 y-dep