JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
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
7import numpy as np
8import cv2 as cv
9
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
setBackend(self, backend_id)
Definition dasiamrpn.py:30
init(self, image, roi)
Definition dasiamrpn.py:50
setTarget(self, target_id)
Definition dasiamrpn.py:40
__init__(self, model_path, kernel_cls1_path, kernel_r1_path, backend_id=0, target_id=0)
Definition dasiamrpn.py:11
infer(self, image)
Definition dasiamrpn.py:53