Combine Tracking and Detection Algorithm's in Jetson TX1

Hi 🖐🌸
I want to Combine Tracking and Detection Algorithm’s in Jetson TX1.
according to this paper, I want to detect the objects in the frame using the detection algorithm (yolov5) and then give the rectangle taken from the detection algorithm to the Tracking algorithm to follow it at a high speed.
And if the tracking algorithm fails to find the target, I will perform a detection on the frame again and guide the tracking algorithm again.
my problem is:
1-the tracking algorithms in OpenCV are not very accurate. For example, when the KCF tracking algorithm detects the target incorrectly, it still returns the correct value in the update() function (that is, it says that I have found the object), but it is not really the case.
2-The tracking algorithms on the board have a very low frame rate and sometimes take up to 1000 milliseconds. (I try KCF).
3-I tested some other algorithms, such as CSRT, but this algorithm is not very accurate in object detection and also has a very low frame rate.
4- MOSSE Algorithm have fast FPS and But it can be said that it does not have the ability to distinguish at all…
my Code that I have written is:

cv::Rect Rectangle;
cv::Mat frame;
std::string video_path = "";
cv::VideoCapture camera(video_path);
std::string MODE = "DETECT";
cv::Ptr<cv::Tracker> tracker = cv::TrackerKCF::create();

while (true)
{
    camera.read(frame);
    if (MODE == "DETECT" | MODE == "LOSS")
    {
        bool detect = InferenceYolov5(frame, Rectangle);
        if (detect)
        {
            tracker->init(frame, Rectangle);
            MODE = "TRACK";
        }
        else
        {
            MODE = "LOSS";
        }
    }

    if (MODE == "TRACK")
    {
        bool track = tracker->update(frame, Rectangle);
        if (track)
        {
            cv::putText(frame, "TRACKED", cv::Point(50, 50), 2, 2, cv::Scalar(255, 255, 0));
        }
        else
        {
            MODE = "DETECT";
        }
    }
    
    cv::imshow("Windows", frame);
    if (cv::waitKey(0) == 27)
    {
        break;
    }
}

Questions:
1- is there a way to run KCF, MOSSE, CSRT and … algorithms on GPU (cuda of Jetson TX1)?
2-Is there a problem with my code in terms of tracking structure?

INFO:
OS: Ubuntu 18.04
CUDA = 10.2
MODEL = Yolov5 (run on TensorRT)
Tested Algorithms: KCF, CSRT, MOSSE, MIL
FPS on model: 50ms
FPS with Tracking : 200ms → sometimes 2000ms

I hope someone can Help me with this problem.😩
ThankYou. ❤

Hi,

Please check our Deepstream SDK:

Thanks.

@AastaLLL
Thank you for your response 🌸🖐
I don’t see anything about implementation of KCF (or other tracking algorithms) and also yolov5 in deepstream platform…
Can you guide me more precisely?

Hi,

YOLO:
https://docs.nvidia.com/metropolis/deepstream/6.0/dev-guide/text/DS_custom_YOLO.html

Tracker:
https://docs.nvidia.com/metropolis/deepstream/6.0/dev-guide/text/DS_plugin_gst-nvtracker.html

Thanks

1 Like

Thanks for your help @AastaLLL

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.