File size: 1,779 Bytes
f659b9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7295e34
 
 
 
 
 
 
 
 
 
f659b9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---

license: mit
tags:
- image-classification
- pytorch
- dog-breed
- mobilenet
- computer-vision
datasets:
- custom
---


# 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