In [9]:
from PIL import Image
import requests
import numpy as np
image_url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(image_url, stream=True).raw)
image
Out[9]:
In [11]:
import matplotlib.pyplot as plt
x_start = transform(image).unsqueeze(0)
x_start.shape
# e.g. sample a noised image at timestep 40
noised_image = sample_noised_image(x_start, timestep=torch.tensor([40]), noise=None)
noised_image.shape
reverse_transform(noised_image.squeeze())
Out[11]: