This repository contains a comprehensive traffic detection and optimization project for Berlin. It integrates traffic, weather, public transportation, and construction data to build predictive models and optimize routes.
-
Traffic Data:
- Source: Berlin Municipality Traffic Management Division.
- Access: Berlin's official website provides traffic flow and congestion data. The Traffic Detection Berlin API is also utilized.
- Dataset: Traffic Detection API
-
Weather Data:
- Sources:
- Open-Meteo: High-resolution free weather data.
- WeatherAPI.com: Real-time and historical weather data.
- OpenWeatherMap: Provides diverse weather APIs.
- Dataset: Open-Meteo JSON API.
- Sources:
-
Public Transport Data:
- Source: Berliner Verkehrsbetriebe (BVG).
- Access: Developer portal and Trafi platform for integrated public transportation schedules and routes.
- Dataset: BVG GTFS Data
-
Road and Construction Information:
- Source: Berlin Municipality's announcements on roadworks and construction projects.
- Access: Official website provides updates on roadworks and restrictions.
- Dataset: Roadwork Data API
To set up the environment, install the required Python libraries:
pip install -r requirements.txt
data_processing.py
: Functions to load, clean, and preprocess datasets.modeling.py
: Machine learning models for traffic prediction.visualization.py
: Visualization tools for spatial and temporal traffic patterns.
-
Predictive Modeling:
- Linear Regression
- Random Forest
- K-Means Clustering
- Gradient Boosting (XGBoost, CatBoost)
- Neural Networks
-
Route Optimization:
- Integrates OpenRouteService API for route calculations and optimizations.
- Visualizes road networks and routes using OSMnx.
-
Data Integration:
- Combines traffic, weather, construction, and public transportation data.
- Enhances features with additional metrics like holiday indicators and weekend information.
Using K-Means clustering to identify traffic patterns:
Berlin road network with optimized routes:
Performance comparison of models based on MSE and R² scores:
- Clone this repository:
git clone https://github.com/busrayatlav/traffic_detection.git
- Navigate to the project directory:
cd traffic_detection
- Install dependencies:
pip install -r requirements.txt
- Run the Streamlit app locally:
streamlit run app.py
This project is licensed under the MIT License.
Special thanks to the Berlin Municipality and data providers like Open-Meteo, BVG, and OpenRouteService for making this project possible.