prithivMLmods commited on
Commit
a8f3ead
·
verified ·
1 Parent(s): fc178ed

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -1
README.md CHANGED
@@ -2,8 +2,25 @@
2
  license: apache-2.0
3
  datasets:
4
  - prithivMLmods/High_Res-vs-Low_Res
 
 
 
 
 
 
 
 
 
5
  ---
6
 
 
 
 
 
 
 
 
 
7
  Classification Report:
8
  precision recall f1-score support
9
 
@@ -14,4 +31,64 @@ datasets:
14
  macro avg 0.7096 0.7023 0.7057 5016
15
  weighted avg 0.7795 0.7831 0.7812 5016
16
 
17
- ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/-DY0vd8e2QrSuoievpfvH.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  datasets:
4
  - prithivMLmods/High_Res-vs-Low_Res
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
+ - image
13
+ - quality
14
  ---
15
 
16
+ # **High_Res-vs-Low_Res**
17
+
18
+ > **High_Res-vs-Low_Res** is an image classification vision-language encoder model fine-tuned from **google/siglip2-base-patch16-224** for a single-label classification task. It is designed to assess the resolution quality of images using the **SiglipForImageClassification** architecture.
19
+
20
+ The model categorizes images into two classes:
21
+ - **Class 0:** "High Resolution Image" – indicating that the image has a high resolution and appears sharp and detailed.
22
+ - **Class 1:** "Low Resolution Image" – indicating that the image has a low resolution and may appear pixelated or blurry.
23
+
24
  Classification Report:
25
  precision recall f1-score support
26
 
 
31
  macro avg 0.7096 0.7023 0.7057 5016
32
  weighted avg 0.7795 0.7831 0.7812 5016
33
 
34
+ ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/-DY0vd8e2QrSuoievpfvH.png)
35
+
36
+
37
+
38
+
39
+ # **Run with Transformers🤗**
40
+
41
+ ```python
42
+ !pip install -q transformers torch pillow gradio
43
+ ```
44
+
45
+ ```python
46
+ import gradio as gr
47
+ from transformers import AutoImageProcessor
48
+ from transformers import SiglipForImageClassification
49
+ from transformers.image_utils import load_image
50
+ from PIL import Image
51
+ import torch
52
+
53
+ # Load model and processor
54
+ model_name = "prithivMLmods/High_Res-vs-Low_Res"
55
+ model = SiglipForImageClassification.from_pretrained(model_name)
56
+ processor = AutoImageProcessor.from_pretrained(model_name)
57
+
58
+ def resolution_classification(image):
59
+ """Predicts image resolution classification."""
60
+ image = Image.fromarray(image).convert("RGB")
61
+ inputs = processor(images=image, return_tensors="pt")
62
+
63
+ with torch.no_grad():
64
+ outputs = model(**inputs)
65
+ logits = outputs.logits
66
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
67
+
68
+ labels = {"0": "High Resolution Image", "1": "Low Resolution Image"}
69
+ predictions = {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}
70
+
71
+ return predictions
72
+
73
+ # Create Gradio interface
74
+ iface = gr.Interface(
75
+ fn=resolution_classification,
76
+ inputs=gr.Image(type="numpy"),
77
+ outputs=gr.Label(label="Prediction Scores"),
78
+ title="Image Resolution Classification",
79
+ description="Upload an image to classify its resolution quality."
80
+ )
81
+
82
+ # Launch the app
83
+ if __name__ == "__main__":
84
+ iface.launch()
85
+ ```
86
+
87
+ # **Intended Use:**
88
+
89
+ The **High_Res-vs-Low_Res** model is designed to evaluate the resolution quality of images. It helps distinguish between high-resolution and low-resolution images. Potential use cases include:
90
+
91
+ - **Image Quality Assessment:** Identifying whether an image meets high-resolution standards or suffers from low-quality artifacts.
92
+ - **Content Moderation:** Assisting platforms in filtering low-resolution images for better user experience.
93
+ - **Forensic Analysis:** Supporting researchers and analysts in determining the clarity of images used in various applications.
94
+ - **Image Processing Pipelines:** Helping developers optimize image enhancement algorithms by assessing resolution quality.