PrathikshaR7/CycleGAN
1
Photo2Sketch CycleGAN
A deep learning project that converts photographs to artistic sketches using CycleGAN architecture. This project supports image upload, video processing, and live camera feed for real-time sketch generation.
Features
- Photo to Sketch Conversion: Transform uploaded photos into artistic sketches
- Video Processing: Convert entire videos to sketch animations
- Live Camera Feed: Real-time sketch generation from webcam
- Dual-Stage Processing: Enhanced quality with color transfer and post-processing
- Firebase Authentication: Secure user authentication system
- Responsive Web Interface: Modern UI built with Flask and Bootstrap
Quick Start
Local Development
- Clone the repository
- Install dependencies:
pip install -r requirements.txt - Run the application:
python app.pyHEAD - Open
http://localhost:7860in your browser
- Open
http://localhost:5000in your browser 678f30c (Hugging_Face)
Docker Deployment
- Build the Docker image:
docker build -t photo2sketch .HEAD - Run the container:
docker run -p 7860:7860 photo2sketch
- Run the container:
docker run -p 5000:5000 photo2sketch678f30c (Hugging_Face)
Model Architecture
This project uses CycleGAN with the following components:
- Generator networks for photo→sketch and sketch→photo conversion
- Discriminator networks for adversarial training
- Color transfer pipeline for enhanced output quality
- Post-processing for photorealistic results
Requirements
- Python 3.10+
- PyTorch 2.0+
- OpenCV
- Flask
- Firebase Admin SDK
- CUDA (optional, for GPU acceleration)
File Structure
├── app.py # Main Flask application
├── models/ # CycleGAN model definitions
├── checkpoints/ # Pre-trained model weights
├── static/ # Static assets (CSS, JS, images)
├── templates/ # HTML templates
├── uploads/ # User uploaded files
├── requirements.txt # Python dependencies
└── Dockerfile # Docker configurationUsage
- Upload Photo: Select an image file and upload it for sketch conversion
- Process Video: Upload a video file to convert all frames to sketches
- Live Camera: Enable webcam for real-time sketch generation
- Download Results: Save generated sketches and processed media
Model Performance
The model achieves high-quality sketch generation with:
- Structural preservation of original photos
- Artistic sketch-style rendering
- Fast inference speed suitable for real-time applications
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Based on CycleGAN architecture from Zhu et al.
- Uses pre-trained models for photo-to-sketch conversion
- Enhanced with color transfer and post-processing pipelines
