File size: 2,095 Bytes
d2c2034 f852996 eade9a4 |
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 |
---
license: mit
language:
- en
metrics:
- accuracy
new_version: CernovaAI/CANetv1.2
pipeline_tag: image-classification
tags:
- medi
- code
base_model:
- CernovaAI/CANet-v1.1
- CernovaAI/CANet-v1
---
# 🖼️ Image Classifier with TensorFlow & Keras
This project demonstrates a **Convolutional Neural Network (CNN)** built with TensorFlow and Keras for **image classification**. The model is designed to learn from labeled datasets and classify unseen images with high accuracy.
## 🚀 Features
* **CNN-based architecture**: Efficient feature extraction using Conv2D and MaxPooling layers.
* **Flexible dataset handling**: Uses `ImageDataGenerator` with automatic train/validation split (90% training / 10% validation).
* **Easy deployment**: Trained model is saved in `.h5` format for reuse.
* **Prediction function**: Quickly classify a single image with visualization support.
* **Matplotlib integration**: Displays the predicted class directly on the image.
## 📂 Project Structure
```
project/
│── dataset/ # Training & validation images
│── image_classifier.h5 # Saved trained model
│── main.py # Model training & prediction script
│── README.md # Project documentation
```
## 🧠 Model Architecture
* **Conv2D (32 filters, 3x3)** → ReLU
* **MaxPooling2D (2x2)**
* **Conv2D (64 filters, 3x3)** → ReLU
* **MaxPooling2D (2x2)**
* **Conv2D (128 filters, 3x3)** → ReLU
* **MaxPooling2D (2x2)**
* **Flatten**
* **Dense (512 neurons, ReLU)**
* **Dense (number of classes, Softmax)**
## ⚡ Usage
### 1️⃣ Train the Model
```bash
python main.py
```
### 2️⃣ Run Predictions
```python
guess("test_image.jpg", model, train_generator.class_indices)
```
The predicted class will be displayed on the image itself.
## 🎯 Conclusion
This project provides a **versatile CNN-based image classifier** that can be applied to a wide range of domains—from **medical imaging to natural scene recognition**. By integrating your own dataset, you can easily adapt this model to your specific use case.
|