A deep learning-based image classification project using Convolutional Neural Networks (CNN) and the CIFAR-10 dataset, featuring an intuitive Tkinter GUI for real-time image classification.
This project implements a CNN-based image classifier that can recognize and classify images into 10 different categories from the CIFAR-10 dataset. The application provides a user-friendly graphical interface for uploading images and receiving instant classification results.
- Deep Learning Model: Custom CNN architecture with multiple convolutional and dense layers
- CIFAR-10 Dataset: Trained on 60,000 images (50,000 training, 10,000 testing)
- Interactive GUI: Built with Tkinter for easy image upload and classification
- Real-time Classification: Instant prediction results displayed in the interface
- Model Persistence: Trained model saved as HDF5 file for reuse
- Data Preprocessing: Automatic image normalization and resizing
The model can classify images into the following 10 classes:
✈️ Aeroplane- 🚗 Automobile
- 🐦 Bird
- 🐱 Cat
- 🦌 Deer
- 🐕 Dog
- 🐸 Frog
- 🐴 Horse
- 🚢 Ship
- 🚚 Truck
The CNN model consists of:
-
Convolutional Layers:
- Conv2D (32 filters, 3x3 kernel) with ReLU activation
- Dropout (0.2)
- Conv2D (32 filters, 3x3 kernel) with ReLU activation
- MaxPooling2D (2x2 pool size)
-
Fully Connected Layers:
- Flatten layer
- Dense (64 neurons, ReLU)
- Dense (512 neurons, ReLU)
- Dropout (0.5)
- Dense (10 neurons, Softmax) - Output layer
-
Optimization:
- Optimizer: SGD (learning rate: 0.01, momentum: 0.9)
- Loss function: Categorical Crossentropy
- Metrics: Accuracy
- Training: 10 epochs with batch size of 32
tensorflow>=2.0.0
keras>=2.0.0
opencv-python
matplotlib
pillow
numpy
- Clone the repository:
git clone https://github.com/yourusername/Image-Classifier-with-Python.git
cd Image-Classifier-with-Python- Install required dependencies:
pip install tensorflow keras opencv-python matplotlib pillow numpyRun the main script to train the model:
python "Image Classifier Project.py"The script will:
- Load and preprocess the CIFAR-10 dataset
- Build the CNN model architecture
- Train the model for 10 epochs
- Display training accuracy
- Save the trained model as
model1_cifar_10epoch.h5 - Launch the GUI application
- Upload Image: Click the "Upload Image" button to select an image file
- Classify: Click the "Classify the Image" button to get the prediction
- View Results: The classification result will be displayed in the interface
- Data Information: Click "Get Data Information" for dataset details
Image-Classifier-with-Python/
│
├── Image Classifier Project.py # Main application file
├── README.md # Project documentation
└── model1_cifar_10epoch.h5 # Trained model (generated after training)
The model achieves competitive accuracy on the CIFAR-10 test dataset. The exact accuracy is displayed in the console after training completion.
- Input Shape: 32x32x3 (RGB images)
- Normalization: Pixel values scaled to [0, 1]
- Data Augmentation: None (can be added for improved performance)
- Kernel Constraint: MaxNorm(3) for regularization
- Dropout: Used to prevent overfitting
Enes Günümdoğdu