A complete system for the analysis of Indian Traffic Patterns
- The code was tested on Ubuntu 18.04
- First it is suggested to have your nvidia-drivers to be installed properly
This can be checked by:
nvidia-smi
- Install cuda-10.0 and cudnn (latest for cuda-10.0)
nvcc -V
- Create a virtualenvironment using virtualenv and virtualenvwrapper
pip install virtualenv virtualenvwrapper mkvirtualenv all workon all
- Install opencv-3.4.4 (pyimagesearch website tutorial)
While compiling OpenCV use this command:
To test opencv for python :-
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 ..
# In python3 import cv2 cv2.__version__
- 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__
- Install pytorch (pip installation, cuda-10.0,10.1)
import torch import torchvision
- Install nvidia tensorrt 5.1.5. To check tensorrt installation
dpkg -l | grep nvinfer
- Install boost and all its dependencies
sudo apt-get install libboost-all-dev
- Create a build folder
mkdir build && cd build
- Compile and install
cmake .. make -j8 make install cd ..
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
NOT IMPLEMENTED YET
-
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
- Prajwal Rao - [email protected], [email protected]
- Sadgun Srinivas - [email protected], [email protected]
- Armaan Puri - [email protected]