| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repository contains an implementation of a multithreaded application for detecting objects and tracking objects in a user-specified video. Example output of running the application on the input video (videos/input_video.mp4) is the resulting video (videos/project_track_and_detect.avi).
The whole detection and tracking application runs on four asynchronous tasks. First task start reading frames using Frame Grabber object (frame_grabber.h) and pushes them them into a message queue (message_queue.h) which is thread safe implementation using conditional variables. The second tasks detects the frames by pulling the frames from message queue as they become available using Object Detector (object_detector.h). The class (object_detector.h) is a abtract class. After detection of each frame, the detector puts detected frame along with the required input data for tracking into another queue having a special message is type of tracking messages (tracking_msg.h). This two tasks run in parallel. Once they are completed another task is started, which pulls the tracking messages from another queue and does the tracking using Object Tracker (object_tracker.h). The Object Tracker uses the Tracker (tracker.h) which provides functionality to update the tracks. The tracks are implements as abstract class (track.h). Each frame after tracking is put in the output queue. After the completion of tracking task, the final task is started using Frame Writer object (frame_writer.h) which pulls the messages from the output queue and writes them to the user-specified output video file.
This project provides the abstact implementation of object detector, hence any custom object detector can be added. Currently, YOLO3-Object-Detector is implemented(yolo_object_detector.h).
This object detector is trained on coco dataset and can recognize upto 80 different classes of objects in the moving frame.
The project provides abstract implementation of the tracker in form of tracks, hence any custom object tracker can be added. Currently, kalman tracker (kalman_track.h) is implemented using Kalman-Filter (kalman_filter.h). An assignment problem is used to associate the objects detected by detectors and tracked by trackers. Here it is solved using Hungarian Algorithm.
Tracking consist of two major steps:
Clone this repo.
Run the following commands to download object detection models from Darknet
cd CppND-Capstone mkdir model && cd model wget https://pjreddie.com/media/files/yolov3.weights wget https://github.com/pjreddie/darknet/blob/master/cfg/yolov3.cfg?raw=true -O ./yolov3.cfg
Make a build directory in the top level directory: mkdir build && cd build
Compile: cmake .. && make
Run it: ./detect_and_track (Runtime can vary depending on the number of frames in the video)
Progress can tracked while the program is running
Model Loaded Successfully! Loaded 80 Class Names Initialised the tracker Read 10 frames from total 1260 frames Read 20 frames from total 1260 frames Read 30 frames from total 1260 frames Read 40 frames from total 1260 frames Read 50 frames from total 1260 frames .... .... Detected 10 frames Read 520 frames from total 1260 frames Detected 20 frames Read 530 frames from total 1260 frames Detected 30 frames Read 540 frames from total 1260 frames .... .... Tracked 1240 frames Tracked 1250 frames Written 1253 frames ------- Done !! -------
The video used in this repository was taken from the repository udacity/CarND-Vehicle-Detection.
OpenCV YOLO Object Detection (https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.cpp)
Kalman Filter - Artificial Intelligence for Robotics Udacity Course
Hungarian Algorithm - here
Motion-Based Multiple Object Tracking - here
Multiple Object Tracking - here
Computer Vision for tracking - here
| Back | FazBrowse Home | New Git URL |