MiniDF pixel map — FLUX.2 klein 4B LoRA
Turns an oblique 3D map render into the isometric pixel-art look of the MiniDF map of Brasília, which Codex paints frame by frame. Image-to-image LoRA: 3D render in, painting out, roads and buildings kept in place.
Current pick of a three-model comparison (FLUX.2 klein 4B vs Qwen Image 2.1 vs Qwen-Image-Edit-2511); training log and test sheets: marceloeduardo.com/pixel-lora-training.html.
| 3D input | Codex (target) | this LoRA |
|---|---|---|
Copan, São Paulo: a test frame never seen in training.
Use
import torch
from diffusers import Flux2KleinPipeline
from PIL import Image
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-4B", torch_dtype=torch.bfloat16).to("cuda")
pipe.load_lora_weights("handful/mndf-pixel-flux2-klein-4b")
render = Image.open("render.jpg").convert("RGB") # 1024x1024 oblique 3D render
out = pipe(image=render, prompt="Repaint this 3D map render as mndfstyle isometric pixel-art map, keeping every road, building and tree in place",
width=1024, height=1024, num_inference_steps=28, guidance_scale=1.5).images[0]
out.save("painted.png")
Use guidance 1.5: at 4.0 colours over-saturate (test LPIPS 0.428 vs 0.409 on a 20-frame check).
Training
diffusers train_dreambooth_lora_flux2_klein_img2img.py · rank 16 · alpha 16 · lr 1e-4 constant · random flip · 1024 px · batch 1 · 2,500 steps (1 h on one RTX PRO 6000) · 1,959 pairs.
Evaluation
Test LPIPS (VGG, 512 px, lower is closer to Codex) on a frozen held-out set, mean over five groups: 0.389 (Brasília 0.396, Brasília landmarks 0.378, São Paulo 0.344, Rio 0.430, world landmarks 0.397). Best Qwen Image 2.1 round on the same set: 0.405.
Limitations and data
- Training data: ~2,000 pairs of (oblique 3D render of a 1024 px map frame → Codex painting of the same frame), mostly Brasília, plus São Paulo, water/shorelines and 42 world-landmark frames. The 3D inputs are renders of Google Photorealistic 3D Tiles; Google's Map Tiles terms do not allow using their content to train models. This LoRA is shared as a research experiment; check those terms before using it for anything beyond that.
- Look: water comes out brighter than the target's deep teal; very fine lattices (e.g. the Torre de TV) only appear when the 3D render shows them.
- Input: works best on renders like the training ones: 1024×1024, ~30° oblique, ~3.4 px per metre.