1
image_id = random.choice(dataset.image_ids)
print(image_id)
image, image_meta, gt_class_id, gt_bbox, gt_mask = modellib.load_image_gt(dataset, 
config, image_id)
info = dataset.image_info[image_id]
print("image ID: {}.{} ({}) {}".format(info["source"], info["id"], image_id, 
                                   dataset.image_reference(image_id)))
print("Original image shape: ", modellib.parse_image_meta(image_meta[np.newaxis,...]) 
["original_image_shape"][0])

# Run object detection
results = model.detect_molded(np.expand_dims(image, 0), np.expand_dims(image_meta, 0), 
verbose=1)

# Display results
r = results[0]
log("gt_class_id", gt_class_id)
log("gt_bbox", gt_bbox)
log("gt_mask", gt_mask)
ax = get_ax(1)
# Compute AP over range 0.5 to 0.95 and print it
utils.compute_ap_range(gt_bbox, gt_class_id, gt_mask,
                   r['rois'], r['class_ids'], r['scores'], r['masks'],
                   verbose=1)


visualize.display_differences(
  image,
  gt_bbox, gt_class_id, gt_mask,
  r['rois'], r['class_ids'], r['scores'], r['masks'],
  dataset.class_names, ax=ax,
  show_box=False, show_mask=False,
  iou_threshold=0.5, score_threshold=0.5)
'''


   200
    image ID: nodule.279 (200) 279
    Original image shape:  [512 512   3]
    Processing 1 images
    image                    shape: (1024, 1024, 3)       min:    1.00000  max:  251.00000  uint8
    molded_images            shape: (1, 1024, 1024, 3)    min:    1.00000  max:  251.00000  uint8
    image_metas              shape: (1, 14)               min:    0.00000  max: 1024.00000  float64
    anchors                  shape: (1, 261888, 4)        min:   -0.08847  max:    1.02591  float32
    gt_class_id              shape: (1,)                  min:    1.00000  max:    1.00000  int32
    gt_bbox                  shape: (1, 4)                min:  576.00000  max:  730.00000  int32
    gt_mask                  shape: (56, 56, 1)           min:    0.00000  max:    1.00000  bool
Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-32-cdafc2e3f205> in <module>
     19 utils.compute_ap_range(gt_bbox, gt_class_id, gt_mask,
     20                        r['rois'], r['class_ids'], r['scores'], r['masks'],
---> 21                        verbose=1)
     22 # #print(gt_mask.shape,r['masks'].shape)
     23 # #import cv2

c:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mask_rcnn-2.1-py3.7.egg\mrcnn\utils.py in compute_ap_range(gt_box, gt_class_id, gt_mask, pred_box, pred_class_id, pred_score, pred_mask, iou_thresholds, verbose)
    765             compute_ap(gt_box, gt_class_id, gt_mask,
    766                         pred_box, pred_class_id, pred_score, pred_mask,
--> 767                         iou_threshold=iou_threshold)
    768         if verbose:
    769             print("AP @{:.2f}:\t {:.3f}".format(iou_threshold, ap))

c:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mask_rcnn-2.1-py3.7.egg\mrcnn\utils.py in compute_ap(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold)
    728         gt_boxes, gt_class_ids, gt_masks,
    729         pred_boxes, pred_class_ids, pred_scores, pred_masks,
--> 730         iou_threshold)
    731 
    732     # Compute precision and recall at each prediction box step

''' how can i solve this error c:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\mask_rcnn-2.1-py3.7.egg\mrcnn\utils.py in compute_matches(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold, score_threshold) 680 ... 117 overlaps = intersections / union

<array_function internals> in dot(*args, **kwargs)

ValueError: shapes (5,1048576) and (3136,1) not aligned: 1048576 (dim 1) != 3136 (dim 0)

cide12
  • 11
  • 1

0 Answers0