prithivMLmods commited on
Commit
b1506a2
·
verified ·
1 Parent(s): c12e5ca

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +100 -0
README.md CHANGED
@@ -2,8 +2,25 @@
2
  license: apache-2.0
3
  datasets:
4
  - vieanh/sports_img_classification
 
 
 
 
 
 
 
 
 
 
 
5
  ---
6
 
 
 
 
 
 
 
7
  ```py
8
  Classification Report:
9
  precision recall f1-score support
@@ -23,3 +40,86 @@ weighted avg 0.9611 0.9606 0.9606 6655
23
 
24
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/rrUjAtRXEZWIOySA_7n1r.png)
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  datasets:
4
  - vieanh/sports_img_classification
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
+ - Sports
13
+ - Cricket
14
+ - art
15
+ - Basketball
16
  ---
17
 
18
+ ![FGI.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/4x5S3wqAgJiNuFtoqZzq9.png)
19
+
20
+ # **SportsNet-7**
21
+
22
+ > **SportsNet-7** is a SigLIP2-based image classification model fine-tuned to identify seven popular sports categories. Built upon the powerful `google/siglip2-base-patch16-224` backbone, this model enables fast and accurate sport-type recognition from images or video frames.
23
+
24
  ```py
25
  Classification Report:
26
  precision recall f1-score support
 
40
 
41
  ![download.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/rrUjAtRXEZWIOySA_7n1r.png)
42
 
43
+ ---
44
+
45
+ ## **Label Classes**
46
+
47
+ The model classifies an input image into one of the following 7 sports:
48
+
49
+ ```
50
+ 0: badminton
51
+ 1: cricket
52
+ 2: football
53
+ 3: karate
54
+ 4: swimming
55
+ 5: tennis
56
+ 6: wrestling
57
+ ```
58
+
59
+ ---
60
+
61
+ ## **Installation**
62
+
63
+ ```bash
64
+ pip install transformers torch pillow gradio
65
+ ```
66
+
67
+ ---
68
+
69
+ ## **Example Inference Code**
70
+
71
+ ```python
72
+ import gradio as gr
73
+ from transformers import AutoImageProcessor, SiglipForImageClassification
74
+ from PIL import Image
75
+ import torch
76
+
77
+ # Load model and processor
78
+ model_name = "prithivMLmods/SportsNet-7"
79
+ model = SiglipForImageClassification.from_pretrained(model_name)
80
+ processor = AutoImageProcessor.from_pretrained(model_name)
81
+
82
+ # Label mapping
83
+ id2label = {
84
+ "0": "badminton",
85
+ "1": "cricket",
86
+ "2": "football",
87
+ "3": "karate",
88
+ "4": "swimming",
89
+ "5": "tennis",
90
+ "6": "wrestling"
91
+ }
92
+
93
+ def predict_sport(image):
94
+ image = Image.fromarray(image).convert("RGB")
95
+ inputs = processor(images=image, return_tensors="pt")
96
+
97
+ with torch.no_grad():
98
+ outputs = model(**inputs)
99
+ logits = outputs.logits
100
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
101
+
102
+ prediction = {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
103
+ return prediction
104
+
105
+ # Gradio interface
106
+ iface = gr.Interface(
107
+ fn=predict_sport,
108
+ inputs=gr.Image(type="numpy"),
109
+ outputs=gr.Label(num_top_classes=3, label="Predicted Sport"),
110
+ title="SportsNet-7",
111
+ description="Upload a sports image to classify it as Badminton, Cricket, Football, Karate, Swimming, Tennis, or Wrestling."
112
+ )
113
+
114
+ if __name__ == "__main__":
115
+ iface.launch()
116
+ ```
117
+
118
+ ---
119
+
120
+ ## **Use Cases**
121
+
122
+ * Sports video tagging
123
+ * Real-time sport event classification
124
+ * Dataset enrichment for sports analytics
125
+ * Educational or training datasets for sports AI