Machine Learning and AI Agent Implementation for Traffic Control Notes for Smart Intersection Project: Smart Traffic Intersection

Project Deliverables and Submission Status

  • Administrative Update:

    • Participants current for the session include Alhan, Harita, and Karan.

    • Participants unable to join the previous meeting or this session: Suhani, Noah, and Karin. Suhani mentioned watching the recording later due to travel.

  • Status of Assignments:

    • The group completed the eight issues related to the traffic intersection, the "Five Whys" root cause analysis, and proposed solutions for each.

    • Current Submission: The document was submitted under Karan's name because he created a copy of the template instead of editing the shared document.

    • Solution Architecture Diagram: This deliverable remains incomplete. The group is required to create a three-layer architecture diagram (Input, Logic, Output) for the final project.

  • Final Presentation Date:

    • The final presentation for the project is scheduled for August15August\,15.

Fundamental Principles of Machine Learning (ML)

  • Definition and Contrast with Traditional Programming:

    • Traditional Programming: Involves writing explicit logic using structures like "if," "do-loops," branching, and comparisons. Every step must be coded manually. The machine has no independent comprehension of the situation.

    • Machine Learning: Instead of writing instructions, the developer provides the source (input data) and the expected results (output). The computer builds the logic autonomously by identifying patterns. It creates its own mathematical calculations, inferences, and conditions.

  • Dataset Requirements:

    • ML requires a sufficiently large dataset to understand patterns effectively.

    • High diversity in the dataset improves the model; for example, taking photos of cars from different angles and in different environments.

    • Use Case: Machine Learning is essential when dealing with massive datasets where writing individual lines of code for every possible variable would be impossible.

  • Case Study: Agricultural Weather Prediction:

    • Problem: Farmers struggle with unpredictable weather when sowing or reaping seeds.

    • Solution: Feed ten, twenty, or thirty years of weather data into a model. The machine identifies patterns (e.g., "If rain occurred in this month during an El Ni\u00f1o year in the Atlantic, next month will follow this specific pattern").

    • Outcome: The machine builds a model to predict weather more accurately than traditional binary coding.

  • Large Language Models (LLMs):

    • Examples: ChatGPT, Copilot, Gemini, Groke.

    • Functionality: LLMs are a form of machine learning that predict the next word or sentence based on millions of articles and literature pieces they have processed.

Technical Solution for Smart Traffic Intersections

  • Project Simplification:

    • To maintain project focus, the group will model an intersection with single lanes moving each way (North, South, East, West).

    • Excluded features for the simulation: Dedicated left-hand turn lanes, pedestrian crossings, and specific turning arrows.

    • Lights: Regular green, yellow, and red cycles.

  • Hardware and Processing Flow:

    • Cameras will be mounted next to traffic lights facing each lane to capture live feeds.

    • Central Processor: Receives the feed and runs a Machine Learning model to analyze the count of vehicles.

    • AI Agent: Interprets the vehicle data and adjusts signal timing accordingly.

  • Guardrails and Confidence Levels:

    • Confidence Percentage: The ML model provides a percentage representing how sure it is of its classification.

    • Threshold: The project requires a confidence level of at least 80%80\% before the system makes a traffic light adjustment.

    • Failure Protocol: If the model has less than 80%80\% confidence for any of the four lanes, the system should recapture the image and try again rather than making an uninformed decision.

Google Teachable Machine Methodology

  • Platform Overview: Teachable Machine is a web-based tool by Google designed for training computers to recognize images, sounds, or poses without writing code.

  • Training Classification:

    • The model uses "Classes" to categorize data.

    • Primary Experiment Classes: "Cars" and "Empty Road."

    • Project-Specific Classes: "Small," "Medium," "Large," and "Extra Large" (T-Shirt Sizing).

  • T-Shirt Sizing Definitions:

    • Small (S): 00 to 22 vehicles (or an empty road).

    • Medium (M): Approximately 55 to 66 vehicles.

    • Large (L): Approximately 1010 to 1212 vehicles.

    • Extra Large (XL): More than 1212 vehicles (heavily backed up).

Traffic Signal Logic and AI Agent Creation

  • Signal Combinations:

    • There are six distinct states/combinations of lights possible in a single-lane four-way intersection if considering various turn/flow priorities.

    • Constant Rule: Opposing traffic (e.g., North and South) can often be green simultaneously if no dedicated left turns cause conflict.

  • Time Management Examples:

    • Traditional Timer: Often set to a static 30s30\,s.

    • Dynamic Logic: If Northbound is Small (S) and Southbound is Extra Large (XL), the system might shorten the S lane's green light to 15s15\,s or keep it red, while extending the XL lane's green light to 45s45\,s or 55s55\,s.

  • Creating an AI Agent:

    • The group must define rules to feed into an AI Agent.

    • Necessary Components for the Agent:

      • Scenario background: Description of the single-lane intersection.

      • Input data format: The Small/Medium/Large/XL output from the ML model.

      • Decision Rules: Explicit instructions on how to handle specific combinations of traffic volumes.

Solution Architecture Diagram Specifications

  • Structure: The diagram should use a three-layer layout (Input -> Logic -> Output).

  • Layer 1: Input

    • Visuals for four traffic cameras (Lane 1 through Lane 4).

    • Label: "Image Feed."

  • Layer 2: Logic

    • Component A: Teachable Machine Model (Function: Classification into T-shirt sizes).

    • Component B: AI Agent (Function: Decision-making and duration calculation).

  • Layer 3: Output

    • Visuals for traffic signal states for all four lanes.

    • Label: "Signal Output (Color and Duration)."

Questions & Discussion

  • Group Coordination: The students decided to work on the Teachable Machine model as a group because a larger combined dataset (more images) increases the AI's accuracy.

  • Physical Demo Setup:

    • Discussion on whether to use actual road photos or high-quality simulation.

    • Plan: Create a four-way intersection using chart paper and toy cars. Take photos of various car quantities from different angles to train the "Small" through "XL" classes. Stock images from the web will be used to supplement the toy car photos.

  • Tooling: Students will use Draw.io for the architecture diagram and Google Teachable Machine for the classification model.

  • Clarification on Diagram Details: The instructor advised that while the diagram shouldn't be cluttered, it needs to be robust enough that a stranger could understand the logic flow just by looking at it. Labels for camera direction (e.g., "Southbound facing") and signal targets (e.g., "Lane 1 traffic light") are encouraged.