File size: 4,243 Bytes
00b05a4 7b16cb8 00b05a4 7b16cb8 00b05a4 7b16cb8 3d23e79 cc9dfd7 7b16cb8 cc9dfd7 3d23e79 cc9dfd7 3d23e79 cc9dfd7 3d23e79 cc9dfd7 3d23e79 cc9dfd7 3d23e79 cc9dfd7 3d23e79 7b16cb8 3d23e79 cc9dfd7 3d23e79 cc9dfd7 7b16cb8 cc9dfd7 7b16cb8 3d23e79 cc9dfd7 3d23e79 cc9dfd7 3d23e79 cc9dfd7 7b16cb8 cc9dfd7 7b16cb8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
---
license: mit
language:
- en
tags:
- image-restoration
---
<table>
<tr>
<td align="center">Input (B&W)</td>
<td align="center">Colorized Output</td>
</tr>
<tr>
<td><img src="DeOldify/test_images/1910Finland.jpg" alt="Input Black and White Image" height=500/></td>
<td><img src="DeOldify/result_images/1910Finland.jpg" alt="Colorized Output Image" height=500/></td>
</tr>
</table>
# Image Colorization Application
This application provides a web-based interface for colorizing black and white images using DeOldify technology. It consists of a FastAPI backend for processing images and a Streamlit frontend for a user-friendly interface.
## Features
- Colorize black and white images using DeOldify
- Choose between Artistic (more vibrant) and Stable (more realistic) models
- Adjust render factor to control quality and processing time
- Generate multiple renders with different factors to find the optimal result
- Download colorized images
## Installation
### Prerequisites
- Python 3.10
- CUDA-capable GPU (recommended for faster processing)
- Git, Git-Lfs
### Setup Instructions
1. **Clone the DeOldify repository inside your project directory:**
```bash
git clone https://huggingface.co/sayed99/Image-Colorizer
```
2. **Set up the environment:**
You can set up the environment using either Conda (recommended) or pip.
- **Using Conda (Recommended):**
```bash
conda env create -f environment.yml
conda activate deoldify
```
- **Using Pip:**
Make sure you have a compatible Python environment (3.10).
```bash
# Create a virtual environment
python -m venv .venv
# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
# Install the required dependencies
pip install -r requirements.txt
```
This installs both the dependencies for our application and most of the dependencies needed for DeOldify.
## Directory Structure
- `DeOldify/`: Cloned repository containing the core DeOldify library.
- `models/`: Contains the downloaded `.pth` model weights.
- `input_images/`: Default location for uploaded images (can be configured).
- `output_images/` or `result_images/`: Default location for single colorized images.
- `multiple_renders/`: Default location for images generated using the multiple render factors feature.
- `app.py`: FastAPI backend server.
- `streamlit_app.py`: Streamlit frontend application.
- `requirements.txt`: Pip dependencies.
- `environment.yml`: Conda environment specification.
## Running the Application
1. **Start the FastAPI server:**
```bash
python app.py
```
This will start the API server on http://localhost:8000
2. **In a new terminal window, start the Streamlit web application:**
```bash
streamlit run streamlit_app.py
```
This will open the web interface in your browser, typically at http://localhost:8501
## API Documentation
Once the FastAPI server is running, you can access the API documentation at:
- http://localhost:8000/docs (Swagger UI)
- http://localhost:8000/redoc (ReDoc)
## API Endpoints
- `POST /colorize`: Colorize a single image with specified parameters
- `POST /colorize_multiple`: Generate multiple colorizations with different render factors
- `GET /image/{image_path}`: Retrieve a colorized image by its path
## Streamlit Web App
The web application provides an intuitive interface for:
- Uploading images
- Selecting colorization model (Artistic or Stable)
- Adjusting render factor
- Generating and comparing multiple renders
- Downloading colorized images
## Technical Details
- The application uses DeOldify's image colorization models
- Default render factor is 10, but can be adjusted between 5-50
- The artistic model is used by default, but can be switched to stable
- For multiple renders, you can specify the minimum and maximum render factors and step size
## Performance Tips
- If you encounter CUDA out-of-memory errors, try lowering the render factor
- For best results with the artistic model, a render factor of 10-15 is recommended
- For the stable model, a render factor of 20-25 typically works well
- increasing the render factor consume more gpu memory.
## License
This project uses DeOldify, which is licensed under MIT License.
|