MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / load_anno

Method load_anno

mogen/datasets/text_motion_dataset.py:58–85  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

56 test_mode=test_mode)
57
58 def load_anno(self, name):
59 results = {}
60 if self.siamese_mode:
61 motion_path = os.path.join(self.motion_dir, name + '.npz')
62 motion_data = np.load(motion_path)
63 results['motion1'] = motion_data['motion1']
64 results['motion2'] = motion_data['motion2']
65 assert results['motion1'].shape == results['motion2'].shape
66 else:
67 motion_path = os.path.join(self.motion_dir, name + '.npy')
68 motion_data = np.load(motion_path)
69 results['motion'] = motion_data
70 text_path = os.path.join(self.text_dir, name + '.txt')
71 text_data = []
72 for line in open(text_path, 'r'):
73 text_data.append(line.strip())
74 results['text'] = text_data
75 if self.token_dir is not None:
76 token_path = os.path.join(self.token_dir, name + '.txt')
77 token_data = []
78 for line in open(token_path, 'r'):
79 token_data.append(line.strip())
80 results['token'] = token_data
81 if self.clip_feat_dir is not None:
82 clip_feat_path = os.path.join(self.clip_feat_dir, name + '.npy')
83 clip_feat = torch.from_numpy(np.load(clip_feat_path))
84 results['clip_feat'] = clip_feat
85 return results
86
87 def prepare_data(self, idx: int):
88 """"Prepare raw data for the f'{idx'}-th data."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected