This project implements a Support Vector Machine (SVM) model to classify images of cats and dogs. The model is trained on the Kaggle Dogs vs Cats dataset and deployed using Flask with a simple web interface.
Users can upload an image through the web application and receive a prediction indicating whether the image contains a cat or a dog.
- Image classification using Support Vector Machine (SVM)
- Image preprocessing with OpenCV
- Image resizing and normalization
- Flask web application
- Upload image and get instant prediction
- Uploaded image preview
- Image history storage
- Clean and responsive user interface
- Python
- OpenCV
- NumPy
- Scikit-learn
- Flask
- HTML
- CSS
task 3 C&D
│
├── history/
│ └── Uploaded Images
│
├── static/
│ └── style.css
│
├── templates/
│ └── index.html
│
├── cat_dog_svm.pkl
├── flask_app.py
├── train_model.py
└── README.md
Dataset used:
Kaggle Dogs vs Cats Dataset
https://www.kaggle.com/c/dogs-vs-cats
-
Load images using OpenCV
-
Resize images to 64 × 64 pixels
-
Flatten image into a feature vector
-
Normalize pixel values to range [0,1]
-
Assign labels:
- Cat → 0
- Dog → 1
- Algorithm: Support Vector Machine (SVM)
- Kernel: RBF
- Train-Test Split: 80% / 20%
- Dataset Size: 5000 Images
- Accuracy: 61.10%
pip install flask numpy opencv-python scikit-learn joblibpython flask_app.pyOpen:
http://127.0.0.1:5000
- Upload an image.
- Click Predict.
- View prediction result.
- Uploaded image is displayed on the page.
- Images are saved in the history folder.
- CNN-based image classification
- Higher accuracy using deep learning
- Drag-and-drop image upload
- Prediction confidence score
- Image gallery for upload history
- Deploy on Render or Railway
Shresh Rahangdale
Machine Learning & Python Enthusiast