|
|
--- |
|
|
license: mit |
|
|
pipeline_tag: image-classification |
|
|
tags: |
|
|
- image-classification |
|
|
- pytorch |
|
|
- dog-breed |
|
|
- mobilenet |
|
|
- computer-vision |
|
|
datasets: |
|
|
- custom |
|
|
library_name: transformers |
|
|
--- |
|
|
|
|
|
# Dog Breed Classifier |
|
|
|
|
|
This is a MobileNetV2 model fine-tuned for dog breed classification with 120 breed classes. |
|
|
|
|
|
## Supported Breeds |
|
|
|
|
|
- Chihuahua |
|
|
- Japanese Spaniel |
|
|
- Maltese Dog |
|
|
- Pekinese |
|
|
- Shih-Tzu |
|
|
- Blenheim Spaniel |
|
|
- Papillon |
|
|
- Toy Terrier |
|
|
- Rhodesian Ridgeback |
|
|
- Afghan Hound |
|
|
- ... and 110 more breeds |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Architecture**: MobileNetV2 with custom classifier |
|
|
- **Input Size**: 224x224 pixels |
|
|
- **Number of Classes**: 120 |
|
|
- **Framework**: PyTorch |
|
|
|
|
|
## Usage |
|
|
|
|
|
### Via Hugging Face Inference API |
|
|
|
|
|
```python |
|
|
import requests |
|
|
|
|
|
API_URL = "https://api-inference.huggingface.co/models/valentinocc/dog-breed-classifier" |
|
|
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} |
|
|
|
|
|
def query(filename): |
|
|
with open(filename, "rb") as f: |
|
|
data = f.read() |
|
|
response = requests.post(API_URL, headers=headers, data=data) |
|
|
return response.json() |
|
|
|
|
|
# Predict dog breed |
|
|
output = query("dog_image.jpg") |
|
|
print(f"Predicted breed: {output[0]['label']} ({output[0]['score']:.2%} confidence)") |
|
|
``` |
|
|
|
|
|
### Django Integration |
|
|
|
|
|
```python |
|
|
from utils.huggingface_client import HuggingFaceClient |
|
|
|
|
|
hf_client = HuggingFaceClient() |
|
|
result = hf_client.classify_image(image_file, "valentinocc/dog-breed-classifier") |
|
|
``` |
|
|
|
|
|
## Training Details |
|
|
|
|
|
This model was trained on a custom dataset of dog breed images using transfer learning on MobileNetV2. |
|
|
The model achieves good performance across 120 different dog breeds. |
|
|
|
|
|
## Model Performance |
|
|
|
|
|
- Input: RGB images, 224x224 pixels |
|
|
- Output: Probability distribution over 120 dog breeds |
|
|
- Architecture: MobileNetV2 backbone + custom classifier |