Downloads · 30 days
0
Alamgirapi/sports-ball-convnext-classifier
sports-ball-convnext-classifier is a image classification model from Alamgirapi. Use it when you need a label for an image. It is set up for timm. The card lists the license as mit.
This model is a fine-tuned ConvNeXt-Base architecture trained to classify 15 different types of sports balls. The model can accurately distinguish between various sports equipment including footballs, basketballs, ten…
Downloads · 30 days
0
Access
Public
Updated Aug 20, 2025
Repo size
343 MB
Likes
0
Public
Click a slice to open those files.
.pth343 MB · 100%
From the Hugging Face model README
This model is a fine-tuned ConvNeXt-Base architecture trained to classify 15 different types of sports balls. The model can accurately distinguish between various sports equipment including footballs, basketballs, tennis balls, and more specialized items like hockey pucks and shuttlecocks.
The model was trained using transfer learning from a ConvNeXt-Base model pre-trained on ImageNet, with the classification head modified for 15-class sports ball classification. It achieves strong performance across all sports ball categories and is optimized for real-world deployment scenarios.
Key features:
The model can classify the following categories:
import torch
import timm
from torchvision import transforms
from PIL import Image
# Load model
model = timm.create_model('convnext_base', pretrained=False)
model.head = torch.nn.Sequential(
torch.nn.AdaptiveAvgPool2d(1),
torch.nn.Flatten(),
torch.nn.Linear(model.head.in_features, 15)
)
# Load weights
model.load_state_dict(torch.load('model.pth', map_location='cpu'))
model.eval()
# Preprocessing
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
# Inference
image = Image.open('your_image.jpg')
input_tensor = transform(image).unsqueeze(0)
with torch.no_grad():
outputs = model(input_tensor)
probabilities = torch.nn.functional.softmax(outputs[0], dim=0)
predicted_class = torch.argmax(probabilities).item()
The model uses standard ImageNet preprocessing with mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225].
For best results:
The training dataset consisted of carefully curated sports ball images with balanced representation across all 15 categories. Data augmentation techniques including rotation, scaling, and color jittering were applied during training to improve generalization.
If you use this model, please cite:
@misc{sports_ball_convnext_classifier_2024,
title={Sports Ball Classifier - ConvNeXt Base},
author={Alamgirapi},
year={2025},
howpublished={\url{https://huggingface.co/Alamgirapi/sports-ball-convnext-classifier}}
}
For questions or issues, please contact: [email protected]