Skip to content

A system and method for the prediction of vehicle traffic congestion on a given roadway within a region. In particular, the computer implemented method of the present disclosure utilize real time traffic images from traffic cameras for the input of data and utilizes computer processing and machine learning to model a predictive level of congesti…

License

taiwotman/Smart-Traffic

Repository files navigation

Predicting Short-Term Traffic Flow Congestion On Urban Motorway Networks

DESCRIPTION

A system and method for the prediction of vehicle traffic congestion on a given roadway within a region. In particular, the computer implemented method of the present disclosure utilize real time traffic images from traffic cameras for the input of data and utilizes computer processing and machine learning to model a predictive level of congestion within a category of low congestion, medium congestion, or high congestion. By implementing machine learning in the comparison of exemplary images and administrator review, the computer processing system and method steps can predict a more efficient real-time congestion over time.

Dependencies

Python Tensorflow Flask Urllib3 Numpy WTForms Werkzeug

REPOSITORY

RELEASE VERSION 1.1.0

  • Create Flask REST API using (real-time) traffic image data for prediction.

  • Implement search query based on region

  • Make Jinja template to display parameters on index.page

  • On Index page, display traffic images with URL and add dropdown selections with regions

  • Clean template

  • Add Prediction features

SET UP

LOCAL ENVIRONMENT

1. Clone git repository and cd into the directory

 git clone https://github.com/taiwotman/Smart-Traffic.git

2. Set up virtualenv with directory venv

 virtualenv venv

3. Activate venv using:

 source venv/bin/activate

4. Pip install requirements:

 pip install -r requirements.txt

5. Run command

 python run.py

Sample Test Case

6. To implement the following test, use the development branch.

7. Run the following python command with the traffic congestion image(supports only jpeg/jpg format) as argument. For example:

 python run.py test_image/Aut10_010.jpg

8. Sample output:

 high congestion (score = 0.70454)

AUTHORIZATION HEADER

In json_parser

headers= {
                "Authorization": "************",
                "Connection": "keep-alive" 
          }

DOCKER

docker build -t taiwotman/smart-traffic:latest .

docker run --rm -p 80:5000 taiwotman/smart-traffic:latest 

Open on browser

AWS EKS

kubectl apply -f aws_eks/deployment.yaml 

smart-traffic-service deployment.apps/smart-traffic created

http://localhost:8080/api/v1/namespaces/default/services/smart-traffic-service/proxy

Delete cluster

eksctl delete cluster --region=us-east-2 --name=smart-cluster

GCP

 gcloud app deploy

PS: deploy might take few minutes

Likely issues

  1. if error on starting, reinitialize project using:

    gcloud app init

  2. ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source

    Go to storage bucket and delete app storage. Then redeploy app.

  3. Latency - Takes an average of 1 min to return predictions on the local environment.

  4. No results return- Obtain authorization key

ACKNOWLEDGEMENTS

So much gratitude to New South Wales Transport Agency for the open live traffic data API and Google for the Tensorflow. Without opensource contributions this work would not have been derived.

WANT TO BE CONTRIBUTOR?

  1. Fork repository

    and/or

  2. Send a message.

FOR ACADEMIC PURPOSE; kindly, cite our related work:

T. Adetiloye, A. Awasthi (2019). Multimodal Big Data Fusion for Traffic Congestion Prediction. In: Seng K., Ang L., Liew AC., Gao J. (eds) Multimodal Analytics for Next-Generation Big Data Technologies and Applications(pg. 319-335). doi: https://doi.org/10.1007/978-3-319-97598-6_13. Springer, Cham.

T. Adetiloye, A. Awasthi (2018). Traffic Condition Monitoring Using Social Media Analytics. In: Roy, S., Samui, P., Deo, R., Ntalampiras, S. (eds) Big Data in Engineering Applications. Studies in Big Data, vol 44. Springer, Singapore. https://doi.org/10.1007/978-981-10-8476-8_13

T. Adetiloye, A. Awasthi(2017). Predicting Short-Term Congested Traffic Flow on Urban Motorway Networks. In P. Samui, S.S Roy, V.E. Balas(Eds.), Handbook of Neural Computation(pg. 145–165). doi: https://doi.org/10.1016/B978-0-12-811318-9.00008-9. Academic Press.

LICENSE

T. Adetiloye (2021). Predicting Short-Term Traffic Flow Congestion On Urban Motorway Networks (Patent No US11,195,412 B2). U.S. Patent and Trademark Office. https://rb.gy/yaonm9

About

A system and method for the prediction of vehicle traffic congestion on a given roadway within a region. In particular, the computer implemented method of the present disclosure utilize real time traffic images from traffic cameras for the input of data and utilizes computer processing and machine learning to model a predictive level of congesti…

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published