Upload 3 files
Browse files- .gitattributes +1 -0
- Cats_vs_Dogs.ipynb +0 -0
- Readme.md +70 -0
- cats_vs_dogs_model.keras +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
cats_vs_dogs_model.keras filter=lfs diff=lfs merge=lfs -text
|
Cats_vs_Dogs.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Readme.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- image-classification
|
| 4 |
+
- cats-vs-dogs
|
| 5 |
+
- tensorflow
|
| 6 |
+
- efficientnet
|
| 7 |
+
pipeline_tag: image-classification
|
| 8 |
+
library_name: tensorflow
|
| 9 |
+
datasets:
|
| 10 |
+
- cats_vs_dogs
|
| 11 |
+
license: mit # or whichever license you prefer
|
| 12 |
+
metrics:
|
| 13 |
+
- accuracy
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Cats vs Dogs β EfficientNetB0 Classifier
|
| 17 |
+
|
| 18 |
+
This repository contains a convolutional neural network model trained to classify images of cats and dogs.
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## β
Model Details
|
| 24 |
+
|
| 25 |
+
| Item | Description |
|
| 26 |
+
|------|-------------|
|
| 27 |
+
| **Base architecture** | EfficientNetB0 (pretrained, top layers removed) |
|
| 28 |
+
| **Input shape** | 224 Γ 224 Γ 3 (RGB image) |
|
| 29 |
+
| **Output** | Single sigmoid output β probability that the image is a βdogβ |
|
| 30 |
+
| **Training data** | cats_vs_dogs (split ~80% train / 20% validation) |
|
| 31 |
+
| **Preprocessing** | Resize β 224Γ224, Normalize pixels to [0,1], optional data-augmentation |
|
| 32 |
+
| **Loss / Optimizer** | `binary_crossentropy`, `Adam` |
|
| 33 |
+
| **Training strategy** | Feature-extraction (base frozen) β Optional fine-tuning (unfreeze part of base) |
|
| 34 |
+
| **Evaluation metric** | Accuracy (binary classification) |
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## π Performance (Your results β update after training)
|
| 39 |
+
|
| 40 |
+
| Metric | Value |
|
| 41 |
+
|-------|-------|
|
| 42 |
+
| Validation accuracy (after feature-extraction) | ~0.5098β¦ |
|
| 43 |
+
| Validation accuracy (after fine-tuning) | ~0.7052β¦ |
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
> β οΈ These metrics depend on training/validation split, augmentation, fine-tuning. Consider re-training or cross-validation for better estimates.
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
## π‘ Inference / Usage Example
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
import tensorflow as tf
|
| 54 |
+
import numpy as np
|
| 55 |
+
from tensorflow.keras.preprocessing import image
|
| 56 |
+
|
| 57 |
+
# Load model (assuming you saved as model.keras or .h5)
|
| 58 |
+
model = tf.keras.models.load_model("path/to/your_model.keras")
|
| 59 |
+
|
| 60 |
+
# Load and preprocess a new image
|
| 61 |
+
img = image.load_img("path/to/image.jpg", target_size=(224, 224))
|
| 62 |
+
img = image.img_to_array(img) / 255.0
|
| 63 |
+
img = np.expand_dims(img, axis=0)
|
| 64 |
+
|
| 65 |
+
# Predict
|
| 66 |
+
prob = model.predict(img)[0][0]
|
| 67 |
+
if prob >= 0.5:
|
| 68 |
+
print("Dog πΆ β confidence:", prob)
|
| 69 |
+
else:
|
| 70 |
+
print("Cat π± β confidence:", 1 - prob)
|
cats_vs_dogs_model.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1a47599c2585ae5d0bd75bc048bcf8db6f61ff1ff4e3c9623306103495021d1
|
| 3 |
+
size 47874364
|