JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Tweet
Loading...
Searching...
No Matches
dasiamrpn.py
Go to the documentation of this file.
1
# This file is part of OpenCV Zoo project.
2
# It is subject to the license terms in the LICENSE file found in the same directory.
3
#
4
# Copyright (C) 2021, Shenzhen Institute of Artificial Intelligence and Robotics for Society, all rights reserved.
5
# Third party copyrights are property of their respective owners.
6
7
import
numpy
as
np
8
import
cv2
as
cv
9
10
class
DaSiamRPN
:
11
def
__init__
(self, model_path, kernel_cls1_path, kernel_r1_path, backend_id=0, target_id=0):
12
self.
_model_path
= model_path
13
self.
_kernel_cls1_path
= kernel_cls1_path
14
self.
_kernel_r1_path
= kernel_r1_path
15
self.
_backend_id
= backend_id
16
self.
_target_id
= target_id
17
18
self.
_param
= cv.TrackerDaSiamRPN_Params()
19
self.
_param
.model = self.
_model_path
20
self.
_param
.kernel_cls1 = self.
_kernel_cls1_path
21
self.
_param
.kernel_r1 = self.
_kernel_r1_path
22
self.
_param
.backend = self.
_backend_id
23
self.
_param
.target = self.
_target_id
24
self.
_model
= cv.TrackerDaSiamRPN.create(self.
_param
)
25
26
@property
27
def
name
(self):
28
return
self.__class__.__name__
29
30
def
setBackend
(self, backend_id):
31
self.
_backend_id
= backend_id
32
self.
_param
= cv.TrackerDaSiamRPN_Params()
33
self.
_param
.model = self.
_model_path
34
self.
_param
.kernel_cls1 = self.
_kernel_cls1_path
35
self.
_param
.kernel_r1 = self.
_kernel_r1_path
36
self.
_param
.backend = self.
_backend_id
37
self.
_param
.target = self.
_target_id
38
self.
_model
= cv.TrackerDaSiamRPN.create(self.
_param
)
39
40
def
setTarget
(self, target_id):
41
self.
_target_id
= target_id
42
self.
_param
= cv.TrackerDaSiamRPN_Params()
43
self.
_param
.model = self.
_model_path
44
self.
_param
.kernel_cls1 = self.
_kernel_cls1_path
45
self.
_param
.kernel_r1 = self.
_kernel_r1_path
46
self.
_param
.backend = self.
_backend_id
47
self.
_param
.target = self.
_target_id
48
self.
_model
= cv.TrackerDaSiamRPN.create(self.
_param
)
49
50
def
init
(self, image, roi):
51
self.
_model
.
init
(image, roi)
52
53
def
infer
(self, image):
54
isLocated, bbox = self.
_model
.update(image)
55
score = self.
_model
.getTrackingScore()
56
return
isLocated, bbox, score
dasiamrpn.DaSiamRPN
Definition
dasiamrpn.py:10
dasiamrpn.DaSiamRPN.setBackend
setBackend(self, backend_id)
Definition
dasiamrpn.py:30
dasiamrpn.DaSiamRPN._param
_param
Definition
dasiamrpn.py:18
dasiamrpn.DaSiamRPN.init
init(self, image, roi)
Definition
dasiamrpn.py:50
dasiamrpn.DaSiamRPN._kernel_r1_path
_kernel_r1_path
Definition
dasiamrpn.py:14
dasiamrpn.DaSiamRPN.name
name(self)
Definition
dasiamrpn.py:27
dasiamrpn.DaSiamRPN._kernel_cls1_path
_kernel_cls1_path
Definition
dasiamrpn.py:13
dasiamrpn.DaSiamRPN.setTarget
setTarget(self, target_id)
Definition
dasiamrpn.py:40
dasiamrpn.DaSiamRPN._backend_id
_backend_id
Definition
dasiamrpn.py:15
dasiamrpn.DaSiamRPN._model
_model
Definition
dasiamrpn.py:24
dasiamrpn.DaSiamRPN.__init__
__init__(self, model_path, kernel_cls1_path, kernel_r1_path, backend_id=0, target_id=0)
Definition
dasiamrpn.py:11
dasiamrpn.DaSiamRPN._model_path
_model_path
Definition
dasiamrpn.py:12
dasiamrpn.DaSiamRPN._target_id
_target_id
Definition
dasiamrpn.py:16
dasiamrpn.DaSiamRPN.infer
infer(self, image)
Definition
dasiamrpn.py:53
opencv_zoo
models
object_tracking_dasiamrpn
dasiamrpn.py
Please help us improve this page: Edit it on
GitHub
or
email us your edits and suggestions.
Generated by
1.9.8