dboris's picture
Upload README.md with huggingface_hub
f612253 verified
---
license: apache-2.0
tags:
- image-classification
- dog-breeds
- fine-grained
- arcface
- convnext
- pytorch
datasets:
- stanford-dogs
metrics:
- accuracy
pipeline_tag: image-classification
model-index:
- name: Petus Breed Classifier (convnextv2_tiny)
results:
- task:
type: image-classification
dataset:
name: Stanford Dogs
type: stanford-dogs
metrics:
- name: Top-1 Accuracy (Val)
type: accuracy
value: 91.8
- name: Top-5 Accuracy (Val)
type: accuracy
value: 98.7
---
# Petus Breed Classifier (convnextv2_tiny)
Dog breed classifier trained on Stanford Dogs (120 breeds) using **convnextv2_tiny** backbone with **ArcFace** angular margin loss and progressive resizing.
## Model Details
| Property | Value |
|----------|-------|
| Backbone | convnextv2_tiny |
| Loss | ArcFace (s=30.0, m=0.3) |
| Parameters | 28,323,200 |
| Input Size | 336px |
| Val Top-1 | **91.8%** |
| Val Top-5 | **98.7%** |
| Training | 2-phase (frozen head → unfrozen backbone) |
| Progressive Resize | 224 → 336px |
## Training Recipe (v3)
1. **Phase 1**: Frozen backbone, train ArcFace head only (2 epochs)
2. **Phase 2**: Unfreeze backbone with 1/100th LR, cosine annealing (48 epochs)
- 3-epoch linear LR warmup after unfreeze
- Progressive resize from 224→336 mid-training
- ArcFace angular margin loss (no MixUp/CutMix needed)
- Early stopping with patience=10
## Usage
```python
import torch
from torchvision import transforms
from PIL import Image
# Load model
checkpoint = torch.load("convnextv2_tiny_best.pt", map_location="cpu")
# Preprocess
transform = transforms.Compose([
transforms.Resize(384), # 336 * 1.14
transforms.CenterCrop(336),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
image = Image.open("dog.jpg").convert("RGB")
input_tensor = transform(image).unsqueeze(0)
# Inference
model.eval()
with torch.no_grad():
logits = model(input_tensor)
pred = logits.argmax(dim=1).item()
confidence = logits.softmax(dim=1).max().item()
```
## Breeds
120 dog breeds from the Stanford Dogs dataset (synsets from ImageNet).
## Citation
```bibtex
@misc{petus-breed-ml,
author = {199 Biotechnologies},
title = {Petus Breed Classifier},
year = {2026},
url = {https://github.com/199-biotechnologies/petus-breed-ml}
}
```
## License
Apache 2.0