SpriteDX Anti-Corruption Model v1.1.3
Pixel art restoration model that performs both quantization (denoising/sharpening) and optional background matting.
Model Description
- Architecture: U-Net with residual connections
- Input: 128x128 RGBA (4 channels)
- Output: 128x128 RGBA (4 channels)
- Training: Mixed dataset strategy with 50/50 split between:
- Background matting task (composited images)
- Quantization task (transparent images)
Capabilities
- Pixel Art Quantization: Removes blur, noise, and interpolation artifacts
- Background Matting: Extracts transparency from composited images
- Unified Processing: Handles both tasks in a single forward pass
Usage
import torch
from PIL import Image
import numpy as np
# Load model (you'll need the model architecture from train_v1.1.3.py)
from train_v1_1_1 import AntiCorruptionUNet
model = AntiCorruptionUNet()
checkpoint = torch.load("model.safetensors")
model.load_state_dict(checkpoint)
model.eval()
# Process image
image = Image.open("input.png").convert("RGBA")
image_tensor = torch.from_numpy(
np.array(image, dtype=np.float32).transpose(2, 0, 1) / 255.0
).unsqueeze(0)
with torch.no_grad():
output = model(image_tensor)
output = model.post_process(output)
# Convert back to PIL
output_np = output[0].permute(1, 2, 0).numpy()
output_np = np.clip(output_np * 255, 0, 255).astype(np.uint8)
output_image = Image.fromarray(output_np, mode='RGBA')
Training Details
- Corruption pipeline: nearest neighbor upscaling โ noise โ blur โ translation โ bicubic downscaling
- Loss: Weighted RGB + Alpha loss with contrast and whiteness weighting
- Data augmentation: Color shifts, flips, grayscale conversion
Limitations
- Input must be 128x128 pixels
- Best results on pixel art and sprites
- May struggle with very complex transparency patterns
License
MIT
- Downloads last month
- 5