xingyizhou / GTR

Global Tracking Transformers, CVPR 2022
374 stars 57 forks source link

results_per_category only contains 296 classes during evaluation on TAO val set #37

Open HanGuangXin opened 2 years ago

HanGuangXin commented 2 years ago

Hi, sorry to bother you. But I have a small question about the evaluation on TAO val set.

As we all know, there are 482 categories in LVISv0.5 which are included in TAO. So when using LVISv1.0 as in GTR, is it correct that there are only 296 classes in LVISv1.0 which are included in TAO? I'm not sure whether there are some categories are missed.

The related code is here:

    precisions = lvis_eval.eval['precision']
    assert len(class_names) == precisions.shape[2]
    results_per_category = []
    id2apiid = sorted(lvis_gt.get_cat_ids())
    inst_aware_ap, inst_count = 0, 0
    for idx, name in enumerate(class_names):
        precision = precisions[:, :, idx, 0]
        precision = precision[precision > -1]
        ap = np.mean(precision) if precision.size else float("nan")
        inst_num = len(lvis_gt.get_ann_ids(cat_ids=[id2apiid[idx]]))
        if inst_num > 0:
            results_per_category.append(("{} {}".format(
                name, 
                inst_num if inst_num < 1000 else '{:.1f}k'.format(inst_num / 1000)), 
                float(ap * 100)))
            inst_aware_ap += inst_num * ap
            inst_count += inst_num