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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ReviveAI β¨
|
2 |
+
|
3 |
+
|
4 |
+
<p align="center">
|
5 |
+
<img src="./assets/revive banner.png" alt="ReviveAI Logo" width="50%"/>
|
6 |
+
<p align="center">
|
7 |
+
<em>Restore your memories. AI-powered image deblurring, sharpening, and scratch removal.</em>
|
8 |
+
</p>
|
9 |
+
|
10 |
+
<p align="center">
|
11 |
+
<a href="#"><img src="https://img.shields.io/badge/Build-Passing-brightgreen" alt="Build Status"></a>
|
12 |
+
<a href="link/to/your/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue" alt="License"></a>
|
13 |
+
<a href="#"><img src="https://img.shields.io/badge/Python-3.8+-blueviolet" alt="Python Version"></a>
|
14 |
+
<a href="link/to/your/contributing/guide"><img src="https://img.shields.io/badge/Contributions-Welcome-orange" alt="Contributions Welcome"></a>
|
15 |
+
</p>
|
16 |
+
|
17 |
+
---
|
18 |
+
|
19 |
+
## π About ReviveAI
|
20 |
+
|
21 |
+
ReviveAI leverages the power of Artificial Intelligence to breathe new life into your old or degraded photographs. Whether it's blurriness from camera shake, general lack of sharpness, or physical damage like scratches, ReviveAI aims to restore clarity and detail, preserving your precious moments.
|
22 |
+
|
23 |
+
This project utilizes state-of-the-art deep learning models trained specifically for image restoration tasks. Our goal is to provide an accessible tool for enhancing image quality significantly.
|
24 |
+
|
25 |
+
---
|
26 |
+
|
27 |
+
## π₯ Key Features
|
28 |
+
<p align = "center"><img src="./assets/features.png" alt="Features" width="100%" align = "center"/></p>
|
29 |
+
|
30 |
+
* **β
Completed - Image Sharpening:** Enhances fine details and edges for a crisper look.
|
31 |
+
* **β
Completed - Scratch Removal:** Intelligently detects and inpaints scratches and minor damages on photographs.
|
32 |
+
* **π οΈ Work-in-progress - Image Colorization(Coming Soon):** Adds realistic color to grayscale images.
|
33 |
+
|
34 |
+
---
|
35 |
+
|
36 |
+
## β¨ Before & After Showcase
|
37 |
+
|
38 |
+
See the results of ReviveAI in action!
|
39 |
+
|
40 |
+
<p align="center"> <!-- Center align the entire table block -->
|
41 |
+
|
42 |
+
| Examples | Task Performed |
|
43 |
+
| :-----------------------------------------: | :----------------- |
|
44 |
+
| <img src="./assets/sharpen1.png" alt="ReviveAI Sharp Result 1" width="650"> | Image Sharpening |
|
45 |
+
| <img src="./assets/sharpen2.png" alt="ReviveAI Sharp Result 2" width="650"> | Image Sharpening |
|
46 |
+
| <img src="./assets/scratch1.png" alt="ReviveAI Scratch Removal Result 1" width="650"> | Scratch Removal |
|
47 |
+
| <img src="./assets/scratch2.png" alt="ReviveAI Scratch Removal Result 2" width="650"> | Scratch Removal |
|
48 |
+
</p> <!-- End of center alignment -->
|
49 |
+
|
50 |
+
---
|
51 |
+
|
52 |
+
|
53 |
+
## π οΈ Tech Stack
|
54 |
+
|
55 |
+
<p align="center"> <!-- Or use align="center" if you prefer -->
|
56 |
+
<a href="https://www.python.org/" target="_blank">
|
57 |
+
<img src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" alt="Python"/>
|
58 |
+
</a>Β
|
59 |
+
<a href="https://www.tensorflow.org/" target="_blank">
|
60 |
+
<img src="https://img.shields.io/badge/TensorFlow-%23FF6F00.svg?style=for-the-badge&logo=TensorFlow&logoColor=white" alt="TensorFlow"/>
|
61 |
+
</a>Β
|
62 |
+
<a href="https://opencv.org/" target="_blank">
|
63 |
+
<img src="https://img.shields.io/badge/opencv-%235C3EE8.svg?style=for-the-badge&logo=opencv&logoColor=white" alt="OpenCV"/>
|
64 |
+
</a>Β
|
65 |
+
<a href="https://numpy.org/" target="_blank">
|
66 |
+
<img src="https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white" alt="NumPy"/>
|
67 |
+
</a>Β
|
68 |
+
<!-- Add more badges here if needed for GUI, Web Frameworks, etc. -->
|
69 |
+
</p>
|
70 |
+
|
71 |
+
---
|
72 |
+
|
73 |
+
|
74 |
+
## π Implementation Status
|
75 |
+
|
76 |
+
Track the development progress of ReviveAI's key features and components:
|
77 |
+
|
78 |
+
| Feature / Component | Status | Notes / Remarks (Optional) |
|
79 |
+
| :--------------------------- | :----------------------- | :------------------------- |
|
80 |
+
| Image Deblurring/Sharpening | β
Completed | Core model functional |
|
81 |
+
| Scratch Removal | β
Completed | Core model functional |
|
82 |
+
| Image Colorization | π§ In Progress | Model integration underway |
|
83 |
+
|
84 |
+
---
|
85 |
+
|
86 |
+
## π Getting Started
|
87 |
+
|
88 |
+
Follow these steps to get ReviveAI running on your local machine or in a Jupyter/Kaggle notebook.
|
89 |
+
|
90 |
+
### 1. Prerequisites
|
91 |
+
|
92 |
+
Ensure you have the following installed:
|
93 |
+
|
94 |
+
- Python 3.8 or above
|
95 |
+
- `pip` (Python package manager)
|
96 |
+
- Git (for cloning the repository)
|
97 |
+
- [Hugging Face CLI (optional)](https://huggingface.co/docs/huggingface_hub/quick-start)
|
98 |
+
- Jupyter Notebook or run on [Kaggle](https://kaggle.com) / [Google Colab](https://colab.research.google.com)
|
99 |
+
|
100 |
+
|
101 |
+
---
|
102 |
+
|
103 |
+
### 2. Clone the Repository
|
104 |
+
|
105 |
+
```bash
|
106 |
+
git clone https://github.com/Zummya/ReviveAI.git
|
107 |
+
cd ReviveAI
|
108 |
+
```
|
109 |
+
|
110 |
+
---
|
111 |
+
|
112 |
+
### 3. Set Up the Environment
|
113 |
+
|
114 |
+
We recommend using a virtual environment:
|
115 |
+
|
116 |
+
```bash
|
117 |
+
python -m venv env
|
118 |
+
source env/bin/activate # On Windows: env\Scripts\activate
|
119 |
+
pip install -r requirements.txt
|
120 |
+
```
|
121 |
+
|
122 |
+
---
|
123 |
+
|
124 |
+
## π― Load Pretrained Models
|
125 |
+
|
126 |
+
All models are hosted on the Hugging Face Hub for convenience and version control.
|
127 |
+
|
128 |
+
### πΉ Load Image Sharpening Model
|
129 |
+
|
130 |
+
```python
|
131 |
+
from huggingface_hub import hf_hub_download
|
132 |
+
from tensorflow.keras.models import load_model
|
133 |
+
|
134 |
+
model_path = hf_hub_download(
|
135 |
+
repo_id="Sami-on-hugging-face/RevAI_Deblur_Model",
|
136 |
+
filename="SharpeningModel_512_30Epochs.keras"
|
137 |
+
)
|
138 |
+
model = load_model(model_path, compile=False)
|
139 |
+
```
|
140 |
+
|
141 |
+
---
|
142 |
+
|
143 |
+
### πΉ Load Scratch Removal Model
|
144 |
+
|
145 |
+
```python
|
146 |
+
from huggingface_hub import hf_hub_download
|
147 |
+
from tensorflow.keras.models import load_model
|
148 |
+
|
149 |
+
model_path = hf_hub_download(
|
150 |
+
repo_id="Sami-on-hugging-face/RevAI_Scratch_Removal_Model",
|
151 |
+
filename="scratch_removal_test2.h5"
|
152 |
+
)
|
153 |
+
model = load_model(model_path, compile=False)
|
154 |
+
```
|
155 |
+
|
156 |
+
|
157 |
+
---
|
158 |
+
|
159 |
+
### π Folder Structure
|
160 |
+
|
161 |
+
```bash
|
162 |
+
ReviveAI/
|
163 |
+
β
|
164 |
+
βββ README.md
|
165 |
+
βββ .gitignore
|
166 |
+
βββ requirements.txt
|
167 |
+
β
|
168 |
+
βββ models/
|
169 |
+
β βββ sharpening_model.txt # Hugging Face URL
|
170 |
+
β βββ scratch_removal_model.txt # Hugging Face URL
|
171 |
+
β
|
172 |
+
βββ notebooks/
|
173 |
+
β βββ scratch_removal_notebook.ipynb
|
174 |
+
β βββ sharpening_model_notebook.ipynb
|
175 |
+
β
|
176 |
+
βββ before_after_examples/
|
177 |
+
β βββ sharpening/
|
178 |
+
β βββ scratch_removal/
|
179 |
+
β
|
180 |
+
βββ assets/
|
181 |
+
β βββ revive banner.png, showcase images etc.
|
182 |
+
|
183 |
+
```
|
184 |
+
|
185 |
+
---
|
186 |
+
|
187 |
+
## π§ͺ Training & Running the Models
|
188 |
+
|
189 |
+
ReviveAI includes end-to-end Jupyter notebooks that allow you to both **train** the models from scratch and **test** them on custom images.
|
190 |
+
|
191 |
+
### π Available Notebooks
|
192 |
+
|
193 |
+
| Notebook | Description |
|
194 |
+
| -------- | ----------- |
|
195 |
+
| `sharpening_model_notebook.ipynb` | Train the sharpening (deblurring) model + Run predictions |
|
196 |
+
| `scratch_removal_notebook.ipynb` | Train the scratch removal model + Run predictions |
|
197 |
+
|
198 |
+
---
|
199 |
+
|
200 |
+
### π‘ Notebook Features
|
201 |
+
|
202 |
+
Each notebook includes:
|
203 |
+
|
204 |
+
- π§ **Model Architecture**
|
205 |
+
- π **Data Loading & Preprocessing**
|
206 |
+
- ποΈ **Training Pipeline** (with adjustable hyperparameters)
|
207 |
+
- πΎ **Saving & Exporting Weights**
|
208 |
+
- π **Evaluation**
|
209 |
+
- πΌοΈ **Visual Demo on Custom Images**
|
210 |
+
|
211 |
+
---
|
212 |
+
|
213 |
+
### πΌοΈ Quick Test Function (for inference)
|
214 |
+
|
215 |
+
To run a prediction on a new image (after training or loading a model), use:
|
216 |
+
|
217 |
+
```python
|
218 |
+
def display_prediction(image_path, model):
|
219 |
+
import cv2
|
220 |
+
import matplotlib.pyplot as plt
|
221 |
+
import numpy as np
|
222 |
+
|
223 |
+
img = cv2.imread(image_path)
|
224 |
+
img = cv2.resize(img, (256, 256)) / 255.0
|
225 |
+
input_img = np.expand_dims(img, axis=0)
|
226 |
+
predicted = model.predict(input_img)[0]
|
227 |
+
|
228 |
+
plt.figure(figsize=(10, 5))
|
229 |
+
plt.subplot(1, 2, 1)
|
230 |
+
plt.imshow(img[..., ::-1])
|
231 |
+
plt.title("Original Input")
|
232 |
+
plt.axis("off")
|
233 |
+
|
234 |
+
plt.subplot(1, 2, 2)
|
235 |
+
plt.imshow(predicted)
|
236 |
+
plt.title("Model Output")
|
237 |
+
plt.axis("off")
|
238 |
+
|
239 |
+
plt.show()
|
240 |
+
```
|
241 |
+
|
242 |
+
Run the function like this:
|
243 |
+
|
244 |
+
```python
|
245 |
+
display_prediction("your_image_path.jpg", model)
|
246 |
+
```
|
247 |
+
|
248 |
+
---
|
249 |
+
|
250 |
+
> β
Tip: If you don't want to train from scratch, you can directly load pretrained weights from Hugging Face (see [π― Load Pretrained Models](#-load-pretrained-models)) and skip to the testing section.
|
251 |
+
|
252 |
+
<div align="center">
|
253 |
+
<h2>
|
254 |
+
<b>ReviveAI</b>
|
255 |
+
</h2>
|
256 |
+
<h3>
|
257 |
+
Made with β€οΈ at <a href="https://github.com/ISTE-VIT" target="_blank">ISTE-VIT</a>
|
258 |
+
</h3>
|
259 |
+
|
260 |
+
---
|
261 |
+
</div>
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tensorflow
|
2 |
+
numpy
|
3 |
+
matplotlib
|
4 |
+
opencv-python
|
5 |
+
huggingface_hub
|