[Pytorch] tensor to PIL Image
·
언어 | Framework/Pytorch
tensor to numpy output_tensor = model(data) output_tensor = output_tensor.cpu() # tensor to numpy output_tensor = torch.squeeze(output_tensor[0]) output_numpy = output_tensor.numpy() ## if output_tensor.requires_grad==True # output_numpy = output_tensor.detach().numpy() numpy to PIL Image from torchvision import transforms # numpy to PIL Image output_image = transforms.ToPILImage()(output_numpy)
woongs_93
'tensor to pil image' 태그의 글 목록