Mask_rcnn: show low detection score results

Created on 26 May 2018  路  2Comments  路  Source: matterport/Mask_RCNN

First of all, thanks for making this code public and thanks to everyone who has been contributing to it.

I am running into some issues and I wonder if some one here can enlighten me.

I am running anomaly detection on some images, and I only have one class (plus the background). All returned results seems to have detection scores higher than 0.5, even though I set DETECTION_MIN_CONFIDENCE to 0. How could I show detection with scores smaller than 0.5? Or if you are also doing something similar, are you able to showcase detection results with low scores?

Thanks!

Most helpful comment

OK I've found the cause of my problem.

If there are only two classes (one object class + background), then only detection score > 0.5 will be returned, as bboxes with detection score <0.5 will be classified as background. The detection layer removes the background bboxes and thus it only returns bboxes with detection score > 0.5.

The logic is implemented in model.refine_detections_graph.

To return everything with score < 0.5, change the first line

# Class IDs per ROI
class_ids = tf.argmax(probs, axis=1, output_type=tf.int32)

to

# Class IDs per ROI
if config.NUM_CLASSES == 2:
    class_ids = tf.ones_like(probs[:, 0], dtype=tf.int32)
else:
    class_ids = tf.argmax(probs, axis=1, output_type=tf.int32)

Basically sets all class_ids to 1 and now it returns bboxes with small detection scores. Now you can filter it with config. DETECTION_MIN_CONFIDENCE as you need.

All 2 comments

OK I've found the cause of my problem.

If there are only two classes (one object class + background), then only detection score > 0.5 will be returned, as bboxes with detection score <0.5 will be classified as background. The detection layer removes the background bboxes and thus it only returns bboxes with detection score > 0.5.

The logic is implemented in model.refine_detections_graph.

To return everything with score < 0.5, change the first line

# Class IDs per ROI
class_ids = tf.argmax(probs, axis=1, output_type=tf.int32)

to

# Class IDs per ROI
if config.NUM_CLASSES == 2:
    class_ids = tf.ones_like(probs[:, 0], dtype=tf.int32)
else:
    class_ids = tf.argmax(probs, axis=1, output_type=tf.int32)

Basically sets all class_ids to 1 and now it returns bboxes with small detection scores. Now you can filter it with config. DETECTION_MIN_CONFIDENCE as you need.

@patrick-llgc . I know it has been a while since you posted, but I have some doubts. I also have two classes(1 object class + background). Why does the model predict only objects with scores> 90%? Where should I change if I want to find results that are lower than that?

Was this page helpful?
0 / 5 - 0 ratings