Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- pytorch
|
| 6 |
+
- pet-breeds
|
| 7 |
+
- oxford-iiit-pet-dataset
|
| 8 |
+
- swin-transformer
|
| 9 |
+
widget:
|
| 10 |
+
# You might need to configure a Space for the widget to work effectively
|
| 11 |
+
# Or provide a link to your Gradio Space if you create one
|
| 12 |
+
- example_url: "https://huggingface.co/datasets/huggingface/cats-image/resolve/main/cats-300.jpg"
|
| 13 |
+
---
|
| 14 |
+
# KEDU Breed Classifier (swin_tiny_patch4_window7_224)
|
| 15 |
+
|
| 16 |
+
This model classifies pet breeds based on the Oxford-IIIT Pet Dataset.
|
| 17 |
+
Model architecture: `swin_tiny_patch4_window7_224`.
|
| 18 |
+
|
| 19 |
+
## How to Use
|
| 20 |
+
|
| 21 |
+
1. **Install dependencies:**
|
| 22 |
+
```bash
|
| 23 |
+
pip install torch torchvision timm pytorch-lightning albumentations opencv-python-headless scikit-learn Pillow huggingface_hub python-box PyYAML
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
2. **Download `inference.py`, `pytorch_model.ckpt`, and `label_encoder.pkl` from this repository.**
|
| 27 |
+
|
| 28 |
+
3. **Run inference:**
|
| 29 |
+
```python
|
| 30 |
+
from inference import load_model_from_hf, load_label_encoder_from_hf, predict_breed
|
| 31 |
+
|
| 32 |
+
model = load_model_from_hf(repo_id="Hajorda/keduClassifier")
|
| 33 |
+
label_encoder = load_label_encoder_from_hf(repo_id="Hajorda/keduClassifier")
|
| 34 |
+
|
| 35 |
+
image_path = "path/to/your/pet_image.jpg" # Replace with your image path
|
| 36 |
+
predicted_breed, confidence = predict_breed(image_path, model, label_encoder)
|
| 37 |
+
print(f"Predicted: {predicted_breed}, Confidence: {confidence:.4f}")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Model Details
|
| 41 |
+
- **Dataset:** Oxford-IIIT Pet Dataset
|
| 42 |
+
- **Number of Classes:** 37
|
| 43 |
+
- **Image Size:** (224, 224)
|
| 44 |
+
|
| 45 |
+
## Performance
|
| 46 |
+
- **Validation Accuracy:** 93.40%
|
| 47 |
+
(Note: This is the validation accuracy from the training run.)
|
| 48 |
+
|
| 49 |
+
## Author
|
| 50 |
+
Hajorda
|