The base data structure of MMPose that is used as the interface between modules. The attributes of ``PoseDataSample`` includes: - ``gt_instances``(InstanceData): Ground truth of instances with keypoint annotations - ``pred_instances``(InstanceData): Instances wi
| 7 | |
| 8 | |
| 9 | class PoseDataSample(BaseDataElement): |
| 10 | """The base data structure of MMPose that is used as the interface between |
| 11 | modules. |
| 12 | |
| 13 | The attributes of ``PoseDataSample`` includes: |
| 14 | |
| 15 | - ``gt_instances``(InstanceData): Ground truth of instances with |
| 16 | keypoint annotations |
| 17 | - ``pred_instances``(InstanceData): Instances with keypoint |
| 18 | predictions |
| 19 | - ``gt_fields``(PixelData): Ground truth of spatial distribution |
| 20 | annotations like keypoint heatmaps and part affine fields (PAF) |
| 21 | - ``pred_fields``(PixelData): Predictions of spatial distributions |
| 22 | |
| 23 | Examples: |
| 24 | >>> import torch |
| 25 | >>> from mmengine.structures import InstanceData, PixelData |
| 26 | >>> from mmpose.structures import PoseDataSample |
| 27 | |
| 28 | >>> pose_meta = dict(img_shape=(800, 1216), |
| 29 | ... crop_size=(256, 192), |
| 30 | ... heatmap_size=(64, 48)) |
| 31 | >>> gt_instances = InstanceData() |
| 32 | >>> gt_instances.bboxes = torch.rand((1, 4)) |
| 33 | >>> gt_instances.keypoints = torch.rand((1, 17, 2)) |
| 34 | >>> gt_instances.keypoints_visible = torch.rand((1, 17, 1)) |
| 35 | >>> gt_fields = PixelData() |
| 36 | >>> gt_fields.heatmaps = torch.rand((17, 64, 48)) |
| 37 | |
| 38 | >>> data_sample = PoseDataSample(gt_instances=gt_instances, |
| 39 | ... gt_fields=gt_fields, |
| 40 | ... metainfo=pose_meta) |
| 41 | >>> assert 'img_shape' in data_sample |
| 42 | >>> len(data_sample.gt_instances) |
| 43 | 1 |
| 44 | """ |
| 45 | |
| 46 | @property |
| 47 | def gt_instances(self) -> InstanceData: |
| 48 | return self._gt_instances |
| 49 | |
| 50 | @gt_instances.setter |
| 51 | def gt_instances(self, value: InstanceData): |
| 52 | self.set_field(value, '_gt_instances', dtype=InstanceData) |
| 53 | |
| 54 | @gt_instances.deleter |
| 55 | def gt_instances(self): |
| 56 | del self._gt_instances |
| 57 | |
| 58 | @property |
| 59 | def gt_instance_labels(self) -> InstanceData: |
| 60 | return self._gt_instance_labels |
| 61 | |
| 62 | @gt_instance_labels.setter |
| 63 | def gt_instance_labels(self, value: InstanceData): |
| 64 | self.set_field(value, '_gt_instance_labels', dtype=InstanceData) |
| 65 | |
| 66 | @gt_instance_labels.deleter |
no outgoing calls