Skip to content

A machine learning project for traffic light state classification using OpenCV and Python.

License

Notifications You must be signed in to change notification settings

TanishqP07/Traffic-Light-Classifier-using-CV

Repository files navigation

🚦 Traffic Light Classifier

A machine learning project designed to classify traffic lights into Red, Yellow, or Green categories using computer vision techniques. This project processes traffic light images, extracts relevant features, and classifies the state of the light for applications in autonomous driving.


🌟 Features

  • Traffic Light Classification: Classifies traffic light states as red, yellow, or green.
  • Dataset Handling: Utilizes traffic light image datasets for training and testing.
  • Error Prevention: Ensures no red light is classified as green.
  • Extensible: Modular code that supports future enhancements.

🛠️ Technologies Used

  • Programming Language: Python 3.7+
  • Libraries:

📦 Installation

Prerequisites

  • Python 3.7 or later.
  • Traffic light image dataset.

Steps

  • Clone the repository:
    git clone https://github.com/TanishqP07/Traffic-Light-Classifier-using-CV.git
    cd Traffic-Light-Classifier-using-CV
    
  • Install dependencies:
    pip install -r requirements.txt
    

📋 Usage

Run the Notebook:

  • Open Traffic_Light_Classifier.ipynb in Jupyter Notebook.
  • Execute the cells step-by-step to:
    • Load data.
    • Preprocess images.
    • Extract features.
    • Classify traffic lights.

Validate Functions:

  • Use test_functions.py to validate critical functions like one_hot_encode.

Dataset:

  • Place your dataset in the traffic_light_images directory.
  • Ensure the structure includes subdirectories for:
    • red
    • yellow
    • green

🚀 Future Enhancements

  • Improve classification accuracy with larger datasets and advanced techniques.
  • Implement object detection to handle multiple traffic lights in an image.
  • Add real-time video classification using live webcam input.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


📫 Contact

For any questions or collaboration, feel free to reach out:


📂 Dataset Information

The dataset used in this project consists of traffic light images categorized into:

  • Red Traffic Lights
  • Yellow Traffic Lights
  • Green Traffic Lights

The dataset used for this project is included in the repository under the traffic_light_images folder.


🧪 Tests

The test_functions.py file contains unit tests to ensure the accuracy of critical components. To run the tests:

  1. Open the file in a Python environment.
  2. Execute the functions using:
    python test_functions.py
    
    

About

A machine learning project for traffic light state classification using OpenCV and Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published