MCPcopy
hub / github.com/open-mmlab/mmpose / PoseDataSample

Class PoseDataSample

mmpose/structures/pose_data_sample.py:9–104  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

7
8
9class 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

Callers 15

mainFunction · 0.90
visualizeFunction · 0.90
collate_pose_sequenceFunction · 0.90
preprocess_singleMethod · 0.90
forwardMethod · 0.90
transformMethod · 0.90
get_packed_inputsFunction · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
setUpMethod · 0.90
test_forwardMethod · 0.90

Calls

no outgoing calls

Tested by 7

setUpMethod · 0.72
setUpMethod · 0.72
setUpMethod · 0.72
test_forwardMethod · 0.72
get_pose_data_sampleMethod · 0.72
test_add_datasampleMethod · 0.72