Skip to content

Visual Traffic Surveillance and Analytics System

Notifications You must be signed in to change notification settings

prajwaljpj/VisTraSAS

Repository files navigation

Visual Traffic Surveillance and Analytics System

Introduction

A complete system for the analysis of Indian Traffic Patterns

Provides a novel approach to acquiring traffic counts and link speeds

Prerequisite Installation

  1. The code was tested on Ubuntu 18.04
  2. First it is suggested to have your nvidia-drivers to be installed properly This can be checked by:
    nvidia-smi
  3. Install cuda-10.0 and cudnn (latest for cuda-10.0)
    nvcc -V
  4. Create a virtualenvironment using virtualenv and virtualenvwrapper
    pip install virtualenv virtualenvwrapper
    mkvirtualenv all
    workon all
  5. Install opencv-3.4.4 (pyimagesearch website tutorial) While compiling OpenCV use this command:
    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_LIBV4L=OFF \
    -D WITH_FFMPEG=ON \
    -D WITH_CUDA=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D BUILD_EXAMPLES=ON ..
    To test opencv for python :-
    # In python3
    import cv2
    cv2.__version__
  6. Install tensorflow-gpu==1.14.0 Does not work with tensorflow-gpu==1.15.0 (You might Engine load failure even though engine is generated correctly)
    import tensorflow as tf
    tf.__version__
  7. Install pytorch (pip installation, cuda-10.0,10.1)
    import torch
    import torchvision
  8. Install nvidia tensorrt 5.1.5. To check tensorrt installation
    dpkg -l | grep nvinfer
  9. Install boost and all its dependencies
    sudo apt-get install libboost-all-dev

Installation

  1. Create a build folder
    mkdir build && cd build
  2. Compile and install
    cmake ..
    make -j8
    make install
    cd ..

Creating model

Run the following command after setting up: shell ./install/createEngine --caffemodel=./models/yolov3_traffic_final.caffemodel --prototxt=./models/yolov3_traffic_final.prototxt --input=./test/test.jpg --W=416 --H=416 --class=9

if you want batching, then run shell ./install/createEngine --caffemodel=./models/yolov3_traffic_final.caffemodel --prototxt=./models/yolov3_traffic_final.prototxt --input=./test/test.jpg --W=416 --H=416 --class=9 --batchsize=2

This will create an engine file namely yolov3_fp32.engine.

Move this engine file into the models folder

Adjust Config

NOT IMPLEMENTED YET

Run

  • For RTMP streams run main.sh

     ./main.sh --engine=./models/yolov3_fp32.engine --pipe-path=/tmp/fifopipe1
     --segment-path=./segments/test_cam/
     --line-coord=./configs/line_coord/test_cam.json
     --intrinsics=./configs/cam_intrinsic/test_cam.json
     --qlength_conf=./configs/qlen_conf/coord.json
     --rtsp_strm=rtmp://aaa.bbb.cc.ddd/0
  • For RTSP streams run main.sh

     ./main.sh --engine=./models/yolov3_fp32.engine --pipe-path=/tmp/fifopipe1
     --segment-path=./segments/test_cam/
     --line-coord=./configs/line_coord/test_cam.json
     --intrinsics=./configs/cam_intrinsic/test_cam.json
     --qlength_conf=./configs/qlen_conf/coord.json
     --rtsp_strm=rtsp://aaa.bbb.cc.ddd/0

Results

Soon to be out

Authors/Maintainers