From 7dbb125a3404f0a73fe876c99dcb91f16d261d38 Mon Sep 17 00:00:00 2001 From: zihaomu Date: Wed, 14 Dec 2022 14:41:49 +0800 Subject: [PATCH] add nanotrack v2 at regression test. --- .../video/include/opencv2/video/tracking.hpp | 4 ++-- modules/video/test/test_trackers.cpp | 17 +++++++++++++++-- samples/python/tracker.py | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/video/include/opencv2/video/tracking.hpp b/modules/video/include/opencv2/video/tracking.hpp index 43877e4848..20cfb77bab 100644 --- a/modules/video/include/opencv2/video/tracking.hpp +++ b/modules/video/include/opencv2/video/tracking.hpp @@ -851,9 +851,9 @@ public: /** @brief the Nano tracker is a super lightweight dnn-based general object tracking. * - * Nano tracker is much faster and extremely lightweight due to special model structure, the whole model size is about 1.1 MB. + * Nano tracker is much faster and extremely lightweight due to special model structure, the whole model size is about 1.9 MB. * Nano tracker needs two models: one for feature extraction (backbone) and the another for localization (neckhead). - * Please download these two onnx models at:https://github.com/HonglinChu/SiamTrackers/tree/master/NanoTrack/models/onnx. + * Please download these two onnx models at:https://github.com/HonglinChu/SiamTrackers/tree/master/NanoTrack/models/nanotrackv2. * Original repo is here: https://github.com/HonglinChu/NanoTrack * Author:HongLinChu, 1628464345@qq.com */ diff --git a/modules/video/test/test_trackers.cpp b/modules/video/test/test_trackers.cpp index d080198116..6ede40896c 100644 --- a/modules/video/test/test_trackers.cpp +++ b/modules/video/test/test_trackers.cpp @@ -79,7 +79,7 @@ static bool checkIOU(const Rect& r0, const Rect& r1, double threshold) } } -static void checkTrackingAccuracy(cv::Ptr& tracker, double iouThreshold = 0.8) +static void checkTrackingAccuracy(cv::Ptr& tracker, double iouThreshold = 0.7) { // Template image Mat img0 = imread(findDataFile("tracking/bag/00000001.jpg"), 1); @@ -136,7 +136,7 @@ TEST(DaSiamRPN, accuracy) checkTrackingAccuracy(tracker, 0.7); } -TEST(NanoTrack, accuracy) +TEST(NanoTrack, accuracy_NanoTrack_V1) { std::string backbonePath = cvtest::findDataFile("dnn/onnx/models/nanotrack_backbone_sim.onnx", false); std::string neckheadPath = cvtest::findDataFile("dnn/onnx/models/nanotrack_head_sim.onnx", false); @@ -147,4 +147,17 @@ TEST(NanoTrack, accuracy) cv::Ptr tracker = TrackerNano::create(params); checkTrackingAccuracy(tracker); } + +TEST(NanoTrack, accuracy_NanoTrack_V2) +{ + std::string backbonePath = cvtest::findDataFile("dnn/onnx/models/nanotrack_backbone_sim_v2.onnx", false); + std::string neckheadPath = cvtest::findDataFile("dnn/onnx/models/nanotrack_head_sim_v2.onnx", false); + + cv::TrackerNano::Params params; + params.backbone = backbonePath; + params.neckhead = neckheadPath; + cv::Ptr tracker = TrackerNano::create(params); + checkTrackingAccuracy(tracker, 0.69); +} + }} // namespace opencv_test:: diff --git a/samples/python/tracker.py b/samples/python/tracker.py index 067cf13419..42b17018c9 100644 --- a/samples/python/tracker.py +++ b/samples/python/tracker.py @@ -10,8 +10,8 @@ For DaSiamRPN: kernel_r1: https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0 kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0 For NanoTrack: - nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_backbone_sim.onnx - nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_head_sim.onnx + nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/nanotrackv2/nanotrack_backbone_sim.onnx + nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/nanotrackv2/nanotrack_head_sim.onnx USAGE: tracker.py [-h] [--input INPUT] [--tracker_algo TRACKER_ALGO] -- GitLab