/Traffic-Net

A dataset of traffic, fire and accident images for training deep learning models.

Primary LanguagePythonMIT LicenseMIT

Traffic-Net

Traffic-Net is a dataset containing images of dense traffic, sparse traffic, accidents and burning vehicles.


Traffic-Net is a dataset of traffic images, collected in order to ensure that machine learning systems can be trained to detect traffic conditions and provide real-time monitoring, analytics and alerts. This is part of DeepQuest AI's to train machine learning systems to perceive, understand and act accordingly in solving problems in any environment they are deployed.

This is the first release of the Traffic-Net dataset. It contains 4,400 images that span cover 4 classes. The classes included in this release are:

  • Accident
  • Dense Traffic
  • Fire
  • Sparse Traffic

There are 1,100 images for each category, with 900 images for trainings and 200 images for testing . We are working on adding more categories in the future and will continue to improve the dataset.



>>> DOWNLOAD, TRAINING AND PREDICTION:

The Traffic-Net dataset is provided for download in the release section of this repository. You can download the dataset via the link below.

https://github.com/OlafenwaMoses/Traffic-Net/releases/tag/1.0

We have also provided a python codebase to download the images, train ResNet50 on the images and perform prediction using a pretrained model (also using ResNet50) provided in the release section of this repository. The python codebase is contained in the traffic_net.py file and the model class labels for prediction is also provided the model_class.json. The pretrained ResNet50 model is available for download via the link below.

https://github.com/OlafenwaMoses/Traffic-Net/releases/download/1.0/trafficnet_resnet_model_ex-055_acc-0.913750.h5

This pre-trained model was trained for 60 epochs only, but it achieved over 91% accuracy on 800 test images. You can see the prediction results on new images that were not part of the dataset in the Prediction Results section below. More experiments will enhance the accuracy of the model.
Running the experiment or prediction requires that you have Tensorflow, and Keras, OpenCV and ImageAI installed. You can install this dependencies via the commands below.


- Tensorflow 1.4.0 (and later versions) Install or install via pip

 pip3 install --upgrade tensorflow 

- OpenCV Install or install via pip

 pip3 install opencv-python 

- Keras 2.x Install or install via pip

 pip3 install keras 

- ImageAI 2.0.3

pip3 install imageai 



>>> Video & Prediction Results

Click below to watch the video demonstration of the trained model at work.




Sparse_Traffic  :  99.98759031295776
Accident  :  0.006892996316310018
Dense_Traffic  :  0.0031178133212961257
Fire  :  0.0023975149815669283


Dense_Traffic  :  100.0
Accident  :  9.411973422857045e-07
Fire  :  2.656607822615342e-07
Sparse_Traffic  :  4.631924704900925e-09


Accident  :  99.94832277297974
Sparse_Traffic  :  0.04670554480981082
Fire  :  0.004610423275153153
Dense_Traffic  :  0.00035401615150476573


Fire  :  100.0
Accident  :  1.9869084979303675e-22
Dense_Traffic  :  3.262699368229192e-23
Sparse_Traffic  :  6.003136426033551e-28

References

  1. Kaiming H. et al, Deep Residual Learning for Image Recognition
    https://arxiv.org/abs/1512.03385