A complete Machine Learning course project that classifies images from the CIFAR-10 dataset into 10 categories using three easy-to-explain algorithms:
- Logistic Regression
- Random Forest
- Support Vector Machine (SVM)
The project includes:
- ✅ Full ML pipeline (preprocessing, PCA, training, evaluation)
- ✅ Model comparison with charts and analysis
- ✅ Flask web app with upload & classify functionality
- ✅ Streamlit deployment file
- ✅ Source code ready for VS Code / Google Colab
image-classification-project/
├── app.py # Flask web application
├── train_models.py # ML training pipeline
├── streamlit_app.py # Streamlit deployment file
├── requirements.txt # Python dependencies
├── models/ # Saved trained models
├── static/
│ ├── charts/ # Accuracy & confusion matrix charts
│ ├── css/style.css # Website styling
│ ├── js/main.js # Frontend JavaScript
│ └── uploads/ # Uploaded images
├── templates/ # HTML pages
└── README.md # This file
Download and install Python 3.10 or higher from python.org.
- Open VS Code.
- Go to
File → Open Folderand selectimage-classification-project.
Open terminal in VS Code (Ctrl + `) and run:
pip install -r requirements.txtRun the training script:
python train_models.pyThis will:
- Download CIFAR-10 dataset
- Preprocess the images
- Train 3 models
- Save models in
/models - Generate charts in
/static/charts
python app.pyOpen your browser and go to:
http://127.0.0.1:5000
You can now upload an image and get predictions!
- Go to colab.research.google.com
- Upload all project files
- Install dependencies:
!pip install -r requirements.txt- Train models:
!python train_models.py- Run Flask (use a tunnel like
ngrokor run Streamlit instead):
!python app.pyRecommended for Colab: Use streamlit_app.py (see below).
- Create a GitHub repository.
- Upload all project files.
- Make sure
streamlit_app.pyis in the root of the repository.
Visit https://streamlit.io/cloud and sign in with GitHub.
- Click "New app".
- Select your GitHub repository.
- Set Main file path to:
streamlit_app.py - Click Deploy.
After deployment, your website will be live at:
https://yourname-cifar10-classifier.streamlit.app/
You can change yourname-cifar10-classifier to whatever you want.
⚠️ Important: Streamlit Cloud free tier has limited memory. The first time you open the app, it may need to download CIFAR-10 and load models, which can take 1-2 minutes.
Think of it as drawing a straight line (or plane) that separates different image classes. It predicts the probability that an image belongs to each class.
It creates many small "decision trees" and combines their answers. Each tree asks simple yes/no questions about pixel values, and the forest votes on the final class.
SVM finds the best boundary (margin) that separates classes. It tries to keep the gap between classes as wide as possible, which helps it generalize better.
| Model | Accuracy | Precision | Recall | F1-Score |
|---|---|---|---|---|
| Logistic Regression | 39.33% | 38.86% | 39.33% | 38.95% |
| Random Forest | 38.63% | 38.03% | 38.63% | 37.88% |
| Support Vector Machine | 48.90% | 48.72% | 48.90% | 48.62% |
Conclusion: SVM performed best among the three traditional ML models.
You can include:
- Problem: Classify 32×32 RGB images into 10 classes.
- Dataset: CIFAR-10 (60,000 images).
- Preprocessing: Normalization, standardization, PCA.
- Models: Logistic Regression, Random Forest, SVM.
- Evaluation: Accuracy, Precision, Recall, F1-Score, Confusion Matrix.
- Best Model: SVM with ~49% accuracy.
If you get any errors:
- Make sure all files are in the same folder.
- Run
pip install -r requirements.txtagain. - Check that
train_models.pycreated the/modelsfolder. - For Streamlit Cloud, check the app logs for missing files.
Made with ❤️ for Machine Learning Course Project 2025.