|
|
--- |
|
|
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. |
|
|
|
|
|
|
|
|
|