Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# InceptionV3 Dogs vs Cats Classifier
|
| 6 |
+
|
| 7 |
+
This repository contains a **pre-trained TensorFlow/Keras model**:
|
| 8 |
+
|
| 9 |
+
- **File:** `InceptionV3_Dogs_and_Cats_Classification.h5`
|
| 10 |
+
- **Purpose:** Binary classification of cats vs dogs images
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## Model Details
|
| 15 |
+
|
| 16 |
+
- **Architecture:** Transfer Learning using **InceptionV3** (pre-trained on ImageNet)
|
| 17 |
+
- **Custom Classification Head:**
|
| 18 |
+
- Global Average Pooling
|
| 19 |
+
- Dense layer (512 neurons, ReLU)
|
| 20 |
+
- Dropout (0.5)
|
| 21 |
+
- Dense layer with **Sigmoid** activation for binary classification
|
| 22 |
+
|
| 23 |
+
- **Input:** Images resized to **256 × 256** pixels
|
| 24 |
+
- **Output:** Probability of "Dog" class (values close to 1 indicate dog, close to 0 indicate cat)
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
## Performance
|
| 29 |
+
|
| 30 |
+
- **Test Accuracy:** ~99%
|
| 31 |
+
- Confusion matrix and ROC curves indicate excellent classification performance
|
| 32 |
+
- Achieves near-perfect AUC (~1.0) on the test set
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Usage Example
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from tensorflow.keras.models import load_model
|
| 40 |
+
from PIL import Image
|
| 41 |
+
import numpy as np
|
| 42 |
+
|
| 43 |
+
# Load the model
|
| 44 |
+
model = load_model("InceptionV3_Dogs_and_Cats_Classification.h5")
|
| 45 |
+
|
| 46 |
+
# Preprocess an image
|
| 47 |
+
img = Image.open("cat_or_dog.jpg").resize((256, 256))
|
| 48 |
+
img_array = np.expand_dims(np.array(img)/255.0, axis=0)
|
| 49 |
+
|
| 50 |
+
# Predict
|
| 51 |
+
prediction = model.predict(img_array)
|
| 52 |
+
print("Dog" if prediction[0][0] > 0.5 else "Cat")
|