MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / load_data

Method load_data

datasets/AGORA_MM.py:81–380  ·  view source on GitHub ↗
(self, train_sample_interval=1)

Source from the content-addressed store, hash-verified

79
80
81 def load_data(self, train_sample_interval=1):
82
83 content = np.load(self.annot_path, allow_pickle=True)
84
85 try:
86 frame_range = content['frame_range']
87 except KeyError:
88 frame_range = \
89 np.array([[i, i + 1] for i in range(self.num_data)])
90
91 num_examples = len(frame_range)
92
93 if 'meta' in content:
94 meta = content['meta'].item()
95 print('meta keys:', meta.keys())
96 else:
97 meta = None
98 print(
99 'No meta info provided! Please give height and width manually')
100
101 print(
102 f'Start loading humandata {self.annot_path} into memory...\nDataset includes: {content.files}'
103 )
104 tic = time.time()
105 image_path = content['image_path']
106
107 if meta is not None and 'height' in meta:
108 height = np.array(meta['height'])
109 width = np.array(meta['width'])
110 image_shape = np.stack([height, width], axis=-1)
111 else:
112 image_shape = None
113
114 if meta is not None and 'gender' in meta and len(meta['gender']) != 0:
115 gender = meta['gender']
116 else:
117 gender = None
118
119 if meta is not None and 'is_kid' in meta and len(meta['is_kid']) != 0:
120 is_kid = meta['is_kid']
121 else:
122 is_kid = None
123
124 bbox_xywh = content['bbox_xywh']
125
126 if 'smplx' in content:
127 smplx = content['smplx'].item()
128 as_smplx = 'smplx'
129 elif 'smpl' in content:
130 smplx = content['smpl'].item()
131 as_smplx = 'smpl'
132 elif 'smplh' in content:
133 smplx = content['smplh'].item()
134 as_smplx = 'smplh'
135 # TODO: temp solution, should be more general. But SHAPY is very special
136 elif self.__class__.__name__ == 'SHAPY':
137 smplx = {}
138 else:

Callers 1

__init__Method · 0.95

Calls 6

process_bboxFunction · 0.90
printFunction · 0.50
loadMethod · 0.45
keysMethod · 0.45
decompress_keypointsMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected