prithivMLmods commited on
Commit
606558a
·
verified ·
1 Parent(s): a8dd724

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -3
README.md CHANGED
@@ -1,3 +1,107 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ ---
4
+
5
+ Here’s the fully updated and polished version for your new model **MetaCLIP-2-Gender-Identifier**, with correct label mapping, title, and consistent formatting — ready for use as a Hugging Face model card (`README.md`):
6
+
7
+ ---
8
+
9
+ # **MetaCLIP-2-Gender-Identifier**
10
+
11
+ > **MetaCLIP-2-Gender-Identifier** is an image classification vision-language encoder model fine-tuned from **[facebook/metaclip-2-worldwide-s16](https://huggingface.co/facebook/metaclip-2-worldwide-s16)** for a single-label classification task.
12
+ > It is designed to predict the gender of a person from an image using the **MetaClip2ForImageClassification** architecture.
13
+
14
+ >[!note]
15
+ MetaCLIP 2: A Worldwide Scaling Recipe : https://huggingface.co/papers/2507.22062
16
+
17
+ ```
18
+ Classification Report:
19
+ precision recall f1-score support
20
+
21
+ female 0.9815 0.9631 0.9722 1600
22
+ male 0.9638 0.9819 0.9728 1600
23
+
24
+ accuracy 0.9725 3200
25
+ macro avg 0.9727 0.9725 0.9725 3200
26
+ weighted avg 0.9727 0.9725 0.9725 3200
27
+ ```
28
+
29
+ ![download](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/SWDn8PT5FxrZixb-Jq0pq.png)
30
+
31
+ ---
32
+
33
+ The model categorizes images into two gender classes:
34
+
35
+ * **Class 0:** "female"
36
+ * **Class 1:** "male"
37
+
38
+ # **Run with Transformers**
39
+
40
+ ```python
41
+ !pip install -q transformers torch pillow gradio
42
+ ```
43
+
44
+ ```python
45
+ import gradio as gr
46
+ import torch
47
+ from transformers import AutoImageProcessor, AutoModelForImageClassification
48
+ from PIL import Image
49
+
50
+ # Model name from Hugging Face Hub
51
+ model_name = "prithivMLmods/MetaCLIP-2-Geneder-Identifier"
52
+
53
+ # Load processor and model
54
+ processor = AutoImageProcessor.from_pretrained(model_name)
55
+ model = AutoModelForImageClassification.from_pretrained(model_name)
56
+ model.eval()
57
+
58
+ # Define labels
59
+ LABELS = {
60
+ 0: "female",
61
+ 1: "male"
62
+ }
63
+
64
+ def age_classification(image):
65
+ """Predict the age group of a person from an image."""
66
+ image = Image.fromarray(image).convert("RGB")
67
+ inputs = processor(images=image, return_tensors="pt")
68
+
69
+ with torch.no_grad():
70
+ outputs = model(**inputs)
71
+ logits = outputs.logits
72
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
73
+
74
+ predictions = {LABELS[i]: round(probs[i], 3) for i in range(len(probs))}
75
+ return predictions
76
+
77
+ # Build Gradio interface
78
+ iface = gr.Interface(
79
+ fn=age_classification,
80
+ inputs=gr.Image(type="numpy", label="Upload Image"),
81
+ outputs=gr.Label(label="Predicted Gender"),
82
+ title="MetaCLIP-2-Geneder-Identifier",
83
+ description="Upload an image to predict the person's gender."
84
+ )
85
+
86
+ # Launch app
87
+ if __name__ == "__main__":
88
+ iface.launch()
89
+ ```
90
+
91
+ # **Sample Inference:**
92
+
93
+ ![Screenshot 2025-11-13 at 14-06-43 MetaCLIP-2-Geneder-Identifier](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/ilq2pBgONk4WP3U7dX2YI.png)
94
+ ![Screenshot 2025-11-13 at 14-08-03 MetaCLIP-2-Geneder-Identifier](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/EXJdYEPJMh7LMPJEoNonT.png)
95
+ ![Screenshot 2025-11-13 at 14-08-52 MetaCLIP-2-Geneder-Identifier](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/jvYUEQHX_-Eq2JI1pKLcr.png)
96
+ ![Screenshot 2025-11-13 at 14-09-26 MetaCLIP-2-Geneder-Identifier](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/eTLAyS2ouGnZDxSwi6HnT.png)
97
+
98
+ # **Intended Use:**
99
+
100
+ The **MetaCLIP-2-Gender-Identifier** model is designed to classify images into gender categories.
101
+ Potential use cases include:
102
+
103
+ * **Demographic Analysis:** Supporting research and business insights into gender-based distribution.
104
+ * **Health and Fitness Applications:** Assisting in gender-specific analytics and recommendations.
105
+ * **Security and Access Control:** Supporting gender-based identity verification systems.
106
+ * **Retail and Marketing:** Enabling improved personalization and customer segmentation.
107
+ * **Forensics and Surveillance:** Assisting in identity estimation for investigative purposes.