The 2026-grade Swiss army knife for preparing, validating and evaluating LoRA training datasets β for photo (SDXL, Flux, SD 3.5, Pony, Illustrious, NoobAI...) and video (Wan 2.x, HunyuanVideo, LTX-Video, CogVideoX, Mochi, Open-Sora) models.
LoRA-Dataset-Coach is a complete pipeline that takes a folder of images and walks you through the full LoRA training workflow:
- Analyze every image individually (face detection, identity match, quality, expression, pose, aesthetic, AI-generation detection, anatomical artifacts)
- Score the dataset globally with a grade (A/B/C/D/F) and a per-target-family rating (SDXL classic, SDXL anime, Flux, Wan video, video other)
- Suggest what's missing ("generate 3 more profile shots", "vary expressions", "too many white shirts β overfit risk")
- Auto-caption with WD14 tags, Florence-2 or the 2026 standard JoyCaption Beta One
- Clean the dataset (move rejects, recover blurry, deduplicate)
- Generate masked training masks via BriaRMBG (for OneTrainer masked loss)
- Export a ready-to-train folder for 19 different LoRA trainers (Kohya, ai-toolkit, musubi-tuner, diffusion-pipe, cogvideox-factory, OneTrainer...)
- Evaluate the finished LoRA post-training with R-FaceSim, Copycat Detector, Black Hole Ranking (MirrorMetrics-inspired)
The whole thing runs in a single Tkinter GUI with a live preview that scrolls through every photo as it's analyzed.
(Screenshots coming soon. The interface uses Catppuccin Mocha dark theme.)
# 1. Clone
git clone https://github.com/akalavol/LoRA-Dataset-Coach.git
cd LoRA-Dataset-Coach
# 2. Install dependencies
# (Python 3.11 or 3.12 required for tkinter + PIL.ImageTk)
pip install -r requirements.txt
# 3. Launch (Windows)
run.bat
# OR direct:
python manager.pyOn first analysis run, the tool will auto-download the needed models from HuggingFace:
- insightface antelopev2 (~250 MB, face embedding)
- WD14-MOAT tagger (~330 MB, booru tags) β only if you pick WD14 mode
- Florence-2-base (~540 MB, natural captions fallback) β only if you pick Florence mode
- JoyCaption Beta One (~4 GB INT4 / 8 GB BF16, modern captions) β only if you pick JoyCaption mode
- sdxl-detector (~350 MB, AI image detection)
- BriaRMBG-1.4 (~176 MB, subject masks) β only if you generate masks
| Feature | Status | Notes |
|---|---|---|
| Face detection & identity sim | β | InsightFace antelopev2 (512-D embeddings) |
| Reference photo identity check | β | Cosine sim vs ground-truth ref |
| Quality metrics | β | Laplacian sharpness, brightness, contrast, megapixels |
| Pose estimation | β | Yaw via 5 keypoints, flags profile/back shots |
| Expression detection | β | CLIP zero-shot (7 expressions) |
| Shot type classification | β | face_only / both / body_only via face proportion |
| Duplicate detection | β | dHash (hamming < 5) + face sim > 0.96 |
| WD14 tagging | β | Standalone ONNX reuse of ComfyUI tagger |
| Florence-2 natural captions | β | CPU/CUDA fallback |
| JoyCaption Beta One | β | 2026 community standard for persona LoRAs |
| AI-generated detection | β | Organika/sdxl-detector ViT (99.6% accuracy) |
| Anatomical artifact detection | β | HADM-light via WD14 tags + caption regex |
| C2PA / EXIF / PNG metadata | β | Detects already-tagged AI images |
| Aspect-ratio bucket analysis | β | Flags imbalanced datasets |
| Diversity scoring (CLIP clustering) | β | Union-Find clusters, big-cluster detection |
| Per-target family scoring | β | 5 grades (SDXL/Flux/Wan/...) per dataset |
| Overfit attribute alerts | β | "white shirt @ 87% β overfit risk" |
| Analysis cache | β | Skip already-analyzed images by mtime |
| Move rejects / recover blurry | β | Auto-folder + SUPIR/UltraSharp README |
| Caption inline editor | β | Edit WD14/Florence/JoyCaption in popup, saves to .txt + cache |
| Subject masks (BriaRMBG) | β | OneTrainer masked training |
| Multi-target LoRA prep | β | 19 targets, auto-crops, configs, READMEs |
| Targeted prompt generator | β | Exports ComfyUI workflows to fill missing shot types |
| Post-train LoRA evaluator | β | R-FaceSim, Copycat, Black Hole Ranking |
| PDF report export | β | Landscape A4 with Catppuccin theme |
| GitHub auto-update | β | Built-in updater checks releases |
The 𧬠Prepare LoRA action exports a ready-to-train folder for any of these:
sdxl_kohyaβ SDXL via Kohya SS GUIsd15_kohyaβ SD 1.5 via Kohyasd35_kohyaβ SD 3.5 Large via Kohya (sd3 branch)hunyuan_dit_kohyaβ HunyuanDiTsana_diffpipeβ Sana (NVIDIA) via diffusion-pipeflux_aitoolkitβ Flux via ai-toolkit (ostris)flux_kohyaβ Flux via Kohya (sd3 branch)chroma_aitoolkitβ Chroma (Flux variant uncensored)onetrainer_sdxlβ SDXL via OneTrainer
pony_kohyaβ Pony Diffusion XL (auto quality prefixscore_9, score_8_up, score_7_up...)illustrious_kohyaβ Illustrious XL (automasterpiece, best quality, very aesthetic, absurdres)noobai_kohyaβ NoobAI XL (automasterpiece, best quality, newest, absurdres, highres)
wan21_musubiβ Wan 2.1 via musubi-tunerwan22_musubiβ Wan 2.2 via musubi-tunerhunyuan_diffpipeβ HunyuanVideo via diffusion-pipeltx_video_diffpipeβ LTX-Video (Lightricks) via diffusion-pipecogvideox_diffpipeβ CogVideoX 5B via cogvideox-factorymochi_diffpipeβ Mochi 1 (Genmo) via diffusion-pipeopen_sora_diffpipeβ Open-Sora 2.0 (HPC-AI)
For each target, the tool generates the correct:
- Crop strategy (square_face for SDXL, multi-bucket for Flux/Wan)
- Resolution(s)
- Captioner choice (WD14 for SDXL, JoyCaption natural for Flux/Wan)
- Quality prefix (Pony/Illustrious/NoobAI need specific tags)
- Trainer config file (.toml for Kohya/diffusion-pipe, .yaml for ai-toolkit)
- README with launch instructions
Once your LoRA is trained, generate ~30 test images, then provide:
- Generated folder β your test outputs
- Reference folder β real photos of the subject (β training photos)
- Training folder (optional) β for copycat detection
The tool computes the 2026 community standard metrics:
| Metric | What it tells you |
|---|---|
| R-FaceSim | Mean cosine similarity of generations vs real photos. >0.7 = identity learned. |
| Copycat ratio | % of generations >0.95 similar to a training image. >0 = LoRA is memorizing not generalizing. |
| Black Hole Ranking | Which training image attracts the most generations. >40% to a single image = mode collapse. |
| Mode collapse signal | Std deviation of R-FaceSim. <0.03 = single mode learned. |
Final verdict: A (excellent) to F (failed) with specific advice.
manager.py β Tkinter GUI (system Python with tkinter)
βββ analyze_dataset.py β Main analysis engine (ComfyUI-future Python)
βββ wd14_local.py β WD14-MOAT ONNX tagger
βββ florence_local.py β Florence-2 captioner
βββ joycaption_local.py β JoyCaption Beta One (2026 standard)
βββ ai_detector_local.py β sdxl-detector ViT
βββ artifact_detector_local.py β HADM-light artifact detector
βββ metadata_ai.py β C2PA / EXIF / PNG / filename heuristics
βββ mask_generator_local.py β BriaRMBG subject masks
βββ lora_prep.py β 19-target LoRA dataset preparation
βββ lora_evaluator.py β Post-train R-FaceSim + Copycat
βββ prompt_generator.py β Targeted ComfyUI workflow exporter
βββ updater.py β GitHub release auto-updater
βββ export_pdf.py β Landscape A4 PDF reporter
Two Python environments are used:
- System Python (3.11/3.12) β runs
manager.py(needs tkinter + PIL.ImageTk) - ComfyUI's
python_embededβ runsanalyze_dataset.pyandlora_evaluator.py(has CUDA torch + insightface + transformers)
You can adapt the path to python_embeded.exe in manager.py (COMFYUI_FUTURE_PY constant) if you use a different ComfyUI install.
For the full, in-depth documentation see DOCUMENTATION.md.
It covers every UI section, every JSON field, every training target's specifics, performance benchmarks, the cache format, and a complete troubleshooting guide.
The tool has a built-in updater under the β Config tab:
- Click
π Check for updates - If a newer GitHub release exists, click
β¬ Install update - The current
.pyfiles are backed up to_backup_before_update/ - New files are pulled (via
git pullif installed via git, otherwise via release zip) - Restart the app
| Phase | Features | Status |
|---|---|---|
| A | JoyCaption + tag frequency overfit alerts | β |
| B | sdxl-detector + HADM-light + C2PA/EXIF metadata | β |
| C | CLIP diversity + per-target scoring + aspect-ratio | β |
| D | Inline caption editor + BriaRMBG subject masks | β |
| E | Targeted prompt generator + post-train evaluator + GitHub auto-update | β |
| Future | Native InstantID auto-fill (no ComfyUI roundtrip), benchmarks vs known-good datasets | π‘ ideas welcome |
PRs welcome. Major directions where help is appreciated:
- Adding new LoRA training targets (the catalog in
lora_prep.pyis structured for easy addition) - Improving HADM artifact detection (HADM-full integration with Detectron2)
- ComfyUI API integration for auto-fill (instead of exporting JSON workflows)
- Screenshots / demo GIFs for the README
- InsightFace β antelopev2 face analysis
- WD14 Tagger (SmilingWolf) β booru-tags captioning
- Florence-2 (Microsoft) β natural captioning
- JoyCaption Beta One (fancyfeast) β modern LLaVA-based persona captioning
- Organika/sdxl-detector β AI image classifier
- BriaRMBG-1.4 (BRIA AI) β background removal
- HADM paper (arXiv 2411.13842) β anatomical artifact detection
- MirrorMetrics (AndyLone22) β post-training LoRA evaluation methodology
- Meta-PHD (arXiv 2503.22352) β R-FaceSim metric
This project uses a source-available license with a small-entity commercial tier and a paid commercial tier β see LICENSE for the full text.
Quick summary (non-binding):
| Use case | Free under this license |
|---|---|
| Personal / hobby / research / educational | β Yes |
| Freelancers and sole proprietors | β Yes |
| Companies with fewer than 5 employees | β Yes |
| Companies with 5 or more employees (commercial use) | β Needs a paid commercial license |
| Repackaging as a competing product | β Not allowed |
For a commercial license inquiry, open an issue tagged
commercial-license-inquiry.
Third-party models downloaded at runtime (Florence-2, JoyCaption, WD14, sdxl-detector, BriaRMBG, InsightFace) are licensed under their own terms, which you must comply with independently.