add nanotrack v2 at regression test.
authorzihaomu <zihaomu@outlook.com>
Wed, 14 Dec 2022 06:41:49 +0000 (14:41 +0800)
committerzihaomu <zihaomu@outlook.com>
Wed, 14 Dec 2022 06:41:49 +0000 (14:41 +0800)
modules/video/include/opencv2/video/tracking.hpp
modules/video/test/test_trackers.cpp
samples/python/tracker.py

index 43877e4848ffc52d083b2e5dfbacbb27accdeb3d..20cfb77bab2ecbfdbc3e068096e211bf899af1e1 100644 (file)
@@ -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
  */
index d080198116d4011e1d94ff42d2d61e66e3c0ddab..6ede40896cb972cc936650a5e1e79d0177c9ae0f 100644 (file)
@@ -79,7 +79,7 @@ static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
     }
 }
 
-static void checkTrackingAccuracy(cv::Ptr<Tracker>& tracker, double iouThreshold = 0.8)
+static void checkTrackingAccuracy(cv::Ptr<Tracker>& 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> 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> tracker = TrackerNano::create(params);
+    checkTrackingAccuracy(tracker, 0.69);
+}
+
 }}  // namespace opencv_test::
index 067cf1341970332399b3380fbd9b1ba486554490..42b17018c955ab8c4677174a5567fc9235c15bee 100644 (file)
@@ -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]