Skip to content

meenakshiravisankar/pytorch_objectdetecttrack

 
 

Repository files navigation

TRAFFIC ANALYSIS WITH TRAFFIC CAMERA

  1. Vehicles count for each lane
  2. Pedestrians in either direction
  3. Video time of entry of road user

The given dataset has 4953 frames at ~10fps with (width,height) = (1280,720)

TODO

  • Extract images from video
  • Detect all types of vehicles in the video
  • Counting vehicles
  • Pedestrian detection
  • Track pedestrians over crossing and count them
  • Stabilize the count of vehicles
  • Add time information
  • Find direction of pedestrian crossing

USAGE

All the code has been developed and tested on Linux Ubuntu 16.04 with 410.104 Nvidia driver and Cuda version 10.0 on GeForce GTX 1050. Assuming the videos are taken from the same camera facing the same road, similar to the given video.

Major Dependencies

  1. Opencv (version>3)
  2. Keras
  3. Numpy
  4. PyTorch

Method

Track the traffic participants continuously through the frames for a stable count. DeepSort link has been used for tracking vehicles and pedestrians with Yolov3 framework for object detection. Since the focus is not on lane detection/classification, it is taken as given (i.e we have information about lanes and zebra crossing).

Vehicle is counted corresponding to the lane it is present in. The vehicle is tagged when observed for the first time in the frame and is continuously tracked to avoid duplicate count.

Pedestrian's crossing is taken as the direction that is opposite to where he/she was found in the frame for the first time.

Tesseract OCR has been used to get timestamp details from the video.

Run the following commands

git clone [email protected]:meenakshiravisankar/pytorch_objectdetecttrack.git
cd pytorch_objectdetecttrack
bash setup.sh
cd config
bash download_weights.sh

To run the script

python3 traffic_tracker.py --input <path-to-video> --output(optional) <path-to-video> --activity(optional) <directory-to-save-log>

Sample Output Video

Sample output for 1-minute part of the given video link

Directory Structure

Path Description
  pytorch_objectdetecttrack Main folder
├  subfolders & files Tracker files
  files Data folder
├  results Contains results
├  videos Contains input video
  ├  1569843500.mp4 Given video
  ├  raw60.mp4 1 min video

FAILURE CASES

  1. Pedestrian on the sidewalk but far interferes with the counting
  2. Bicycles and motorcycles - people get detected multiple times
  3. Whenever the tracking fails, counts are unstable

CREDITS

  1. Yolov3 - link
  2. Keras-yolo3 - link
  3. Pytorch tracking with yolo3 - link
  4. Tesseract OCR - link

About

Object detection in images, and tracking across video frames

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 88.7%
  • Python 11.2%
  • Shell 0.1%