File size: 2,223 Bytes
03959ff f4ec8c6 03959ff f4ec8c6 03959ff f4ec8c6 03959ff f4ec8c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
---
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) |