How senhe/flow-style-vton works
Project type and purpose
• This is a research-oriented, Python-based deep-learning pipeline for “virtual try-on.”
• It provides both a training subsystem (multi-stage flow and generator) and an inference (test) subsystem.
File structure
• Top-level folders:
– train/ → training code, data definitions, models, options, scripts
– test/ → inference code, data definitions, models, options
• Within each:
– data/ → Dataset classes & DataLoader wrappers
– models/ → network definitions (AFWM, Cloth-Flow, generator nets)
– options/ → CLI argument parsing (base_options, train_options, test_options)
– util/ → helper functions (image pools, flow utilities)
• Additional:
– train/scripts/ → shell wrappers that launch the Python training scripts in correct sequence
– train/dataset/ → raw dataset folder (VITON_traindata)
– model checkpoints (vgg19, pretrained warping/generation nets)
README for architectural insights
• Four training stages (PBAFN stage1 → PBAFN stage2 → PFAFN stage1 → PFAFN stage2)
• External preprocessing dependencies:
– Human parsing (e.g., via Self-Correction-Human-Parser)
– Pose estimation (OpenPose)
– DensePose heatmaps (Facebook DensePose)
• Inference requires two checkpoints: warp network + generator network
Main components
a. Data Sources (green):
– Raw images & clothing items (VITON_traindata)
– Human parsing masks, pose JSON, densepose heatmaps (external preprocessing)
b. Data Pipeline (yellow):
– Dataset classes → DataLoader (batching, augmentation)
c. Model Pipeline (blue):
– Stage 1: Appearance Flow Estimator
· Parser-Based (PBAFN) OR Parser-Free (PFAFN)
– Stage 2: Image Generator (parser-based or parser-free branch)
– Loss Modules (perceptual loss via VGG, adversarial loss if any)
d. Training Orchestration (purple):
– train/scripts/*.sh + train/*.py launchers
– Options parsers configure hyperparameters (learning rate, augmentation flags)
e. Inference Pipeline (teal):
– test.py driven by test/options → loads two checkpoints → applies warp network → applies generator → outputs final composite images
f. External Services (orange):
– Preprocessing tools (OpenPose, DensePose, Human-Parser)
– tensorboardX for logging
Relationships and interactions
Data Sources → DataLoader → Stage1 Flow Estimator → Stage2 Generator → Output Images
Architectural patterns & design principles
• Modular separation: data/ vs. models/ vs. options/ vs. util/
• Pipeline pattern: clearly staged training (4 sequential phases)
• Reusable configuration via options classes
• Script-based orchestration for reproducibility
Technologies & frameworks to annotate
• Python 3.6, PyTorch 1.x, torchvision, tensorboardX, OpenCV
• External: OpenPose, DensePose, Human-Parser