keduClassifier / README.md
Hajorda's picture
Upload README.md with huggingface_hub
9d0df1a verified
metadata
license: apache-2.0
tags:
  - image-classification
  - pytorch
  - pet-breeds
  - oxford-iiit-pet-dataset
  - swin-transformer
widget:
  - 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:

    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:

    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