MCPcopy Create free account
hub / github.com/MotrixLab/MotionDiffuse / __getitem__

Method __getitem__

text2motion/datasets/evaluator.py:113–130  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

111
112
113 def __getitem__(self, item):
114 data = self.generated_motion[item]
115 motion, m_length, caption, tokens = data['motion'], data['length'], data['caption'], data['tokens']
116 sent_len = data['cap_len']
117 pos_one_hots = []
118 word_embeddings = []
119 for token in tokens:
120 word_emb, pos_oh = self.w_vectorizer[token]
121 pos_one_hots.append(pos_oh[None, :])
122 word_embeddings.append(word_emb[None, :])
123 pos_one_hots = np.concatenate(pos_one_hots, axis=0)
124 word_embeddings = np.concatenate(word_embeddings, axis=0)
125
126 if m_length < self.opt.max_motion_length:
127 motion = np.concatenate([motion,
128 np.zeros((self.opt.max_motion_length - m_length, motion.shape[1]))
129 ], axis=0)
130 return word_embeddings, pos_one_hots, caption, sent_len, motion, m_length, '_'.join(tokens)
131
132
133def collate_fn(batch):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected