The increasing popularity of cars not only brings great convenience to people, but also leads to congested traffic conditions and more frequent traffic accidents. Intelligent transportation technology has become an important force to promote the development of modern transportation technology. Intelligent transportation can not only provide real-time traffic condition information and help traffic managers plan management strategies, but also optimize travelers' travel strategies. It can also reduce the congestion of traffic roads, reduce the probability of traffic accidents and improve the safety factor of road operation.
The project is divided into two modules:
-
One is video-based vehicle tracking and traffic statistics, which is an in-depth learning project that can track the real-time vehicle traffic conditions on the road and record the number of traffic flows in different lanes frame by frame. The continuous frame path of each vehicle can be seen in the video. The project has strong expansibility and can be connected to the billing and settlement system, LED display system, voice broadcasting system Power supply lightning protection system, etc,
-
The other is the lane line detection project, which is the primary task of realizing automatic driving. It is widely used in automatic driving manufacturers. It can predict the safe driving area according to the input of on-board camera, remind drivers to drive safely and reduce traffic accidents.
The architecture of the project is as follows:
- User layer: send the video to the service layer through the camera or manual selection for processing. After processing, the rendered video can be output or the alarm device can be triggered
- Service layer: it mainly includes two modules,
- The first is vehicle tracking and counting. The module processes the input video, uses yoloV3 model for target detection, then uses SORT for target tracking, uses Kalman filter for target position prediction, compares the similarity of targets with Hungarian algorithm to complete vehicle target tracking, and uses the idea of virtual coil to count vehicle targets, And complete the judgment of lane congestion according to the count;
- The other is lane line detection. The module uses Zhang's correction method to correct the camera, uses the correction results to remove the distortion of the image, then uses the edge and color to extract the lane line, uses the affine transformation to convert it into an aerial view, uses the histogram and sliding window algorithm to accurately determine the lane line, and uses the least square method to fit to realize the lane line detection, Calculate the distance of the vehicle from the center of the lane and trigger the alarm device.
- Effect display:
2. Environmental installation
The toolkits used in this project include the following:
NumPy is a basic package for scientific computing using Python.
Numba is an open source JIT compiler that converts a subset of Python and NumPy code into fast machine code.
SciPy is open source software for mathematics, science and engineering. SciPy library relies on NumPy, which provides convenient and fast N-dimensional array operation.
h5py reads and writes HDF5 files from Python.
pandas is a powerful data structure for data analysis, time series and statistics.
OpenCV Python is a pre built OpenCV package for Python.
moviepy toolkit for video processing
Filterpy implements Kalman filter and particle filter
See the requirements file for the specific version.
Installation method:
# Create virtual environment conda create -n dlcv python # Activate virtual environment source activate dlcv # Activate virtual environment (window) activate dlcv # Install the corresponding kit pip install -r requirements.txt requirements.txt See the end of the article
summary
-
Intelligent transportation includes two modules: multi-target vehicle tracking, traffic statistics and lane line detection
-
The intelligent transportation project is divided into user layer and service layer. The user layer operates video or camera, and the service layer processes video to complete multi-target vehicle tracking, traffic flow statistics and lane line detection
requirements.txt:amqp==2.5.2 billiard==3.6.3.0 celery==4.4.2 certifi==2019.11.28 chardet==3.0.4 click==7.1.1 colorama==0.3.9 cycler==0.10.0 Cython==0.29.19 decorator==4.4.2 Django==2.2.10 django-redis==4.11.0 filterpy==1.4.5 fire==0.1.3 Flask==1.1.1 h5py==2.8.0 idna==2.8 imageio==2.8.0 imageio-ffmpeg==0.4.1 importlib-metadata==1.6.0 imutils==0.5.3 itsdangerous==1.1.0 Jinja2==2.11.1 Kalman==0.1.3 kiwisolver==1.1.0 kombu==4.6.8 llvmlite==0.31.0 MarkupSafe==1.1.1 matplotlib==2.2.3 moviepy==1.0.1 numba==0.39.0 numpy==1.15.4 opencv-python==3.4.3.18 pandas==0.23.4 Pillow==7.0.0 proglog==0.1.9 protobuf==3.11.3 pyparsing==2.4.6 python-dateutil==2.8.1 pytz==2019.3 redis==3.4.1 requests==2.21.0 scipy==1.1.0 six==1.14.0 sqlparse==0.3.1 tensorboardX==1.6 torch==0.4.1 torchvision==0.2.1 tqdm==4.29.1 urllib3==1.24.3 vine==1.3.0 Werkzeug==1.0.0 zipp==3.1.0