YueLiao / CDN

Code for "Mining the Benefits of Two-stage and One-stage HOI Detection"
Apache License 2.0
89 stars 15 forks source link

In `SetCriterionHOI` `__init__`, how the initial object (`self.obj_nums_init`) and verb (`self.verb_nums_init`) numbers are set? #32

Open Lopa07 opened 2 months ago

Lopa07 commented 2 months ago

In SetCriterionHOI __init__, how the initial object (self.obj_nums_init) and verb (self.verb_nums_init) initial numbers are set? There two arrays for HICO-DET and V-COCO are hard coded here.

Are these just counts over categories from ground truth annotations? I performed an count for the verb categories using the following code snippet. This computation is done at the end of HICODetection __init__ here.

      from collections import Counter
      hoi_annotations = [
          ann['hoi_category_id']
          for annotation in self.annotations
          for ann in annotation['hoi_annotation']
      ]
      hoi_annotations_valid = {
          k: v
          for k, v in Counter(hoi_annotations).items()
          if k in self._valid_verb_ids
      }
      verb_nums = [(k, hoi_annotations_valid[k]) for k in self._valid_verb_ids]
verb_nums = [
(1, 176), (2, 98), (3, 56), (4, 181), (5, 198), (6, 75), (7, 284), (8, 319), (9, 4), (10, 274),
(11, 23), (12, 1995), (13, 138), (14, 121), (15, 27), (16, 17), (17, 116), (18, 87), (19, 2206), (20, 1904),
(21, 2250), (22, 180), (23, 2), (24, 396), (25, 45), (26, 257), (27, 127), (28, 5), (29, 16), (30, 439),
(31, 85), (32, 103), (33, 214), (34, 39), (35, 117), (36, 11), (37, 176), (38, 63), (39, 4051), (40, 757),
(41, 380), (42, 2385), (43, 1626), (44, 44), (45, 2), (46, 401), (47, 154), (48, 160), (49, 540), (50, 51),
(51, 7), (52, 17), (53, 23), (54, 527), (55, 247), (56, 6), (57, 463), (58, 29), (59, 27), (60, 71),
(61, 1519), (62, 992), (63, 6), (64, 1), (65, 226), (66, 27), (67, 1), (68, 367), (69, 60), (70, 94),
(71, 1), (72, 22), (73, 26), (74, 591), (75, 175), (76, 1051), (77, 1), (78, 4), (79, 158), (80, 76),
(81, 6), (82, 70), (83, 49), (84, 3), (85, 1), (86, 102), (87, 52), (88, 112), (89, 80), (90, 1266),
(91, 1), (92, 327), (93, 28), (94, 228), (95, 913), (96, 55), (97, 10), (98, 245), (99, 96), (100, 5),
(101, 5), (102, 52), (103, 32), (104, 49), (105, 6), (106, 127), (107, 504), (108, 5), (109, 2338), (110, 3209),
(111, 235), (112, 97), (113, 2), (114, 12), (115, 11), (116, 326), (117, 26)
]

As shown above, the obtained verb_nums did not match self.verb_nums_init here.