Muhammad Alwan commited on
Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- efficientnet
|
| 6 |
+
- cats
|
| 7 |
+
- dogs
|
| 8 |
+
- keras
|
| 9 |
+
- tensorflow
|
| 10 |
+
datasets:
|
| 11 |
+
- microsoft/cats_vs_dogs
|
| 12 |
+
metrics:
|
| 13 |
+
- accuracy
|
| 14 |
+
- auc
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# 🐱🐶 Cat vs. Dog Classifier (EfficientNet-B0, Keras/TensorFlow)
|
| 18 |
+
|
| 19 |
+
A lightweight CNN that predicts whether an image contains **a cat or a dog**.
|
| 20 |
+
The backbone is `EfficientNetB0` pre-trained on ImageNet and fine-tuned on the
|
| 21 |
+
[microsoft/cats_vs_dogs](https://huggingface.co/datasets/microsoft/cats_vs_dogs)
|
| 22 |
+
training split (23 410 images).
|
| 23 |
+
|
| 24 |
+
## Model Details
|
| 25 |
+
|
| 26 |
+
| | Value |
|
| 27 |
+
|-------------------------|-------|
|
| 28 |
+
| Backbone | EfficientNet-B0 (`include_top=False`) |
|
| 29 |
+
| Input size | `128×128×3` |
|
| 30 |
+
| Extra layers | GlobalAvgPool ➜ Dropout(0.2) ➜ Dense(1, **sigmoid**) |
|
| 31 |
+
| Precision | Mixed-precision (`float16` activations / `float32` dense) |
|
| 32 |
+
| Optimizer | **AdamW** with cosine-decay-restarts schedule |
|
| 33 |
+
| Loss | Binary Cross-Entropy |
|
| 34 |
+
| Epochs | 25 (frozen backbone) + 5 (fine-tune full network) |
|
| 35 |
+
| Batch size | 16 |
|
| 36 |
+
| Class weighting | Balanced weights computed from training labels |
|
| 37 |
+
|
| 38 |
+
### Validation Metrics
|
| 39 |
+
|
| 40 |
+
| Metric | Value |
|
| 41 |
+
|-------------|-------|
|
| 42 |
+
| Accuracy | **97.2 %** |
|
| 43 |
+
| AUC | **0.9967** |
|
| 44 |
+
| Loss (BCE) | 0.079 |
|
| 45 |
+
|
| 46 |
+
*(computed on 15 % stratified validation split – 3 512 images)*
|
| 47 |
+
|
| 48 |
+
## Intended Uses & Limitations
|
| 49 |
+
|
| 50 |
+
* **Intended** : quick demos, tutorials, educational purposes, CAPTCHA-like tasks.
|
| 51 |
+
* **Not intended** : production-grade pet breed classification, safety-critical
|
| 52 |
+
applications.
|
| 53 |
+
* The model only distinguishes **cats** vs **dogs**; images with neither are
|
| 54 |
+
undefined behaviour.
|
| 55 |
+
* Trained on 128×128 crops; very large images might require resizing first.
|
| 56 |
+
|
| 57 |
+
## Dataset Credits
|
| 58 |
+
|
| 59 |
+
The training data is the publicly available
|
| 60 |
+
[microsoft/cats_vs_dogs](https://huggingface.co/datasets/microsoft/cats_vs_dogs)
|
| 61 |
+
dataset (originally the Asirra CAPTCHA dataset). **Huge thanks** to Microsoft
|
| 62 |
+
Research and Petfinder.com for releasing the images!
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
@misc{microsoftcatsdogs,
|
| 66 |
+
title = {Cats vs. Dogs Image Dataset},
|
| 67 |
+
author = {Microsoft Research & Petfinder.com},
|
| 68 |
+
howpublished = {HuggingFace Hub},
|
| 69 |
+
url = {https://huggingface.co/datasets/microsoft/cats_vs_dogs}
|
| 70 |
+
}
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Acknowledgements
|
| 74 |
+
|
| 75 |
+
* TensorFlow/Keras team for the excellent deep-learning framework.
|
| 76 |
+
* Mingxing Tan & Quoc V. Le for EfficientNet.
|
| 77 |
+
* The Hugging Face community for the awesome Model & Dataset hubs.
|