(self, img, mask, sent, inference=False)
| 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): |
no outgoing calls
no test coverage detected