Skip to content

Data-driven traffic detection and optimization project leveraging machine learning and real-time data integration to enhance urban mobility in Berlin.

License

Notifications You must be signed in to change notification settings

busrayatlav/traffic-detection-and-route-optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic Detection and Optimization Project

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.

Data Sources

  • 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:

  • 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

Code Overview

Installing Required Libraries

To set up the environment, install the required Python libraries:

pip install -r requirements.txt

Key Modules

  • 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.

Highlights

  • 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.

Visualization Examples

Traffic Clustering

Using K-Means clustering to identify traffic patterns:

Image Description

Road Network Visualization

Berlin road network with optimized routes:

Image Description

Model Comparison

Performance comparison of models based on MSE and R² scores:

Image 1 Image 2

How to Use

  1. Clone this repository:
git clone https://github.com/busrayatlav/traffic_detection.git
  1. Navigate to the project directory:
cd traffic_detection
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the Streamlit app locally:
streamlit run app.py

License

This project is licensed under the MIT License.

Acknowledgments

Special thanks to the Berlin Municipality and data providers like Open-Meteo, BVG, and OpenRouteService for making this project possible.

About

Data-driven traffic detection and optimization project leveraging machine learning and real-time data integration to enhance urban mobility in Berlin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published