File size: 1,628 Bytes
9d0df1a |
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 |
---
license: apache-2.0
tags:
- image-classification
- pytorch
- pet-breeds
- oxford-iiit-pet-dataset
- swin-transformer
widget:
# You might need to configure a Space for the widget to work effectively
# Or provide a link to your Gradio Space if you create one
- example_url: "https://huggingface.co/datasets/huggingface/cats-image/resolve/main/cats-300.jpg"
---
# KEDU Breed Classifier (swin_tiny_patch4_window7_224)
This model classifies pet breeds based on the Oxford-IIIT Pet Dataset.
Model architecture: `swin_tiny_patch4_window7_224`.
## How to Use
1. **Install dependencies:**
```bash
pip install torch torchvision timm pytorch-lightning albumentations opencv-python-headless scikit-learn Pillow huggingface_hub python-box PyYAML
```
2. **Download `inference.py`, `pytorch_model.ckpt`, and `label_encoder.pkl` from this repository.**
3. **Run inference:**
```python
from inference import load_model_from_hf, load_label_encoder_from_hf, predict_breed
model = load_model_from_hf(repo_id="Hajorda/keduClassifier")
label_encoder = load_label_encoder_from_hf(repo_id="Hajorda/keduClassifier")
image_path = "path/to/your/pet_image.jpg" # Replace with your image path
predicted_breed, confidence = predict_breed(image_path, model, label_encoder)
print(f"Predicted: {predicted_breed}, Confidence: {confidence:.4f}")
```
## Model Details
- **Dataset:** Oxford-IIIT Pet Dataset
- **Number of Classes:** 37
- **Image Size:** (224, 224)
## Performance
- **Validation Accuracy:** 93.40%
(Note: This is the validation accuracy from the training run.)
## Author
Hajorda
|