Skip to content

Latest commit

 

History

History
78 lines (28 loc) · 818 Bytes

02.01-xt-from-image.md

File metadata and controls

78 lines (28 loc) · 818 Bytes
1. Title & Purpose
# XT from Image

This document explains how to Extracts `xt` from an image using the DiffAE model.
## Extracting xt from an Image

  


  

```python

from PIL import Image

import torch

from torchvision.transforms import functional as VF

from templates import ffhq256_autoenc, LitModel

  

device = 'cuda'

conf = ffhq256_autoenc()

model = LitModel(conf)


  

# Load Image

img = Image.open('example.jpg').resize((256, 256)).convert('RGB')

  

# Convert to Tensor

x = VF.to_tensor(img).unsqueeze(0).to(device)

  

# Encode

xt = model.encode_stochastic(x, cond, T=250)
4. Expected Output
## Expected Output

- The variable `xt`  different timesteps contains progressively noisier representations of the image.