A newer version of this model is available:
nipunsgeeth/Cats_vs_Dogs_cnn_v2
📄 README.md (Model Card) for your Cats‑vs‑Dogs model
# Cats vs Dogs: CNN / Transfer‑Learning Model
This repository contains a convolutional neural network model trained to classify images of cats and dogs. The model was built using TensorFlow / Keras, trained on the `cats_vs_dogs` dataset, and designed for binary image classification.
## ✅ Model Details
- **Model type:** CNN (Transfer learning + custom head)
- **Input shape:** 160 × 160 × 3 (RGB image)
- **Output:** Single sigmoid output — probability that the image is a *dog*.
- **Training data:** cats_vs_dogs (loaded via `tensorflow_datasets`)
- **Preprocessing:** Images resized to 160×160, pixel values normalized (0–1)
- **Training & validation split:** 80% train / 20% validation
- **Library:** TensorFlow / Keras
## 🎯 Intended use
Use this model to classify images into two categories: **cat** or **dog**. You can use it for:
- Quick inference on image files
- As a baseline or demo for image classification tasks
- Educational purposes — to understand how CNN + transfer learning works
## ⚠️ Limitations
- The model performs reasonably but is **not state-of-the-art**; it may misclassify images with unusual angles, background clutter, or partial visibility.
- Because the dataset used has limited diversity, the model might be biased toward “typical” cat/dog images (good lighting, clear view). Use caution if applying to real-world images.
- **Not recommended for critical use** (e.g., medical, legal, safety-critical systems) — this is an example model.
## 🧰 How to Use (Inference Example)
```python
import tensorflow as tf
import numpy as np
from tensorflow.keras.preprocessing import image
# Load model
model = tf.keras.models.load_model("path/to/downloaded_model/")
# Load and preprocess image
img = image.load_img("path/to/your_image.jpg", target_size=(160,160))
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 🐶 — probability:", prob)
else:
print("Cat 🐱 — probability:", 1-prob)
📦 Files
saved_model/or.keras/.h5— the trained model files- (Optional)
example_usage.py— a script to load the model and run predictions
📈 Training & Evaluation Summary
| Metric | Value |
|---|---|
| Validation Accuracy (after fine‑tuning) | ~ 0.5098 |
| Loss (binary cross‑entropy) | …0.6931 |
(If you trained longer / fine‑tuned — update these accordingly.)
👨💻 Contributing / Retraining
If you want to improve this model:
- Retrain or fine‑tune with more data or stronger augmentation
- Use larger / more powerful backbone (e.g. ResNet, EfficientNet)
- Evaluate on a wider test set for robustness
Feel free to fork the repository, retrain, and open a pull request.
- Downloads last month
- 9