File size: 8,346 Bytes
cbb3df2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63ea90a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
---
tags:
- image-restoration
- deblurring
- sharpening
- scratch-removal
- deep-learning
- computer-vision
- tensorflow
- keras
license: mit
language: en
library_name: keras
datasets: []
metrics:
- psnr
- ssim
widget:
  - src: assets/revive_banner.png
    example_title: ReviveAI Example Image
inference: true
---





# ReviveAI ✨


<p align="center">
  <img src="./assets/revive banner.png" alt="ReviveAI Logo" width="50%"/>
<p align="center">
  <em>Restore your memories. AI-powered image deblurring, sharpening, and scratch removal.</em>
</p>

<p align="center">
  <a href="#"><img src="https://img.shields.io/badge/Build-Passing-brightgreen" alt="Build Status"></a>
  <a href="link/to/your/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue" alt="License"></a> 
  <a href="#"><img src="https://img.shields.io/badge/Python-3.8+-blueviolet" alt="Python Version"></a>
  <a href="link/to/your/contributing/guide"><img src="https://img.shields.io/badge/Contributions-Welcome-orange" alt="Contributions Welcome"></a>
</p>

---

## πŸ“– About ReviveAI

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.

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.

---

## πŸ”₯ Key Features
<p align = "center"><img src="./assets/features.png" alt="Features" width="100%" align = "center"/></p>

*   **βœ… Completed - Image Sharpening:** Enhances fine details and edges for a crisper look.
*   **βœ… Completed - Scratch Removal:** Intelligently detects and inpaints scratches and minor damages on photographs.
*   **πŸ› οΈ Work-in-progress - Image Colorization(Coming Soon):** Adds realistic color to grayscale images.

---

## ✨ Before & After Showcase

See the results of ReviveAI in action!

<p align="center"> <!-- Center align the entire table block -->

| Examples                                    | Task Performed     |
| :-----------------------------------------: | :----------------- |
| <img src="./assets/sharpen1.png" alt="ReviveAI Sharp Result 1" width="650"> | Image Sharpening   |
| <img src="./assets/sharpen2.png" alt="ReviveAI Sharp Result 2" width="650"> | Image Sharpening   |
| <img src="./assets/scratch1.png" alt="ReviveAI Scratch Removal Result 1" width="650"> | Scratch Removal    |
| <img src="./assets/scratch2.png" alt="ReviveAI Scratch Removal Result 2" width="650"> | Scratch Removal    |
</p> <!-- End of center alignment -->

---


## πŸ› οΈ Tech Stack

<p align="center"> <!-- Or use align="center" if you prefer -->
  <a href="https://www.python.org/" target="_blank">
    <img src="https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54" alt="Python"/>
  </a>Β 
  <a href="https://www.tensorflow.org/" target="_blank">
    <img src="https://img.shields.io/badge/TensorFlow-%23FF6F00.svg?style=for-the-badge&logo=TensorFlow&logoColor=white" alt="TensorFlow"/>
  </a>Β 
  <a href="https://opencv.org/" target="_blank">
    <img src="https://img.shields.io/badge/opencv-%235C3EE8.svg?style=for-the-badge&logo=opencv&logoColor=white" alt="OpenCV"/>
  </a>Β 
  <a href="https://numpy.org/" target="_blank">
    <img src="https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white" alt="NumPy"/>
  </a>Β 
  <!-- Add more badges here if needed for GUI, Web Frameworks, etc. -->
</p>

---


## πŸ“Š Implementation Status

Track the development progress of ReviveAI's key features and components:

| Feature / Component          | Status                   | Notes / Remarks (Optional) |
| :--------------------------- | :----------------------- | :------------------------- |
| Image Deblurring/Sharpening  | βœ… Completed             | Core model functional      |
| Scratch Removal              | βœ… Completed             | Core model functional      |
| Image Colorization           | 🚧 In Progress           | Model integration underway |

---

## πŸš€ Getting Started

Follow these steps to get ReviveAI running on your local machine or in a Jupyter/Kaggle notebook.

### 1. Prerequisites

Ensure you have the following installed:

- Python 3.8 or above  
- `pip` (Python package manager)  
- Git (for cloning the repository)  
- [Hugging Face CLI (optional)](https://huggingface.co/docs/huggingface_hub/quick-start)  
- Jupyter Notebook or run on [Kaggle](https://kaggle.com) / [Google Colab](https://colab.research.google.com)


---

### 2. Clone the Repository

```bash
git clone https://github.com/Zummya/ReviveAI.git
cd ReviveAI
```

---

### 3. Set Up the Environment

We recommend using a virtual environment:

```bash
python -m venv env
source env/bin/activate  # On Windows: env\Scripts\activate
pip install -r requirements.txt
```

---

## 🎯 Load Pretrained Models

All models are hosted on the Hugging Face Hub for convenience and version control.

### πŸ”Ή Load Image Sharpening Model

```python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model

model_path = hf_hub_download(
    repo_id="Sami-on-hugging-face/RevAI_Deblur_Model", 
    filename="SharpeningModel_512_30Epochs.keras"
)
model = load_model(model_path, compile=False)
```

---

### πŸ”Ή Load Scratch Removal Model

```python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model

model_path = hf_hub_download(
    repo_id="Sami-on-hugging-face/RevAI_Scratch_Removal_Model", 
    filename="scratch_removal_test2.h5"
)
model = load_model(model_path, compile=False)
```


---

### πŸ“ Folder Structure

```bash
ReviveAI/
β”‚
β”œβ”€β”€ README.md
β”œβ”€β”€ .gitignore
β”œβ”€β”€ requirements.txt
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ sharpening_model.txt         # Hugging Face URL
β”‚   └── scratch_removal_model.txt    # Hugging Face URL
β”‚
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ scratch_removal_notebook.ipynb
β”‚   └── sharpening_model_notebook.ipynb
β”‚
β”œβ”€β”€ before_after_examples/
β”‚   β”œβ”€β”€ sharpening/
β”‚   └── scratch_removal/
β”‚
β”œβ”€β”€ assets/
β”‚   └── revive banner.png, showcase images etc.

```

---

## πŸ§ͺ Training & Running the Models

ReviveAI includes end-to-end Jupyter notebooks that allow you to both **train** the models from scratch and **test** them on custom images.

### πŸ“˜ Available Notebooks

| Notebook | Description |
| -------- | ----------- |
| `sharpening_model_notebook.ipynb` | Train the sharpening (deblurring) model + Run predictions |
| `scratch_removal_notebook.ipynb` | Train the scratch removal model + Run predictions |

---

### πŸ’‘ Notebook Features

Each notebook includes:

- 🧠 **Model Architecture**  
- πŸ” **Data Loading & Preprocessing**
- πŸ‹οΈ **Training Pipeline** (with adjustable hyperparameters)
- πŸ’Ύ **Saving & Exporting Weights**
- πŸ” **Evaluation**
- πŸ–ΌοΈ **Visual Demo on Custom Images**

---

### πŸ–ΌοΈ Quick Test Function (for inference)

To run a prediction on a new image (after training or loading a model), use:

```python
def display_prediction(image_path, model):
    import cv2
    import matplotlib.pyplot as plt
    import numpy as np

    img = cv2.imread(image_path)
    img = cv2.resize(img, (256, 256)) / 255.0
    input_img = np.expand_dims(img, axis=0)
    predicted = model.predict(input_img)[0]

    plt.figure(figsize=(10, 5))
    plt.subplot(1, 2, 1)
    plt.imshow(img[..., ::-1])
    plt.title("Original Input")
    plt.axis("off")

    plt.subplot(1, 2, 2)
    plt.imshow(predicted)
    plt.title("Model Output")
    plt.axis("off")

    plt.show()
```

Run the function like this:

```python
display_prediction("your_image_path.jpg", model)
```

---

> βœ… 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.

<div align="center">
  <h2>
    <b>ReviveAI</b>
  </h2>
  <h3>
    Made with ❀️ at <a href="https://github.com/ISTE-VIT" target="_blank">ISTE-VIT</a>
  </h3>
   
  ---
</div>