Sketch2Image is an end-to-end computer vision project that translates hand-drawn sketches into realistic images using a conditional GAN (Pix2Pix). It includes reproducible data preparation, quality evaluation (FID/LPIPS/SSIM), benchmark automation, and an interactive Streamlit demo.
- Complete workflow: data prep, training, inference, evaluation, and demo.
- Reproducibility-first scripts with deterministic split controls.
- Works in both full-dataset mode and single before/after image mode.
- CI checks, security policy, contribution guide, and citation metadata included.
flowchart TB
A[Raw Image Dataset<br/>dataset/class_x/*.jpg] --> B[Data Prep CLI<br/>script/process_dataset.py]
B --> C[Sketch Dataset<br/>dataset_sketch]
B --> D[Pix2Pix A/B Splits<br/>dataset_for_pix2pix/A,B]
D --> E[AB Concatenated Dataset<br/>dataset_ab]
E --> F[Pix2Pix Dataset Registry<br/>pytorch-CycleGAN-and-pix2pix/datasets/sketch2image]
F --> G[Model Training<br/>sketch2image_model_train.ipynb]
G --> H[Trained Checkpoints]
H --> I[Inference Script<br/>pix2pix test pipeline]
I --> J[Generated Images<br/>output_images]
J --> K[Metrics Engine<br/>script/evaluate_metrics.py]
F --> K
K --> L[Metrics JSON<br/>metrics/latest_metrics.json]
L --> M[Benchmark Updater<br/>script/update_benchmark_table.py]
M --> N[README Benchmark Table]
J --> O[Streamlit Demo<br/>demo/app.py]
C --> O
git clone https://github.com/prashantsingh5/Sketch_2_image.git
cd Sketch_2_image
python -m venv .venvActivate venv:
. .\.venv\Scripts\Activate.ps1source .venv/bin/activatepip install -r requirements.txt
python script/doctor.pyPut your images at:
assets/sample/before.jpgassets/sample/after.jpg
Then run:
python script/run_full_eval.py --real-image assets/sample/before.jpg --generated-image assets/sample/after.jpg --experiment "Single Pair Smoke Test" --split testThis computes FID, LPIPS, SSIM and auto-updates the benchmark table in this README.
streamlit run demo/app.pyDemo modes:
Folders: browse full before/after datasets.Upload single pair: drag and drop one before/after pair.
dataset/
|-- bedroom/
| |-- image_001.jpg
| `-- image_002.jpg
`-- kitchen/
|-- image_101.jpg
`-- image_102.jpg
python script/process_dataset.py --base-folder . --dataset-dir dataset --pix2pix-repo pytorch-CycleGAN-and-pix2pix --dataset-name sketch2imageOptional split control:
python script/process_dataset.py --val-ratio 0.1 --test-ratio 0.05 --seed 42- Run
sketch2image_model_train.ipynbin order. - Run inference from
pytorch-CycleGAN-and-pix2pix/(for example via your test script).
python script/run_full_eval.py --real-dir dataset_for_pix2pix/B/val --generated-dir pytorch-CycleGAN-and-pix2pix/output_images --experiment "Baseline Pix2Pix (default config)" --split valMetric interpretation:
FID: lower is better.LPIPS: lower is better.SSIM: higher is better.
Estimated placeholder values below are for presentation only (not measured runs).
| Experiment | Dataset Split | FID ↓ | LPIPS ↓ | SSIM ↑ | Notes |
|---|---|---|---|---|---|
| Baseline Pix2Pix (default config) | val | 78.40 | 0.3210 | 0.6200 | Estimated placeholder (not measured) |
| Single Pair Smoke Test | test | 41.20 | 0.1840 | 0.7100 | Estimated placeholder (single-pair, not statistically reliable) |
| Tuned Run (example) | val | 61.70 | 0.2760 | 0.6600 | Estimated placeholder for expected tuned improvement |
.
|-- README.md
|-- CONTRIBUTING.md
|-- PROJECT_ROADMAP.md
|-- SECURITY.md
|-- CITATION.cff
|-- requirements.txt
|-- sketch2image_model_train.ipynb
|-- assets/
| `-- sample/
| `-- README.md
|-- demo/
| `-- app.py
|-- script/
| |-- process_dataset.py
| |-- evaluate_metrics.py
| |-- update_benchmark_table.py
| |-- run_full_eval.py
| `-- doctor.py
`-- pytorch-CycleGAN-and-pix2pix/
- Security policy:
SECURITY.md - Citation metadata:
CITATION.cff - Contribution guide:
CONTRIBUTING.md - Planned milestones:
PROJECT_ROADMAP.md
- Pix2Pix paper and ecosystem.
- PyTorch community.
pytorch-CycleGAN-and-pix2pixmaintainers.
Prashant Singh
Contact: prashantsingha96@gmail.com

