(url, size=(384, 384))
| 345 | return img |
| 346 | |
| 347 | def url_to_torch(url, size=(384, 384)): |
| 348 | img = get_image_from_url(url) |
| 349 | img = img.resize(size, Image.ANTIALIAS) |
| 350 | img = torch.from_numpy(np.asarray(img)).float() |
| 351 | img = img.permute(2, 0, 1) |
| 352 | img.div_(255) |
| 353 | return img |
| 354 | |
| 355 | def pil_to_batched_tensor(img): |
| 356 | return ToTensor()(img).unsqueeze(0) |
nothing calls this directly
no test coverage detected