PreCrash-AI is an AI-powered automotive safety system designed to predict the risk of Vehicle-to-Vehicle (V2V) collisions using machine learning and visualize the predicted risk through an interactive real-time 3D traffic simulation.
The system analyzes vehicle movement and environmental conditions such as speed, relative speed, distance, lane position, weather, and braking events to estimate collision risk and provide proactive safety alerts.
The objective of PreCrash-AI is to explore how Artificial Intelligence and Vehicle-to-Vehicle communication data can be used to identify potentially dangerous driving situations before a collision occurs.
By combining machine learning-based collision-risk prediction with real-time traffic simulation and visualization, the system demonstrates how intelligent transportation systems can provide proactive warnings and contribute to safer road environments.
- AI-based V2V collision risk prediction
- Random Forest Regression model
- Real-time 3D traffic simulation
- Multiple simulated vehicles across multiple lanes
- Live collision-risk monitoring
- Proactive high-risk collision alerts
- Vehicle-to-Vehicle data simulation
- Dynamic vehicle speed controls
- Weather simulation including Clear, Rain, and Fog
- Real-time V2V communication logs
- Collision-risk timeline visualization
- AI feature importance visualization
- Interactive traffic environment
- Multiple camera modes including Top, POV, and Chase views
- Backend API for real-time collision prediction
PreCrash-AI uses a Random Forest Regressor to estimate collision risk based on vehicle and environmental parameters.
Random Forest combines multiple decision trees and produces a more stable prediction by aggregating their outputs.
The model considers factors such as:
- Ego vehicle speed
- Other vehicle speed
- Distance between vehicles
- Relative speed
- Lane difference
- Weather condition
- Brake events
The model generates a collision-risk score ranging from:
0.0 โ Low Collision Risk
1.0 โ High Collision Risk
The predicted score is used by the application to display real-time risk levels and generate warnings when potentially dangerous situations are detected.
Vehicle Simulation
โ
V2V Data Generation
โ
Feature Extraction
โ
Machine Learning Model
(Random Forest Regressor)
โ
Collision Risk Prediction
โ
Risk Analysis & Alerts
โ
Real-Time Dashboard
โ
3D Traffic Visualization
- Vehicles are simulated in the 3D traffic environment.
- Vehicle parameters such as speed, position, distance, and braking behaviour are collected.
- V2V data is generated between nearby vehicles.
- Relevant features are sent to the Flask backend.
- The trained Random Forest model processes the input features.
- The model predicts the collision-risk score.
- Risk values are sent back to the frontend.
- The dashboard displays the prediction in real time.
- High-risk situations trigger proactive safety alerts.
- Python
- Scikit-learn
- Pandas
- NumPy
- Random Forest Regression
- Flask
- Flask-CORS
- Python
- HTML
- CSS
- JavaScript
- Three.js
- Chart.js
- Three.js for interactive 3D traffic simulation
- Chart.js for real-time analytics and risk visualization
- Git
- GitHub
PreCrash-AI/
โ
โโโ backend/
โ โโโ app.py
โ โโโ train_model.py
โ โโโ model.pkl
โ โโโ requirements.txt
โ โโโ v2v_collision_probability_dataset.csv
โ
โโโ frontend/
โ โโโ index.html
โ โโโ style.css
โ โโโ script.js
โ
โโโ .gitignore
โ
โโโ README.md
Open a terminal and run:
git clone https://github.com/thanvitha-ippagunta/PreCrash-AI.gitMove into the project directory:
cd PreCrash-AIcd backendpip install -r requirements.txtIf the trained model is not already available, run:
python train_model.pyThis trains the Random Forest collision-risk prediction model.
Run:
python app.pyThe Flask backend will start locally.
Open the frontend application in your browser.
The backend will typically run at:
http://127.0.0.1:5000
The Flask backend handles communication between the 3D traffic simulation and the machine learning model.
| Function | Description |
|---|---|
| Collision Prediction | Predicts collision risk using vehicle data |
| Prediction History | Stores and retrieves recent predictions |
| Feature Importance | Displays the influence of model features |
| System Status | Checks whether the AI prediction engine is running |
| Simulation Reset | Clears prediction and simulation history |
The application continuously evaluates the relationship between vehicles.
Important factors affecting collision risk include:
Vehicles travelling very close to each other generally have a higher collision risk.
A large difference in speed between two vehicles can increase the probability of a collision.
Vehicles occupying the same or nearby lanes may have greater interaction risk.
Sudden braking can significantly increase the risk for vehicles travelling behind.
Rain and fog can influence safe driving conditions and therefore affect estimated collision risk.
PreCrash-AI supports multiple environmental conditions:
- โ๏ธ Clear
- ๐ง๏ธ Rain
- ๐ซ๏ธ Fog
These conditions allow the collision prediction system to be evaluated under different simulated driving environments.
Vehicle-to-Vehicle communication allows vehicles to exchange information such as:
- Speed
- Position
- Distance
- Relative movement
- Braking behaviour
- Driving conditions
PreCrash-AI simulates this information exchange and uses the generated data as input to the machine learning prediction system.
The application provides visual analytics to help understand the AI system's predictions.
These include:
- Current collision-risk score
- Collision-risk timeline
- Vehicle interaction information
- AI prediction status
- V2V communication logs
- Feature importance
- High-risk alerts
Random Forest was selected because it:
- Handles nonlinear relationships effectively
- Works well with multiple input features
- Is resistant to overfitting compared with a single decision tree
- Provides feature importance information
- Can produce fast predictions suitable for interactive simulations
- Works effectively with structured vehicle telemetry data
Future versions of PreCrash-AI can include:
- Integration with real V2V communication hardware
- Real-world vehicle telemetry
- GPS-based vehicle tracking
- Road-condition information
- Real-time map integration
- Driver behaviour analysis
- Pedestrian collision-risk prediction
- Cyclist collision-risk prediction
- Deep learning-based prediction models
- Edge AI deployment for low-latency predictions
- Integration with Advanced Driver Assistance Systems (ADAS)
- Real vehicle sensor integration
- Larger and more realistic traffic environments
Potential applications of the project include:
- Intelligent Transportation Systems
- Advanced Driver Assistance Systems
- Connected Vehicles
- V2V Safety Systems
- Smart Mobility
- Autonomous Vehicle Research
- Collision Avoidance Research
- Automotive AI
- Traffic Safety Simulation
PreCrash-AI is developed for educational, research, and simulation purposes.
The current system is a prototype and should not be directly deployed in safety-critical production vehicles without extensive real-world testing, validation, automotive-grade hardware integration, and appropriate safety certification.
Thanvitha Ippagunta
GitHub: thanvitha-ippagunta
If you find this project useful or interesting, consider giving the repository a โญ on GitHub.