Skip to content

Commit d231b4e

Browse files
authored
Merge pull request #25503 from WanliZhong:remove_goturn
Remove goturn caffe model #25503 **Merged with:** opencv/opencv_extra#1174 **Merged with:** opencv/opencv_contrib#3729 Part of #25314 This PR aims to remove goturn tracking model because Caffe importer will be remove in 5.0 The GOTURN model will take **388 MB** of traffic for each download if converted to onnx. If the user wants to use the tracking method, we can recommend they use Vit or dasimRPN. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent 94f4678 commit d231b4e

File tree

10 files changed

+8
-259
lines changed

10 files changed

+8
-259
lines changed

modules/video/doc/video.bib

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ @article{AMVOT
2020
publisher={ACM}
2121
}
2222

23-
@inproceedings{GOTURN,
24-
title={Learning to Track at 100 FPS with Deep Regression Networks},
25-
author={Held, David and Thrun, Sebastian and Savarese, Silvio},
26-
booktitle={European Conference Computer Vision (ECCV)},
27-
year={2016}
28-
}
29-
3023
@inproceedings{Kroeger2016,
3124
author={Till Kroeger and Radu Timofte and Dengxin Dai and Luc Van Gool},
3225
title={Fast Optical Flow using Dense Inverse Search},

modules/video/include/opencv2/video/tracking.hpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -789,47 +789,6 @@ class CV_EXPORTS_W TrackerMIL : public Tracker
789789
//bool update(InputArray image, CV_OUT Rect& boundingBox) CV_OVERRIDE;
790790
};
791791

792-
793-
794-
/** @brief the GOTURN (Generic Object Tracking Using Regression Networks) tracker
795-
*
796-
* GOTURN (@cite GOTURN) is kind of trackers based on Convolutional Neural Networks (CNN). While taking all advantages of CNN trackers,
797-
* GOTURN is much faster due to offline training without online fine-tuning nature.
798-
* GOTURN tracker addresses the problem of single target tracking: given a bounding box label of an object in the first frame of the video,
799-
* we track that object through the rest of the video. NOTE: Current method of GOTURN does not handle occlusions; however, it is fairly
800-
* robust to viewpoint changes, lighting changes, and deformations.
801-
* Inputs of GOTURN are two RGB patches representing Target and Search patches resized to 227x227.
802-
* Outputs of GOTURN are predicted bounding box coordinates, relative to Search patch coordinate system, in format X1,Y1,X2,Y2.
803-
* Original paper is here: <http://davheld.github.io/GOTURN/GOTURN.pdf>
804-
* As long as original authors implementation: <https://github.com/davheld/GOTURN#train-the-tracker>
805-
* Implementation of training algorithm is placed in separately here due to 3d-party dependencies:
806-
* <https://github.com/Auron-X/GOTURN_Training_Toolkit>
807-
* GOTURN architecture goturn.prototxt and trained model goturn.caffemodel are accessible on opencv_extra GitHub repository.
808-
*/
809-
class CV_EXPORTS_W TrackerGOTURN : public Tracker
810-
{
811-
protected:
812-
TrackerGOTURN(); // use ::create()
813-
public:
814-
virtual ~TrackerGOTURN() CV_OVERRIDE;
815-
816-
struct CV_EXPORTS_W_SIMPLE Params
817-
{
818-
CV_WRAP Params();
819-
CV_PROP_RW std::string modelTxt;
820-
CV_PROP_RW std::string modelBin;
821-
};
822-
823-
/** @brief Constructor
824-
@param parameters GOTURN parameters TrackerGOTURN::Params
825-
*/
826-
static CV_WRAP
827-
Ptr<TrackerGOTURN> create(const TrackerGOTURN::Params& parameters = TrackerGOTURN::Params());
828-
829-
//void init(InputArray image, const Rect& boundingBox) CV_OVERRIDE;
830-
//bool update(InputArray image, CV_OUT Rect& boundingBox) CV_OVERRIDE;
831-
};
832-
833792
class CV_EXPORTS_W TrackerDaSiamRPN : public Tracker
834793
{
835794
protected:

modules/video/misc/java/test/TrackerCreateTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.opencv.test.OpenCVTestCase;
99

1010
import org.opencv.video.Tracker;
11-
import org.opencv.video.TrackerGOTURN;
11+
import org.opencv.video.TrackerVit;
1212
import org.opencv.video.TrackerMIL;
1313

1414
public class TrackerCreateTest extends OpenCVTestCase {
@@ -19,9 +19,9 @@ protected void setUp() throws Exception {
1919
}
2020

2121

22-
public void testCreateTrackerGOTURN() {
22+
public void testCreateTrackerVit() {
2323
try {
24-
Tracker tracker = TrackerGOTURN.create();
24+
Tracker tracker = TrackerVit.create();
2525
assert(tracker != null);
2626
} catch (CvException e) {
2727
// expected, model files may be missing
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifdef HAVE_OPENCV_VIDEO
22
typedef TrackerMIL::Params TrackerMIL_Params;
3-
typedef TrackerGOTURN::Params TrackerGOTURN_Params;
43
typedef TrackerDaSiamRPN::Params TrackerDaSiamRPN_Params;
54
typedef TrackerNano::Params TrackerNano_Params;
65
#endif

modules/video/misc/python/test/test_tracking.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

modules/video/perf/perf_trackers.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,4 @@ PERF_TEST_P(Tracking, MIL, testing::ValuesIn(getTrackingParams()))
9090
runTrackingTest<Rect>(tracker, GetParam());
9191
}
9292

93-
PERF_TEST_P(Tracking, GOTURN, testing::ValuesIn(getTrackingParams()))
94-
{
95-
std::string model = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.prototxt");
96-
std::string weights = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.caffemodel", false);
97-
TrackerGOTURN::Params params;
98-
params.modelTxt = model;
99-
params.modelBin = weights;
100-
auto tracker = TrackerGOTURN::create(params);
101-
runTrackingTest<Rect>(tracker, GetParam());
102-
}
103-
10493
}} // namespace

modules/video/src/tracking/tracker_dasiamrpn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Ptr<TrackerDaSiamRPN> TrackerDaSiamRPN::create(const TrackerDaSiamRPN::Params& p
434434
Ptr<TrackerDaSiamRPN> TrackerDaSiamRPN::create(const TrackerDaSiamRPN::Params& parameters)
435435
{
436436
(void)(parameters);
437-
CV_Error(cv::Error::StsNotImplemented, "to use GOTURN, the tracking module needs to be built with opencv_dnn !");
437+
CV_Error(cv::Error::StsNotImplemented, "to use DaSimRPN, the tracking module needs to be built with opencv_dnn !");
438438
}
439439
#endif // OPENCV_HAVE_DNN
440440
}

modules/video/src/tracking/tracker_goturn.cpp

Lines changed: 0 additions & 140 deletions
This file was deleted.

modules/video/test/test_trackers.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ TEST_P(DistanceAndOverlap, Scaled_Data_MIL)
5151
test.run();
5252
}
5353

54-
TEST_P(DistanceAndOverlap, GOTURN)
55-
{
56-
std::string model = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.prototxt");
57-
std::string weights = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.caffemodel", false);
58-
cv::TrackerGOTURN::Params params;
59-
params.modelTxt = model;
60-
params.modelBin = weights;
61-
TrackerTest<Tracker, Rect> test(TrackerGOTURN::create(params), dataset, 35, .35f, NoTransform);
62-
test.run();
63-
}
64-
6554
INSTANTIATE_TEST_CASE_P(Tracking, DistanceAndOverlap, TESTSET_NAMES);
6655

6756
static bool checkIOU(const Rect& r0, const Rect& r1, double threshold)
@@ -111,18 +100,6 @@ static void checkTrackingAccuracy(cv::Ptr<Tracker>& tracker, double iouThreshold
111100
}
112101
}
113102

114-
TEST(GOTURN, accuracy)
115-
{
116-
std::string model = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.prototxt");
117-
std::string weights = cvtest::findDataFile("dnn/gsoc2016-goturn/goturn.caffemodel", false);
118-
cv::TrackerGOTURN::Params params;
119-
params.modelTxt = model;
120-
params.modelBin = weights;
121-
cv::Ptr<Tracker> tracker = TrackerGOTURN::create(params);
122-
// TODO! GOTURN have low accuracy. Try to remove this api at 5.x.
123-
checkTrackingAccuracy(tracker, 0.08);
124-
}
125-
126103
TEST(DaSiamRPN, accuracy)
127104
{
128105
std::string model = cvtest::findDataFile("dnn/onnx/models/dasiamrpn_model.onnx", false);

samples/python/tracker.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
Tracker demo
44
55
For usage download models by following links
6-
For GOTURN:
7-
goturn.prototxt and goturn.caffemodel: https://github.com/opencv/opencv_extra/tree/c4219d5eb3105ed8e634278fad312a1a8d2c182d/testdata/tracking
86
For DaSiamRPN:
97
network: https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
108
kernel_r1: https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0
119
kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0
1210
For NanoTrack:
1311
nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/nanotrackv2/nanotrack_backbone_sim.onnx
1412
nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/nanotrackv2/nanotrack_head_sim.onnx
15-
13+
For VitTrack:
14+
vitTracker: https://github.com/opencv/opencv_zoo/raw/fef72f8fa7c52eaf116d3df358d24e6e959ada0e/models/object_tracking_vittrack/object_tracking_vittrack_2023sep.onnx
1615
USAGE:
1716
tracker.py [-h] [--input INPUT] [--tracker_algo TRACKER_ALGO]
18-
[--goturn GOTURN] [--goturn_model GOTURN_MODEL]
1917
[--dasiamrpn_net DASIAMRPN_NET]
2018
[--dasiamrpn_kernel_r1 DASIAMRPN_KERNEL_R1]
2119
[--dasiamrpn_kernel_cls1 DASIAMRPN_KERNEL_CLS1]
@@ -46,11 +44,6 @@ def __init__(self, args):
4644
def createTracker(self):
4745
if self.trackerAlgorithm == 'mil':
4846
tracker = cv.TrackerMIL_create()
49-
elif self.trackerAlgorithm == 'goturn':
50-
params = cv.TrackerGOTURN_Params()
51-
params.modelTxt = self.args.goturn
52-
params.modelBin = self.args.goturn_model
53-
tracker = cv.TrackerGOTURN_create(params)
5447
elif self.trackerAlgorithm == 'dasiamrpn':
5548
params = cv.TrackerDaSiamRPN_Params()
5649
params.model = self.args.dasiamrpn_net
@@ -67,7 +60,7 @@ def createTracker(self):
6760
params.net = args.vittrack_net
6861
tracker = cv.TrackerVit_create(params)
6962
else:
70-
sys.exit("Tracker {} is not recognized. Please use one of three available: mil, goturn, dasiamrpn, nanotrack.".format(self.trackerAlgorithm))
63+
sys.exit("Tracker {} is not recognized. Please use one of three available: mil, dasiamrpn, nanotrack.".format(self.trackerAlgorithm))
7164
return tracker
7265

7366
def initializeTracker(self, image):
@@ -131,9 +124,7 @@ def run(self):
131124
print(__doc__)
132125
parser = argparse.ArgumentParser(description="Run tracker")
133126
parser.add_argument("--input", type=str, default="vtest.avi", help="Path to video source")
134-
parser.add_argument("--tracker_algo", type=str, default="nanotrack", help="One of available tracking algorithms: mil, goturn, dasiamrpn, nanotrack, vittrack")
135-
parser.add_argument("--goturn", type=str, default="goturn.prototxt", help="Path to GOTURN architecture")
136-
parser.add_argument("--goturn_model", type=str, default="goturn.caffemodel", help="Path to GOTERN model")
127+
parser.add_argument("--tracker_algo", type=str, default="nanotrack", help="One of available tracking algorithms: mil, dasiamrpn, nanotrack, vittrack")
137128
parser.add_argument("--dasiamrpn_net", type=str, default="dasiamrpn_model.onnx", help="Path to onnx model of DaSiamRPN net")
138129
parser.add_argument("--dasiamrpn_kernel_r1", type=str, default="dasiamrpn_kernel_r1.onnx", help="Path to onnx model of DaSiamRPN kernel_r1")
139130
parser.add_argument("--dasiamrpn_kernel_cls1", type=str, default="dasiamrpn_kernel_cls1.onnx", help="Path to onnx model of DaSiamRPN kernel_cls1")

0 commit comments

Comments
 (0)