MCPcopy Create free account
hub / github.com/SooLab/CGFormer / convert

Method convert

utils/dataset.py:164–173  ·  view source on GitHub ↗
(self, img, mask, sent, inference=False)

Source from the content-addressed store, hash-verified

162 return ori_img, img, word_vecs, mask, pad_masks, seg_id, sents,
163
164 def convert(self, img, mask, sent, inference=False):
165 img = Image.fromarray(np.uint8(img))
166 mask = Image.fromarray(np.uint8(mask), mode="P")
167 img = F.resize(img, self.input_size)
168 if not inference:
169 mask = F.resize(mask, self.input_size, interpolation=Image.NEAREST)
170 img = F.to_tensor(img)
171 mask = torch.as_tensor(np.asarray(mask).copy(), dtype=torch.int64)
172 img = F.normalize(img, mean=self.mean, std=self.std)
173 return img, mask, sent
174
175
176 def __repr__(self):

Callers 2

__getitem__Method · 0.95
colorizeFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected