Converts the input image (in the form of NumPy array or PyTorch Tensor) to PIL image
| 551 | |
| 552 | |
| 553 | class ToPIL(Transform): |
| 554 | """ |
| 555 | Converts the input image (in the form of NumPy array or PyTorch Tensor) to PIL image |
| 556 | """ |
| 557 | |
| 558 | backend = [TransformBackends.NUMPY] |
| 559 | |
| 560 | def __call__(self, img): |
| 561 | """ |
| 562 | Apply the transform to `img`. |
| 563 | """ |
| 564 | if isinstance(img, PILImageImage): |
| 565 | return img |
| 566 | if isinstance(img, torch.Tensor): |
| 567 | img = img.detach().cpu().numpy() |
| 568 | return pil_image_fromarray(img) |
| 569 | |
| 570 | |
| 571 | class Transpose(Transform): |
no outgoing calls
searching dependent graphs…