Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add raw_ann_info
Browse files Browse the repository at this point in the history
Ben-Louis committed Jan 16, 2023
1 parent 576a046 commit ac1f68f
Showing 4 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mmpose/datasets/datasets/base/base_coco_style_dataset.py
Original file line number Diff line number Diff line change
@@ -357,7 +357,8 @@ def _get_bottomup_data_infos(self, instance_list: List[Dict],
data_info_bu = {
'img_id': img_info['img_id'],
'img_path': img_info['img_path'],
'id': [-1],
'id': list(),
'raw_ann_info': None,
}
data_list_bu.append(data_info_bu)

6 changes: 3 additions & 3 deletions mmpose/datasets/datasets/body/mpii_dataset.py
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:

instance_list = []
image_list = []
used_image_ids = set()
used_img_ids = set()
ann_id = 0

# mpii bbox scales are normalized with factor 200.
@@ -197,8 +197,8 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
head_size *= SC_BIAS
instance_info['head_size'] = head_size.reshape(1, -1)

if instance_info['img_id'] not in used_image_ids:
used_image_ids.add(instance_info['img_id'])
if instance_info['img_id'] not in used_img_ids:
used_img_ids.add(instance_info['img_id'])
image_list.append({
'img_id': instance_info['img_id'],
'img_path': instance_info['img_path'],
6 changes: 3 additions & 3 deletions mmpose/datasets/datasets/body/mpii_trb_dataset.py
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:

instance_list = []
image_list = []
used_image_ids = set()
used_img_ids = set()

# mpii-trb bbox scales are normalized with factor 200.
pixel_std = 200.
@@ -157,8 +157,8 @@ def _load_annotations(self) -> Tuple[List[dict], List[dict]]:
ann['headbox'], dtype=np.float32)

instance_list.append(instance_info)
if instance_info['img_id'] not in used_image_ids:
used_image_ids.add(instance_info['img_id'])
if instance_info['img_id'] not in used_img_ids:
used_img_ids.add(instance_info['img_id'])
image_list.append({
'img_id': instance_info['img_id'],
'img_path': instance_info['img_path'],
5 changes: 5 additions & 0 deletions mmpose/evaluation/metrics/coco_metric.py
Original file line number Diff line number Diff line change
@@ -273,6 +273,11 @@ def gt_to_coco_json(self, gt_dicts: Sequence[dict],

# filter duplicate annotations
for ann in gt_dict['raw_ann_info']:
if ann is None:
# during evaluation on bottom-up datasets, some images
# do not have instance annotation
continue

annotation = dict(
id=ann['id'],
image_id=ann['image_id'],

0 comments on commit ac1f68f

Please sign in to comment.