Cats_vs_Dogs_v2 / README.md
nipunsgeeth's picture
Update README.md
f4ec8c6 verified
---
tags:
- image-classification
- cats-vs-dogs
- tensorflow
- efficientnet
pipeline_tag: image-classification
library_name: tensorflow
datasets:
- cats_vs_dogs
license: mit
metrics:
- accuracy
base_model:
- Swardhunter/Efficentnetb07
---
# Cats vs Dogs β€” EfficientNetB0 Classifier
This repository contains a convolutional neural network model trained to classify images of cats and dogs.
The model uses **EfficientNetB0 (pretrained on ImageNet)** as a base + custom classification head, and was trained on the `cats_vs_dogs` dataset via TensorFlow Datasets.
---
## βœ… Model Details
| Item | Description |
|------|-------------|
| **Base architecture** | EfficientNetB0 (pretrained, top layers removed) |
| **Input shape** | 224 Γ— 224 Γ— 3 (RGB image) |
| **Output** | Single sigmoid output β€” probability that the image is a β€œdog” |
| **Training data** | cats_vs_dogs (split ~80% train / 20% validation) |
| **Preprocessing** | Resize β†’ 224Γ—224, Normalize pixels to [0,1], optional data-augmentation |
| **Loss / Optimizer** | `binary_crossentropy`, `Adam` |
| **Training strategy** | Feature-extraction (base frozen) β†’ Optional fine-tuning (unfreeze part of base) |
| **Evaluation metric** | Accuracy (binary classification) |
---
## πŸ“ˆ Performance (Your results β€” update after training)
| Metric | Value |
|-------|-------|
| Validation accuracy (after feature-extraction) | ~0.5098… |
| Validation accuracy (after fine-tuning) | ~0.7052… |
> ⚠️ These metrics depend on training/validation split, augmentation, fine-tuning. Consider re-training or cross-validation for better estimates.
---
## πŸ’‘ Inference / Usage Example
```python
import tensorflow as tf
import numpy as np
from tensorflow.keras.preprocessing import image
# Load model (assuming you saved as model.keras or .h5)
model = tf.keras.models.load_model("path/to/your_model.keras")
# Load and preprocess a new image
img = image.load_img("path/to/image.jpg", target_size=(224, 224))
img = image.img_to_array(img) / 255.0
img = np.expand_dims(img, axis=0)
# Predict
prob = model.predict(img)[0][0]
if prob >= 0.5:
print("Dog 🐢 β€” confidence:", prob)
else:
print("Cat 🐱 β€” confidence:", 1 - prob)