mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #26875 from asmorkalov:as/in_memory_models
Added trackers factory with pre-loaded dnn models #26875 Replaces https://github.com/opencv/opencv/pull/26295 Allows to substitute custom models or initialize tracker from in-memory model. ### 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 - [ ] 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
This commit is contained in:
committed by
GitHub
parent
a8df0a06ac
commit
ae25c3194f
@@ -7,12 +7,30 @@ from tests_common import NewOpenCVTests, unittest
|
||||
|
||||
class tracking_test(NewOpenCVTests):
|
||||
|
||||
def test_createTracker(self):
|
||||
t = cv.TrackerMIL_create()
|
||||
try:
|
||||
t = cv.TrackerGOTURN_create()
|
||||
except cv.error as e:
|
||||
pass # may fail due to missing DL model files
|
||||
def test_createMILTracker(self):
|
||||
t = cv.TrackerMIL.create()
|
||||
self.assertTrue(t is not None)
|
||||
|
||||
def test_createGoturnTracker(self):
|
||||
proto = self.find_file("dnn/gsoc2016-goturn/goturn.prototxt", required=False);
|
||||
weights = self.find_file("dnn/gsoc2016-goturn/goturn.caffemodel", required=False);
|
||||
net = cv.dnn.readNet(proto, weights)
|
||||
t = cv.TrackerGOTURN.create(net)
|
||||
self.assertTrue(t is not None)
|
||||
|
||||
def test_createNanoTracker(self):
|
||||
backbone_path = self.find_file("dnn/onnx/models/nanotrack_backbone_sim_v2.onnx", required=False);
|
||||
neckhead_path = self.find_file("dnn/onnx/models/nanotrack_head_sim_v2.onnx", required=False);
|
||||
backbone = cv.dnn.readNet(backbone_path)
|
||||
neckhead = cv.dnn.readNet(neckhead_path)
|
||||
t = cv.TrackerNano.create(backbone, neckhead)
|
||||
self.assertTrue(t is not None)
|
||||
|
||||
def test_createVitTracker(self):
|
||||
model_path = self.find_file("dnn/onnx/models/vitTracker.onnx", required=False);
|
||||
model = cv.dnn.readNet(model_path)
|
||||
t = cv.TrackerVit.create(model)
|
||||
self.assertTrue(t is not None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user