NeoNude
GAN-based Image Transformation
A pix2pixHD architecture using a divide-et-impera approach for image transformation.
β¨ Features
- Auto Resize β Automatically resizes any input to 512x512 and restores original dimensions on output
- 3-Phase GAN Pipeline β Clothing mask β Anatomical detection β Final generation
- OpenCV Transforms β Color correction, mask refinement, and mask finalization
- pix2pixHD Architecture β Global generator with residual blocks and instance normalization
- Simple CLI β Easy input/output with minimal arguments
π Requirements & Installation
Requirements
| Component | Requirement |
|---|---|
| Python | 3.7 or higher |
| PyTorch | 1.7 or higher |
| OpenCV | 4.5+ (headless) |
| Pillow | 8.0+ |
| NumPy | 1.19+ |
Installation
# Clone the repository
git clone https://github.com/fahimahamed1/NeoNude.git
cd NeoNude
# Install dependencies
pip install -r requirements.txt
Model Checkpoints
Place the model weight files in the checkpoints/ directory:
checkpoints/
βββ cm.lib (~700 MB)
βββ mm.lib (~700 MB)
βββ mn.lib (~700 MB)
π How to Use
CLI
# Default: reads input.png, writes output.png
python main.py
# Custom input/output paths
python main.py -i photo.jpg -o result.png
# Help
python main.py --help
βοΈ Pipeline Architecture
Instead of a single network, the problem is split into 3 sub-problems:
- Mask generation β Identifies clothing regions
- Anatomical attribute detection β Produces an abstract body map
- Final image generation β Creates the output from the refined mask
Pipeline Phases
| Phase | Type | Description |
|---|---|---|
| 0 | OpenCV | Color correction and normalization |
| 1 | GAN | Clothing mask generation (cm.lib) |
| 2 | OpenCV | Mask refinement |
| 3 | GAN | Anatomical detail detection (mm.lib) |
| 4 | OpenCV | Mask finalization with body annotations |
| 5 | GAN | Final image generation (mn.lib) |
π Project Structure
NeoNude/
βββ main.py # CLI entry point
βββ requirements.txt # Python dependencies
βββ README.md
βββ src/ # Core package
β βββ __init__.py # Package metadata
β βββ config.py # Pipeline configuration (Options)
β βββ pipeline.py # Pipeline orchestrator (process function)
β βββ model.py # GAN model, dataset, utilities
β βββ transforms/ # OpenCV image transforms
β βββ __init__.py
β βββ annotation.py # Body part data class
β βββ correct.py # Phase 0: color correction
β βββ maskref.py # Phase 2: mask refinement
β βββ maskfin.py # Phase 4: mask finalization
βββ checkpoints/ # Model weight files (not tracked)
π‘οΈ Security Notes
β οΈ This tool is intended for:
- Personal use and educational purposes
- Research in GAN-based image transformation
- Academic study of pix2pixHD architecture
Do NOT use for:
- Generating non-consensual intimate imagery
- Any form of harassment or exploitation
- Any illegal activities
Always ensure proper authorization and ethical use before processing any images.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π¨βπ» Author
Fahim Ahamed
β Support
If you find this project useful, please consider giving it a star! π
Made with β€οΈ for the open-source community
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support