Instructions to use nateraw/vit-age-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nateraw/vit-age-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="nateraw/vit-age-classifier") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("nateraw/vit-age-classifier") model = AutoModelForImageClassification.from_pretrained("nateraw/vit-age-classifier", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Teen photos come back as 20-29 β doesn't work as an under-18 check
Hi, thanks for sharing this model. I tested it as a safety check, to catch pictures of people under 18 before an image tool uses them, and it didn't work for that.
On a small test (12 pictures), the top answer was "20-29" for every single one. That included a real photo of a 14-year-old (20-29 at 72%) and another teen photo (20-29 at 47%). The "10-19" group never came out on top, even for the kids. Adults also all came back 20-29, so it isn't telling anyone apart.
For comparison, prithivMLmods/Age-Classification-SigLIP2 put both teen photos in its teenager group (71% and 79%) and the adults in its adult group, on the same pictures and the same settings (transformers, CPU, default preprocessor).
I'll keep an eye out should you make any adjustments and need testing. Thank you.