animals-classifier / README.md
Bubunur's picture
Update README.md
c240840 verified
|
Raw History Blame Contribute Delete
3.1 kB
metadata
license: cc-by-nc-sa-4.0
base_model: google/vit-base-patch16-224-in21k
datasets:
  - Bubunur/dog-cat-panda
pipeline_tag: image-classification
library_name: transformers
tags:
  - image-classification
  - vision
  - vit
metrics:
  - accuracy
  - f1
model-index:
  - name: animals-classifier
    results:
      - task:
          type: image-classification
        dataset:
          name: Bubunur/dog-cat-panda
          type: Bubunur/dog-cat-panda
          split: test
        metrics:
          - type: accuracy
            value: 0.9702
          - type: f1
            name: F1 (macro)
            value: 0.9702

Animals Classifier: Dog / Cat / Panda

A Vision Transformer fine-tuned to classify images into 3 classes: cat, dog, and panda (giant panda).

Base model: google/vit-base-patch16-224-in21k

Usage

from transformers import pipeline

clf = pipeline("image-classification", model="Bubunur/animals-classifier")
clf("photo.jpg")
# [{'label': 'cat', 'score': 0.93}, ...]

Results

Evaluated on the held-out test split (369 images, 123 per class):

Class Precision Recall F1
Cat 0.9667 0.9431 0.9547
Dog 0.9444 0.9675 0.9558
Panda 1.0000 1.0000 1.0000
Overall accuracy 0.9702

Confusion matrix (rows = true, columns = predicted):

Cat Dog Panda
Cat 116 7 0
Dog 4 119 0
Panda 0 0 123

Training data

Bubunur/dog-cat-panda: photos collected from iNaturalist (Creative Commons licenses only). The raw data contained many non-photo observations (skulls, bones, tracks, empty camera-trap frames), so the dataset was cleaned with zero-shot filtering by CLIP ViT-L/14 (confidence threshold 0.6) and balanced to 614 images per class.

Split: 1,252 train / 221 validation / 369 test.

Training procedure

  • Epochs: 8 (best checkpoint: epoch 6, selected by validation accuracy)
  • Learning rate: 5e-5, warmup ratio 0.06, weight decay 0.01
  • Batch size: 16
  • Label smoothing: 0.1
  • Mixed precision (fp16) on a single T4 GPU
  • Augmentations (train only): random resized crop (70–100%), horizontal flip, rotation (±15°), color jitter (brightness / contrast / saturation 0.3)

Limitations

  • Only 3 classes. Every input is assigned to cat, dog, or panda, even if it shows something else (e.g. a fox will be classified as a dog or a cat).
  • Confidence scores are capped at ~0.93 because of label smoothing (0.1). A score of 0.93 means maximum confidence, not uncertainty.
  • Cat/dog confusion remains on hard images: small or distant animals, partially hidden animals, fluffy small dog breeds.
  • The test set was filtered by CLIP, so it may be easier than real-world images, and the reported accuracy may be optimistic.

License

Released under CC BY-NC-SA 4.0 to match the license of the training data (which includes CC BY-NC and CC BY-SA images). Non-commercial use only.