Return smaller array for box_ids, scores, bboxes

Hi there, I’m using gluon and a pretrained ssd model for object detection.

I’m running code similar to this:
from matplotlib import pyplot as plt
import gluoncv
from gluoncv import model_zoo, data, utils

net = model_zoo.get_model('faster_rcnn_resnet50_v1b_voc', pretrained=True)

im_fname ='' +
x, orig_img = data.transforms.presets.rcnn.load_test(im_fname)

box_ids, scores, bboxes = net(x)
ax = utils.viz.plot_bbox(orig_img, bboxes[0], scores[0], box_ids[0], class_names=net.classes)

When running net(x) a large array of 80000 is returned for box_ids, scores and bboxes. This takes a long time for the model to compute. How can I set it so that a smaller array is returned?


You could try changing some of Faster RCNNs parameter e.g.

I’ve just tried changing nms_topk & post_nms to 5 (from -1 as the default, letting any amount of classes) however it still returns 80000 scores, many of which have a value of -1…

Any suggestions on other parameters I could change?