Light Alert is a mobile application designed to assist drivers by detecting traffic lights and notifying them when the light turns green. The app utilizes a custom-trained Core ML model to analyze a live camera feed in real time, providing sound and haptic feedback to alert the user.
-
Real-Time Traffic Light Detection: Detects traffic lights directly from the live camera feed.
-
Green Light Notification: Alerts the user with sound and vibration when the light turns green.
-
Simple User Interface: Minimalistic design for safe and distraction-free use.
-
Welcome Screen with Instructions: Includes a guide to help users set up and use the app effectively.
- Swift:
- Used for the entire app development, including SwiftUI for the user interface and Combine for state management.
-
Core ML:
- Powers the machine learning model for traffic light detection.
-
Vision:
- Processes the camera feed and passes frames to the Core ML model for inference.
-
AVFoundation:
- Manages the live camera feed for real-time detection.
-
Core Haptics:
- Provides tactile feedback when the light turns green.
-
SwiftUI:
- Implements a modern, declarative UI for a clean and simple user experience.
- The app uses a custom-trained Core ML model created with Create ML:
- Trained on labeled images of traffic lights (red, yellow, green) and background scenes.
- Optimized for real-time performance and high accuracy.
- Combine:
- Manages app state and data flow between the ViewModel and Views.
-
Set Up:
- Mount your phone on your car's dashboard with a clear view of the road.
-
Detection:
- The app processes the live camera feed and identifies traffic lights in real time.
-
Notification:
- When the light turns green, the app provides:
- Sound Notification: A "ding" sound.
- Haptic Feedback: A vibration alert.
- When the light turns green, the app provides:
- Improved model accuracy with additional training data.
- Multi-language support.
- Advanced notifications for other traffic conditions.
TrafficLightDetector/
├── Models/
│ ├── TrafficLightClassifier.mlmodel # Custom Core ML model
├── ViewModels/
│ ├── CameraViewModel.swift # Manages camera and detection logic
├── Views/
│ ├── WelcomeView.swift # Welcome screen with instructions
│ ├── ContentView.swift # Live detection view
│ ├── CameraView.swift # Displays the live camera feed
├── Resources/
│ ├── AppIcon/ # App icon assets
│ ├── ding.mp3 # Notification sound
├── TrafficLightDetectorApp.swift # App entry point
├── README.md # Project description (you’re here!)
-
Clone the repository:
git clone https://github.com/theabecaster/LightAlert.git
-
Open the project in Xcode:
cd traffic-light-detector open TrafficLightDetector.xcodeproj -
Build and run the app on a physical iOS device.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Apple’s Core ML and Create ML for making machine learning integration seamless.
- Combine and SwiftUI for simplifying state management and UI development.
- The Xcode IDE for providing a streamlined development experience.