Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

conv neural network - How to get the coordinates of the predicted masks

I am using mask rcnn model to detect the Foods Samples. I was able to retrieve the bounding boxes and masks, but how to get the coordinates of the two ends and the center of the masks? I want to grasp food samples, so the coordinates of the center and both ends are necessary.

Using the code below I generate boxes, masks, class_ids and scores

 def detect_image(self, image):
    image = [np.array(image)]
    molded_images, image_metas, windows = mold_inputs(self.config,image)

    image_shape = molded_images[0].shape
    anchors = get_anchors(self.config,image_shape)
    anchors = np.broadcast_to(anchors, (1,) + anchors.shape)

    detections, _, _, mrcnn_mask, _, _, _ =
        self.model.predict([molded_images, image_metas, anchors], verbose=0)

    final_rois, final_class_ids, final_scores, final_masks =
        unmold_detections(detections[0], mrcnn_mask[0],
                                image[0].shape, molded_images[0].shape,
                                windows[0])

    r = {
        "rois": final_rois,
        "class_ids": final_class_ids,
        "scores": final_scores,
        "masks": final_masks,
    }
   
   drawed_image = visualize.display_instances(image[0], r['rois'], r['masks'], r['class_ids'],
                                self.class_names, r['scores'])
question from:https://stackoverflow.com/questions/65829855/how-to-get-the-coordinates-of-the-predicted-masks

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...