| --- |
| 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") |