Skip to content

XiwangLi/object-tracking-SORT-Pytorch

Repository files navigation

Object Tracking using SORT in Pytorch

Yolo for object detection in Videos

The basic logic for object detection in videos is:

  1. extract the frames from video using OpenCV:
cap = cv2.VideoCapture(videopath)
 _, frame = cap.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
  1. apply yolo detection on the extracted frame
pilimg = Image.fromarray(frame)
detections = detect_image(pilimg)
  1. apply Kalman filter for detection estimation
mot_tracker = Sort() 
tracked_objects = mot_tracker.update(detections.cpu())

Object tracking in Videos using SORT

SORT (Simple Online and Realtime Tracking) combines object detection and Kalman filter for object tracking. 

Run this code:

  1. install dependencies
pip install -r requirements.txt
  1. downoad yolo weights
wget https://pjreddie.com/media/files/yolov3.weights -O config/yolov3.weights
  1. upload a .mp4 video to ./videos and run object_tracking_Sort.ipynb

You can also ran object_tracking_Sort.py to save the video with annotations

Results

See the full video with annotations: Object tracking using SORT

References:

  1. YOLOv3: https://pjreddie.com/darknet/yolo/
  2. YOLO paper: https://pjreddie.com/media/files/papers/YOLOv3.pdf
  3. SORT paper: https://arxiv.org/pdf/1602.00763.pdf
  4. Alex Bewley's SORT implementation: https://github.com/abewley/sort

About

Object Tracking using SORT in Pytorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages