Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limitation of number of predictions in Tensorflow Object Detection API

I’ve trained a Faster R-CNN model with Tensorflow Object Detection API with and encountered a strange issue. The output of the model has max 100 predictions, despite, there are many more objects in the image. This is a case for each image I’ve tested.

I’ve found similar issue on Ten GitHub, but from what I can see they are not doing much in these regards. https://github.com/tensorflow/tensorflow/issues/30464

Maybe you had a similar issue in the past? Any idea how to tackle this?

example image

like image 626
Konrad Avatar asked Nov 24 '25 02:11

Konrad


1 Answers

The limit of 100 is per class, then you have a max total detections of 300.

This is a network configuration parameter set in the pipeline.config file, in the second_stage_post_processing section. For example, the current faster_rcnn_inception_v2_coco.config has:

second_stage_post_processing {
      batch_non_max_suppression {
        score_threshold: 0.0
        iou_threshold: 0.6
        max_detections_per_class: 100
        max_total_detections: 300
      }
      score_converter: SOFTMAX
    }

Alter these values before you train your net (although I don't know how changing them affects the network size and/or whether it causes problems when using pretrained checkpoints for fine-tuning)

like image 124
GPhilo Avatar answered Nov 25 '25 14:11

GPhilo