Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] copy metainfo in get_data_info #2017

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions mmpose/datasets/dataset_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ def prepare_data(self, idx: int) -> Any:

data_info = self.get_data_info(idx)

# Add metainfo items that are required in the pipeline and the model
metainfo_keys = [
'upper_body_ids', 'lower_body_ids', 'flip_pairs',
'dataset_keypoint_weights', 'flip_indices'
]

for key in metainfo_keys:
data_info[key] = deepcopy(self._metainfo[key])

return self.pipeline(data_info)

def get_data_info(self, idx: int) -> dict:
Expand All @@ -109,6 +100,15 @@ def get_data_info(self, idx: int) -> dict:
# Get data sample processed by ``subset.pipeline``
data_info = self.datasets[subset_idx][sample_idx]

# Add metainfo items that are required in the pipeline and the model
metainfo_keys = [
'upper_body_ids', 'lower_body_ids', 'flip_pairs',
'dataset_keypoint_weights', 'flip_indices'
]

for key in metainfo_keys:
data_info[key] = deepcopy(self._metainfo[key])

return data_info

def full_init(self):
Expand Down
15 changes: 14 additions & 1 deletion mmpose/datasets/datasets/base/base_coco_style_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ def prepare_data(self, idx) -> Any:
"""
data_info = self.get_data_info(idx)

return self.pipeline(data_info)

def get_data_info(self, idx: int) -> dict:
"""Get data info by index.

Args:
idx (int): Index of data info.

Returns:
dict: Data info.
"""
data_info = super().get_data_info(idx)

# Add metainfo items that are required in the pipeline and the model
metainfo_keys = [
'upper_body_ids', 'lower_body_ids', 'flip_pairs',
Expand All @@ -160,7 +173,7 @@ def prepare_data(self, idx) -> Any:

data_info[key] = deepcopy(self._metainfo[key])

return self.pipeline(data_info)
return data_info

def load_data_list(self) -> List[dict]:
"""Load data list from COCO annotation file or person detection result
Expand Down