Age-Classification-SigLIP2
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 predict the age group of a person from an image using the
SiglipForImageClassification
architecture.
The model categorizes images into five age groups:
Class 0:
"Child 0-12"
Class 1:
"Teenager 13-20"
Class 2:
"Adult 21-44"
Class 3:
"Middle Age 45-64"
Class 4:
"Aged 65+"
Run with Transformers🤗
!pip install -q transformers torch pillow gradio
import gradio as gr
from transformers import AutoImageProcessor
from transformers import SiglipForImageClassification
from transformers.image_utils import load_image
from PIL import Image
import torch
# Load model and processor
model_name = "prithivMLmods/Age-Classification-SigLIP2"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)
defage_classification(image):
"""Predicts the age group of a person from an image."""
image = Image.fromarray(image).convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
labels = {
"0": "Child 0-12",
"1": "Teenager 13-20",
"2": "Adult 21-44",
"3": "Middle Age 45-64",
"4": "Aged 65+"
}
predictions = {labels[str(i)]: round(probs[i], 3) for i inrange(len(probs))}
return predictions
# Create Gradio interface
iface = gr.Interface(
fn=age_classification,
inputs=gr.Image(type="numpy"),
outputs=gr.Label(label="Prediction Scores"),
title="Age Group Classification",
description="Upload an image to predict the person's age group."
)
# Launch the appif __name__ == "__main__":
iface.launch()
Sample Inference:
Intended Use:
The
Age-Classification-SigLIP2
model is designed to classify images into five age categories. Potential use cases include:
Demographic Analysis:
Helping businesses and researchers analyze age distribution.
Health & Fitness Applications:
Assisting in age-based health recommendations.
Security & Access Control:
Implementing age verification in digital systems.
Age-Classification-SigLIP2 huggingface.co is an AI model on huggingface.co that provides Age-Classification-SigLIP2's model effect (), which can be used instantly with this prithivMLmods Age-Classification-SigLIP2 model. huggingface.co supports a free trial of the Age-Classification-SigLIP2 model, and also provides paid use of the Age-Classification-SigLIP2. Support call Age-Classification-SigLIP2 model through api, including Node.js, Python, http.
Age-Classification-SigLIP2 huggingface.co is an online trial and call api platform, which integrates Age-Classification-SigLIP2's modeling effects, including api services, and provides a free online trial of Age-Classification-SigLIP2, you can try Age-Classification-SigLIP2 online for free by clicking the link below.
prithivMLmods Age-Classification-SigLIP2 online free url in huggingface.co:
Age-Classification-SigLIP2 is an open source model from GitHub that offers a free installation service, and any user can find Age-Classification-SigLIP2 on GitHub to install. At the same time, huggingface.co provides the effect of Age-Classification-SigLIP2 install, users can directly use Age-Classification-SigLIP2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Age-Classification-SigLIP2 install url in huggingface.co: