File size: 3,753 Bytes
9c1ca8a
37b1678
5d555ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37b1678
 
 
5d555ad
9c1ca8a
 
37b1678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
tags:
- watermark-removal
- image-enhancement
- watermark-removal
- image-deblurring
- watermark-cleaner
- ai-image-enhancement
- watermarked-image-processing
- watermark-free-images
- image-restoration
- neural-networks
- computer-vision
- watermark-remover
- image-processing
- image-reconstruction
- supervised-learning
license: apache-2.0
language:
- en
sdk: gradio
---

# Watermark Removal Model

## Model Summary
The Watermark Removal model is an image processing model based on neural networks. It is designed to remove watermarks from images while preserving the original image quality. The model utilizes an encoder-decoder structure with skip connections to maintain fine details during the watermark removal process.

<div align="center">
  <img width="640" alt="foduucom/Watermark_Removal" src="https://huggingface.co/foduucom/Watermark_Removal/resolve/main/output.png">
</div>

## Model Details

### Model Description
- **Developed by:** FODUU AI
- **Model type:** Computer Vision - Image Processing 
- **Task:** Remove watermark from image

## Usage Guide

### Installation Requirements
```bash
pip install torch torchvision
pip install Pillow matplotlib numpy
```
or you can run :
```bash
pip install -r requirements.txt
```

### Model Loading and Inference
```python
import torch
from torchvision import transforms
from PIL import Image
from watermark_remover import WatermarkRemover
import numpy as np

image_path = "path to your test image"  # Replace with the path to your test image
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Load the trained model
model = WatermarkRemover().to(device)
model_path = "path to your model.pth"  # Replace with the path to your saved model
model.load_state_dict(torch.load(model_path, map_location=device))
model.eval()

transform = transforms.Compose([transforms.Resize((256, 256)),
                                transforms.ToTensor(),])
watermarked_image = Image.open(image_path).convert("RGB")
original_size = watermarked_image.size  
input_tensor = transform(watermarked_image).unsqueeze(0).to(device)

with torch.no_grad():
    output_tensor = model(input_tensor)

predicted_image = output_tensor.squeeze(0).cpu().permute(1, 2, 0).clamp(0, 1).numpy()
predicted_pil = Image.fromarray((predicted_image * 255).astype(np.uint8))
predicted_pil = predicted_pil.resize(original_size, Image.Resampling.LANCZOS)
predicted_pil.save("predicted_image.jpg", quality=100)


```

## Limitations and Considerations
- Performance may vary depending on watermark complexity and opacity
- Best results achieved with semi-transparent watermarks
- Model trained on 256x256 images; performance may vary with different resolutions
- GPU recommended for faster inference

### Training Details
- **Dataset**: The model was trained on a custom dataset consisting of 20,000 images with watermarks in various styles and intensities.
- **Training Time**: The model was trained for 200 epochs on an NVIDIA GeForce RTX 3060 GPU.
- **Loss Function**: The model uses a combination of MSE (Mean Squared Error) and perceptual loss to optimize watermark removal quality.

### Model Evaluation
The model has been evaluated using Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) on a test set of watermarked images, achieving an average PSNR of 30.5 dB and an SSIM of 0.92.


## Compute Infrastructure

### Hardware
NVIDIA GeForce RTX 3060 card

### Software
The model was trained on Jupyter Notebook environment.

### Model Card Contact
For inquiries and contributions, please contact us at info@foduu.com

```bibtex
@ModelCard{
  author    = {Nehul Agrawal and
               Priyal Mehta},
  title     = {Watermark Removal Using Neural Networks},
  year      = {2025}
}
```