File size: 1,519 Bytes
5057d09
f94d02a
5057d09
f94d02a
 
 
 
 
 
 
 
 
5057d09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
license: mit
tags:
  - image-classification
  - tensorflow
  - CatsDogsClassification
  - image preprocessing
  - InceptionV3
inference: true
datasets:
  - AIOmarRehan/Cats_and_Dogs
---

# InceptionV3 Dogs vs Cats Classifier

This repository contains a **pre-trained TensorFlow/Keras model**:  

- **File:** `InceptionV3_Dogs_and_Cats_Classification.h5`  
- **Purpose:** Binary classification of cats vs dogs images  

---

## Model Details

- **Architecture:** Transfer Learning using **InceptionV3** (pre-trained on ImageNet)  
- **Custom Classification Head:**  
  - Global Average Pooling  
  - Dense layer (512 neurons, ReLU)  
  - Dropout (0.5)  
  - Dense layer with **Sigmoid** activation for binary classification  

- **Input:** Images resized to **256 × 256** pixels  
- **Output:** Probability of "Dog" class (values close to 1 indicate dog, close to 0 indicate cat)

---

## Performance

- **Test Accuracy:** ~99%  
- Confusion matrix and ROC curves indicate excellent classification performance  
- Achieves near-perfect AUC (~1.0) on the test set  

---

## Usage Example

```python
from tensorflow.keras.models import load_model
from PIL import Image
import numpy as np

# Load the model
model = load_model("InceptionV3_Dogs_and_Cats_Classification.h5")

# Preprocess an image
img = Image.open("cat_or_dog.jpg").resize((256, 256))
img_array = np.expand_dims(np.array(img)/255.0, axis=0)

# Predict
prediction = model.predict(img_array)
print("Dog" if prediction[0][0] > 0.5 else "Cat")