Skip to content

Commit

Permalink
Improve VSense performance
Browse files Browse the repository at this point in the history
  • Loading branch information
rathaROG committed Apr 10, 2024
1 parent 6c82bae commit 1adae5e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions vsensebox/vsense/vsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def __init__(self):
self.assets = VSenseAssets()
self._detector = None
self._tracker = None
self._yaml_det = None
self._yaml_trk = None
self._det_rel_to_root = False
self._trk_rel_to_root = False

Expand All @@ -57,8 +59,11 @@ def detect(self, img, config_yaml=None, img_is_mat=False):
if config_yaml is None:
config_yaml = default_detector_yaml
self._det_rel_to_root = det_rel_to_root
self._detector = checkDet(detector=self._detector, config_yaml=config_yaml,
relative_to_vsensebox_root=self._det_rel_to_root)
if self._yaml_det != config_yaml:
self._detector = checkDet(detector=self._detector, config_yaml=config_yaml,
relative_to_vsensebox_root=self._det_rel_to_root)
else:
self._yaml_det = config_yaml
img, boxes_xywh, boxes_xyxy, keypoints, confs, cls = self._detector.detect(img)
self.assets.update(
boxes_xywh=boxes_xywh,
Expand All @@ -84,8 +89,11 @@ def track(self, img=None, config_yaml=None, img_is_mat=False):
if config_yaml is None:
config_yaml = default_tracker_yaml
self._trk_rel_to_root = trk_rel_to_root
self._tracker = checkTrk(tracker=self._tracker, config_yaml=config_yaml,
relative_to_vsensebox_root=self._trk_rel_to_root)
if self._yaml_trk != config_yaml:
self._tracker = checkTrk(tracker=self._tracker, config_yaml=config_yaml,
relative_to_vsensebox_root=self._trk_rel_to_root)
else:
self._yaml_trk = config_yaml
boxes_xyxy, self.assets.ids = self._tracker.update(
self.assets.boxes_xyxy,
self.assets.boxes_confs,
Expand Down

0 comments on commit 1adae5e

Please sign in to comment.