Skip to content

Building-A-Camera-Classifier-in-Python is a Python application that enables users to build a custom image classifier using their webcam and a Convolutional Neural Network (CNN). The project features a user-friendly interface built with Tkinter.

License

samithcsachi/Building-A-Camera-Classifier-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python version GitHub last commit GitHub repo size License Open Source Love svg1

Badge source

Building A Camera Classifier in Python

Building-A-Camera-Classifier-in-Python is a Python project designed to create a camera-based image classification application. The core functionality allows users to capture images via their webcam, label these images into custom classes (such as “Class 1” for a green marker or “Class 2” for a coffee mug), and then train a machine learning model to distinguish between these classes. After training, users can use the application to capture new images and classify them in real time based on the trained model. The project features a user-friendly interface built with Tkinter that guides users through the training and prediction workflow.

Authors

Table of Contents

Problem Statement

Build an interactive camera classifier application in Python that enables users to train a Convolutional Neural Network (CNN) model via a simple GUI. The app, built with Tkinter, allows users to specify objects to train, collects images directly from the webcam, organizes them, trains a CNN for image classification, and predicts objects in real time—including an auto-predict feature for live deployment.

Tech Stack

  • Python
  • TensorFlow/Keras (for CNN model)
  • OpenCV (camera and image handling)
  • Tkinter (GUI)
  • NumPy

Data Source

  • Images are user-generated via webcam in the application.
  • Classes are customizable by the user—anything that can be captured with your camera.

Limitations & What Can Be Improved

  • Image quality and classification accuracy depend on training samples.
  • No pre-built dataset: all data must be collected using the app.
  • Basic CNN architecture; could improve accuracy and generalization with transfer learning or data augmentation.
  • GUI is simple and might lack advanced controls (multi-class selection, preview, etc.).
  • Does not support mobile or web deployment natively—future work could add Streamlit or Flask interface.

Run Locally

# Clone the project
git clone https://github.com/samithcsachi/Building-A-Camera-Classifier-in-Python.git

# Change to the project directory
cd Building-A-Camera-Classifier-in-Python

# create a virtual environment
uv venv


# Activate the virtual environment
.venv\Scripts\activate

# Install requirements
uv add opencv-python Pillow scikit-learn tensorflow

# Run the app
python main.py

Usage Instructions

  • Start the application and use the Tkinter GUI to specify objects/classes to train.
  • For each class, use your webcam to capture images (the app will save them in organized folders).
  • After collecting sufficient samples, initiate training (CNN model will be trained with saved data).
  • Use the prediction function to classify new objects via the camera, or enable autopredict for continuous real-time prediction.

Explore the notebook

GitHub : https://github.com/samithcsachi/Building-A-Camera-Classifier-in-Python

Contribution

Pull requests are welcome! For major changes, please open an issue first to discuss your ideas.

License

MIT License
Copyright (c) 2025 Samith Chimminiyan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contact

If you have any questions, suggestions, or collaborations in data science, feel free to reach out:

About

Building-A-Camera-Classifier-in-Python is a Python application that enables users to build a custom image classifier using their webcam and a Convolutional Neural Network (CNN). The project features a user-friendly interface built with Tkinter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages