Update README.md
Browse files
README.md
CHANGED
|
@@ -1,137 +1,118 @@
|
|
| 1 |
-
# MakeItColor: Image Colorization Model
|
| 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 |
-
Special thanks to the creators of DDColor for their foundational contributions.
|
| 119 |
-
|
| 120 |
-
---
|
| 121 |
-
|
| 122 |
-
## License
|
| 123 |
-
|
| 124 |
-
This project is licensed under the **Apache License 2.0**.
|
| 125 |
-
|
| 126 |
-
---
|
| 127 |
-
|
| 128 |
-
## Contact
|
| 129 |
-
|
| 130 |
-
For issues, questions, or feedback, feel free to:
|
| 131 |
-
|
| 132 |
-
- Open an issue on the [Hugging Face repository](#).
|
| 133 |
-
- Contact the maintainer directly at: **[muhammadnomanshafiq76@gmail.com](mailto:muhammadnomanshafiq76@gmail.com)**
|
| 134 |
-
|
| 135 |
-
---
|
| 136 |
-
|
| 137 |
**Developed by Muhammad Noman**
|
|
|
|
| 1 |
+
# MakeItColor: Image Colorization Model
|
| 2 |
+
|
| 3 |
+
[](https://colab.research.google.com/drive/10raIuCBUhKCPqIuL_HiSQmkJJ9jbu2VC?usp=sharing)
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
**MakeItColor** is a deep learning model designed for automatic image colorization. It transforms grayscale images into vivid, realistic colorized outputs using a PyTorch-based Convolutional Neural Network (CNN) architecture integrated with the ModelScope framework.
|
| 8 |
+
|
| 9 |
+
This model builds upon the work of [DDColor](https://github.com/piddnad/DDColor), utilizing a dual-encoder approach and trained on the **ImageNet-Val5k** dataset.
|
| 10 |
+
|
| 11 |
+
## Features
|
| 12 |
+
|
| 13 |
+
- **Task**: Image Colorization
|
| 14 |
+
- **Framework**: PyTorch, ModelScope
|
| 15 |
+
- **Architecture**: Convolutional Neural Network (CNN)
|
| 16 |
+
- **Input**: Grayscale images (single-channel)
|
| 17 |
+
- **Output**: Colorized images (RGB format)
|
| 18 |
+
|
| 19 |
+
## Installation
|
| 20 |
+
|
| 21 |
+
Ensure you have **Python 3.7+** installed. Then, install the required dependencies:
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
pip install opencv-python
|
| 25 |
+
pip install modelscope==1.12.0
|
| 26 |
+
pip install datasets==2.14.7
|
| 27 |
+
pip install pillow
|
| 28 |
+
pip install numpy
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
### ModelScope Pipeline
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
import cv2
|
| 37 |
+
from modelscope.pipelines import pipeline
|
| 38 |
+
from modelscope.utils.constant import Tasks
|
| 39 |
+
from huggingface_hub import snapshot_download
|
| 40 |
+
|
| 41 |
+
# Download the model files to a local directory
|
| 42 |
+
snapshot_download(repo_id="muhammadnoman76/makeitcolor", local_dir="./makeitcolor", repo_type="model")
|
| 43 |
+
|
| 44 |
+
# Initialize the colorization pipeline
|
| 45 |
+
img_colorization = pipeline(Tasks.image_colorization, model='./makeitcolor')
|
| 46 |
+
|
| 47 |
+
# Load a grayscale image
|
| 48 |
+
img_path = 'input.jpg'
|
| 49 |
+
|
| 50 |
+
# Run colorization
|
| 51 |
+
result = img_colorization(img_path)
|
| 52 |
+
|
| 53 |
+
# Save the colorized image
|
| 54 |
+
cv2.imwrite('result.png', result['output_img'])
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
> **Note**:
|
| 58 |
+
> - Ensure that the input image (`input.jpg`) is a proper grayscale (single-channel) image.
|
| 59 |
+
> - The output (`result.png`) will be a standard RGB image.
|
| 60 |
+
|
| 61 |
+
## Google Colab
|
| 62 |
+
|
| 63 |
+
For an interactive demonstration, try our [Google Colab notebook](https://colab.research.google.com/drive/10raIuCBUhKCPqIuL_HiSQmkJJ9jbu2VC?usp=sharing).
|
| 64 |
+
|
| 65 |
+
## Model Files
|
| 66 |
+
|
| 67 |
+
The repository contains:
|
| 68 |
+
- `pytorch_model.pt`: Pre-trained model weights
|
| 69 |
+
- `configuration.json`: Model configuration file for ModelScope integration
|
| 70 |
+
- `README.md`: Documentation
|
| 71 |
+
|
| 72 |
+
## Requirements
|
| 73 |
+
|
| 74 |
+
### Hardware
|
| 75 |
+
- CPU (supported)
|
| 76 |
+
- GPU (recommended for faster inference)
|
| 77 |
+
|
| 78 |
+
### Software Dependencies
|
| 79 |
+
- `modelscope`
|
| 80 |
+
- `opencv-python`
|
| 81 |
+
- `torch`
|
| 82 |
+
|
| 83 |
+
## Input Format
|
| 84 |
+
|
| 85 |
+
- Grayscale images (`.png`, `.jpg`, etc.)
|
| 86 |
+
|
| 87 |
+
### Example Workflow
|
| 88 |
+
|
| 89 |
+
1. Prepare a grayscale image (e.g., `input.jpg`)
|
| 90 |
+
2. Run the provided example code
|
| 91 |
+
3. Check the output file (`result.png`) for the colorized result
|
| 92 |
+
|
| 93 |
+
## Limitations
|
| 94 |
+
|
| 95 |
+
- May struggle with highly complex, ambiguous, or abstract grayscale images
|
| 96 |
+
- Performance and output quality depend on the clarity and details of the input
|
| 97 |
+
- Primarily optimized for natural images; results may vary for synthetic or artistic inputs
|
| 98 |
+
|
| 99 |
+
## Credits
|
| 100 |
+
|
| 101 |
+
This work builds upon and was inspired by the [DDColor project](https://github.com/piddnad/DDColor).
|
| 102 |
+
**MakeItColor** leverages a dual-encoder strategy from DDColor and is trained on the **ImageNet-Val5k** dataset.
|
| 103 |
+
|
| 104 |
+
Special thanks to the creators of DDColor for their foundational contributions.
|
| 105 |
+
|
| 106 |
+
## License
|
| 107 |
+
|
| 108 |
+
This project is licensed under the **Apache License 2.0**.
|
| 109 |
+
|
| 110 |
+
## Contact
|
| 111 |
+
|
| 112 |
+
For issues, questions, or feedback:
|
| 113 |
+
- Open an issue on the Hugging Face repository
|
| 114 |
+
- Contact the maintainer directly at: [muhammadnomanshafiq76@gmail.com](mailto:muhammadnomanshafiq76@gmail.com)
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
**Developed by Muhammad Noman**
|