prithivMLmods commited on
Commit
589597d
·
verified ·
1 Parent(s): 08b568f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +96 -0
README.md CHANGED
@@ -2,7 +2,24 @@
2
  license: apache-2.0
3
  datasets:
4
  - qwertyforce/scenery_watermarks
 
 
 
 
 
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
6
  ```py
7
  Classification Report:
8
  precision recall f1-score support
@@ -16,3 +33,82 @@ weighted avg 0.9435 0.9427 0.9424 22762
16
  ```
17
 
18
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/_rKqtbSJbglsRiXmRF1ij.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  datasets:
4
  - qwertyforce/scenery_watermarks
5
+ language:
6
+ - en
7
+ base_model:
8
+ - google/siglip2-base-patch16-224
9
+ pipeline_tag: image-classification
10
+ library_name: transformers
11
+ tags:
12
+ - Watermark-Detection
13
+ - SigLIP2
14
  ---
15
+
16
+ ![5.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/VXSOLkmcLM1t6XhTcYXUh.png)
17
+
18
+ # **Watermark-Detection-SigLIP2**
19
+
20
+ > **Watermark-Detection-SigLIP2** is a vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for **binary image classification**. It is trained to detect whether an image **contains a watermark or not**, using the **SiglipForImageClassification** architecture.
21
+
22
+
23
  ```py
24
  Classification Report:
25
  precision recall f1-score support
 
33
  ```
34
 
35
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/_rKqtbSJbglsRiXmRF1ij.png)
36
+
37
+ ---
38
+
39
+ ## **Label Space: 2 Classes**
40
+
41
+ The model classifies an image as either:
42
+
43
+ ```
44
+ Class 0: "No Watermark"
45
+ Class 1: "Watermark"
46
+ ```
47
+
48
+ ---
49
+
50
+ ## **Install dependencies**
51
+
52
+ ```bash
53
+ pip install -q transformers torch pillow gradio
54
+ ```
55
+
56
+ ---
57
+
58
+ ## **Inference Code**
59
+
60
+ ```python
61
+ import gradio as gr
62
+ from transformers import AutoImageProcessor, SiglipForImageClassification
63
+ from PIL import Image
64
+ import torch
65
+
66
+ # Load model and processor
67
+ model_name = "prithivMLmods/Watermark-Detection-SigLIP2" # Update this if using a different path
68
+ model = SiglipForImageClassification.from_pretrained(model_name)
69
+ processor = AutoImageProcessor.from_pretrained(model_name)
70
+
71
+ # Label mapping
72
+ id2label = {
73
+ "0": "No Watermark",
74
+ "1": "Watermark"
75
+ }
76
+
77
+ def classify_watermark(image):
78
+ image = Image.fromarray(image).convert("RGB")
79
+ inputs = processor(images=image, return_tensors="pt")
80
+
81
+ with torch.no_grad():
82
+ outputs = model(**inputs)
83
+ logits = outputs.logits
84
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
85
+
86
+ prediction = {
87
+ id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
88
+ }
89
+
90
+ return prediction
91
+
92
+ # Gradio Interface
93
+ iface = gr.Interface(
94
+ fn=classify_watermark,
95
+ inputs=gr.Image(type="numpy"),
96
+ outputs=gr.Label(num_top_classes=2, label="Watermark Detection"),
97
+ title="Watermark-Detection-SigLIP2",
98
+ description="Upload an image to detect whether it contains a watermark."
99
+ )
100
+
101
+ if __name__ == "__main__":
102
+ iface.launch()
103
+ ```
104
+
105
+ ---
106
+
107
+ ## **Intended Use**
108
+
109
+ **Watermark-Detection-SigLIP2** is useful in scenarios such as:
110
+
111
+ - **Content Moderation** – Automatically detect watermarked content on image sharing platforms.
112
+ - **Dataset Cleaning** – Filter out watermarked images from training datasets.
113
+ - **Copyright Enforcement** – Monitor and flag usage of watermarked media.
114
+ - **Digital Forensics** – Support analysis of tampered or protected media assets.