File size: 2,987 Bytes
df5164e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
---
title: AI Pet Classifier
emoji: 🐢
colorFrom: blue
colorTo: indigo
sdk: streamlit
sdk_version: "1.46.1"
app_file: app.py
pinned: false
license: mit
---

# 🐢 AI Pet Classifier using CNN

A deep learning application that classifies images of cats and dogs using a Convolutional Neural Network (CNN) built with TensorFlow and Keras.

...

# 🐢🐱 AI Pet Classifier using Convolutional Neural Networks (CNN)

## Overview

AI Pet Classifier is a deep learning project that classifies images as either **Cat** or **Dog** using a Convolutional Neural Network (CNN) built with TensorFlow and Keras. The model is trained on thousands of labeled pet images and predicts the class of unseen images with high accuracy.

---

## Features

- Binary Image Classification
- TensorFlow & Keras Implementation
- Data Augmentation
- Batch Normalization
- Image Preprocessing
- Model Saving & Loading
- Single Image Prediction
- Beginner-Friendly Notebook
- Google Colab Compatible

---

## Project Pipeline

```
Dataset
   β”‚
   β–Ό
Image Preprocessing
   β”‚
   β–Ό
Data Augmentation
   β”‚
   β–Ό
CNN Model
   β”‚
   β–Ό
Training
   β”‚
   β–Ό
Evaluation
   β”‚
   β–Ό
Prediction
```

---

## CNN Architecture

```
Input Layer (64Γ—64Γ—3)

↓

Conv2D (32 Filters)
↓

Batch Normalization
↓

MaxPooling

↓

Conv2D (64 Filters)
↓

MaxPooling

↓

Conv2D (128 Filters)
↓

MaxPooling

↓

Flatten

↓

Dense (128)

↓

Dense (1, Sigmoid)

↓

Prediction
```

---

## Technologies Used

- Python
- TensorFlow
- Keras
- NumPy
- Matplotlib
- Pillow
- Google Colab

---

## Dataset Structure

```
Data/

β”œβ”€β”€ training_set/
β”‚   β”œβ”€β”€ cats/
β”‚   └── dogs/
β”‚
└── test_set/
    β”œβ”€β”€ cats/
    └── dogs/
```

---

## Hyperparameters

| Parameter | Value |
|------------|-------|
| Image Size | 64 Γ— 64 |
| Batch Size | 32 |
| Epochs | 25 |
| Optimizer | Adam |
| Loss Function | Binary Crossentropy |
| Activation | ReLU |
| Output Activation | Sigmoid |

---

## Training

The model uses image augmentation to improve generalization by applying:

- Rescaling
- Random Zoom
- Shear Transformation
- Horizontal Flip

---

## Prediction

The trained model predicts whether the uploaded image belongs to:

- 🐱 Cat
- 🐢 Dog

along with the prediction confidence.

---

## Future Improvements

- Early Stopping
- Model Checkpoint
- Transfer Learning (MobileNetV2 / EfficientNet)
- Confusion Matrix
- Classification Report
- Accuracy & Loss Curves
- Grad-CAM Visualization
- Streamlit & Hugging Face Deployment

---

## Repository Structure

```
β”œβ”€β”€ CNN_Model.ipynb
β”œβ”€β”€ cnn_model.keras
β”œβ”€β”€ Data.zip
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── LICENSE
```

---

## Author

**Sudheer Muthyala**

B.Tech (ECE)

Aspiring AI & Data Science Engineer

GitHub: https://github.com/M-Sudheer18

---

## License

This project is licensed under the MIT License.

---

⭐ If you found this project helpful, consider giving it a star.