如何从 contrib.nd.MultiBoxDetection 的response 中获得 anchor box的分类信息


#1

如题
求问 如何用 contrib.nd.MultiBoxDetection 获得 anchor box 的 class id

def predict(X):
    anchors, cls_preds, bbox_preds = net(X.as_in_context(ctx))
    cls_probs = cls_preds.softmax().transpose((0, 2, 1))
    output = contrib.nd.MultiBoxDetection(cls_probs, bbox_preds, anchors)
    idx = [i for i, row in enumerate(output[0]) if row[0].asscalar() != -1]
    return output[0, idx]

output = predict(X)

def display(img, output, threshold):
    d2l.set_figsize((5, 5))
    fig = d2l.plt.imshow(img.asnumpy())
    for row in output:
        score = row[1].asscalar()
        if score < threshold:
            continue
        h, w = img.shape[0:2]
        print(row)
        bbox = [row[2:6] * nd.array((w, h, w, h), ctx=row.context)]
        d2l.show_bboxes(fig.axes, bbox, '%.2f' % score, 'w')

display(img, output, threshold=0.3)
output = contrib.nd.MultiBoxDetection(cls_probs, bbox_preds, anchors)

这里output[2:6] 是bounding box 那请问 output[0], output[1]是什么 ? 根据print 的结果来看我猜output[1] 是anchor box 分类的 maximum probability. 请问如何这道到底是哪一类 ?