# Repository Briefing: cecret3350/AnyStitch
> Source: https://repoforai.com/repo/cecret3350/AnyStitch (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/cecret3350/AnyStitch
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: B+ (73/100 · Maintenance 35/35 · Adoption 7/25 · Releases 11/20 · License 20/20)
- **Review Snapshot**: 2026-12-01
- **Deployment / Stack Signals**: Local AI, GPU, CLI
- **Momentum**: 34 ★ total (+2 24h / +29 7d) · 2 forks
- **When to Use**: Best for: Researchers and imaging engineers evaluating large-parallax stitching, comparing target viewpoints, or reproducing the bundled two-view results on a local NVIDIA GPU. Skip if: You need strictly source-faithful output, a ready-to-run training workflow, or the separate pipeline used for the 104.47 MP demo.

## Overview
```text
### Architecture & Core Mechanics
AnyStitch separates geometric alignment from image synthesis. DA3NESTED-GIANT-LARGE estimates a depth map and camera pose for each overlapping photograph. Those estimates drive reprojection into a chosen target view, after which a diffusion model generates the panorama patch by patch. This gives the pipeline a way to handle depth-dependent displacement caused by camera translation rather than forcing all scene depths into one planar warp.

The Python CLI has separate entry points for v1 (`stitch.py`) and paper reproduction (`stitch_old.py`), and setuptools discovers the `stitching` and `diffsynth` packages. The runtime includes PyTorch, torchvision, `transformers==4.57.6`, OpenCV, Pillow, and safetensors. The diffusion stack draws its text encoder and VAE from FLUX.2-klein-9B and its transformer and tokenizer from FLUX.2-klein-base-9B. `--lora` is the exposed interface for selecting a local stitching adapter; additional geometry backends are listed as future work, not current options.

### Key Capabilities & Differentiators
Custom scenes require at least two overlapping photos with the same aspect ratio, named in camera order. The default is an average camera pose with cylindrical projection. The CLI also exposes rectilinear and equirectangular projections and can anchor the output to the last camera. `--intermediates` saves the per-view reprojections, the pre-stitch, and the panorama after each patch, making it possible to distinguish misalignment already present in the geometry stage from changes introduced later by diffusion.

The bundled RISWMR subset contains 14 two-view scenes with matching saved outputs for the paper checkpoint and v1. Its preset uses the last camera, rectilinear projection, center-first generation, 40 diffusion steps, panorama seed 219, and recorded per-scene geometry seeds. AnyStitchSyn adds 2,192 training pairs rendered from 950 InteriorGS scenes, with geometry and ground-truth targets at an intermediate camera pose for three projections. These are concrete evaluation and research assets, not evidence of a complete training workflow on the main branch.

### Trade-offs & Limitations
A conventional feature-matching, homography, and blending pipeline avoids running multiple neural models and is a useful baseline when rotation dominates or an approximately planar scene aligns well. AnyStitch is a better candidate when translation prevents foreground and background from aligning together. Its quality still depends on inferred depth and poses, and diffusion may synthesize plausible content that no input captured. A clean seam is therefore not proof of geometric or photometric fidelity.

Local execution can keep photos on the workstation, but it shifts model storage, cache provisioning, and CUDA compatibility onto the operator. The 14-scene two-view subset is useful for regression testing, not for establishing quality or scaling limits on arbitrary captures. The separate two-stage pipeline behind the 104.47 MP demo and cleaned-up training code are not part of the documented main-branch workflow. Apache-2.0 applies to the repository; review the terms for external weights, adapters, and data separately before commercial use or redistribution.

### Hardware & Deployment Guide
The package requires Python 3.10 or later, while the installation path uses Python 3.11 on Linux with an NVIDIA GPU, CUDA 12.4 PyTorch 2.6.0 and torchvision 0.21.0 wheels, and a Git-pinned Depth Anything 3 dependency. FLUX weights default to ModelScope and can be switched to Hugging Face; DA3 downloads from Hugging Face. For offline runs, stage the task LoRA and both model caches, configure `DIFFSYNTH_MODEL_BASE_PATH` and `DA3_CACHE_DIR`, then set `DIFFSYNTH_SKIP_DOWNLOAD=true` and `HF_HUB_OFFLINE=1`.

V1 is the path for new photos and uses a 675 MB LoRA. Keep `stitch_old.py` and the 169 MB paper LoRA together for paper reproduction. For pixel-level comparisons, match the saved-output environment beyond the quick-start pins: it used an NVIDIA A800, Python 3.11.13, xFormers 0.0.29, and specific numerical and image-library versions. No minimum VRAM or timing figures are provided. Profile both geometry and diffusion on representative inputs before committing to a GPU size or batch throughput.
```

## Key Capabilities
```text
- Geometry: DA3NESTED-GIANT-LARGE estimates depth and camera pose for each input before reprojection.
- Generation: FLUX.2-klein 9B-family components and a task-specific LoRA synthesize the panorama patch by patch.
- View control: Custom scenes default to cylindrical projection and an average camera pose; rectilinear and equirectangular projections are also exposed.
- Diagnostics: `--intermediates` saves individual reprojections, the pre-stitch, and the panorama after each patch.
- Reproducibility: The bundled 14-scene RISWMR subset includes paper and v1 outputs; its preset uses 40 diffusion steps and panorama seed 219.
- Research assets: AnyStitchSyn provides 2,192 training pairs from 950 InteriorGS scenes, with sample geometry and targets for three projections.
```

## Quick Start / Clone
```bash
git clone --branch main https://github.com/cecret3350/AnyStitch.git
cd AnyStitch

conda create -n anystitch python=3.11 -y
conda activate anystitch
python -m pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124
python -m pip install 'torch==2.6.0' 'torchvision==0.21.0' \
  'depth-anything-3 @ git+https://github.com/ByteDance-Seed/Depth-Anything-3.git@ed6989a23cd389e975ed9f7cbd7385396e6d867e' -e .
```
