• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/evadb/udfs/trackers/nor_fair.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
import numpy as np
×
16

17
from evadb.udfs.abstract.tracker_abstract_udf import EvaDBTrackerAbstractUDF
×
18
from evadb.utils.generic_utils import try_to_import_norfair
×
19
from evadb.utils.math_utils import get_centroid
×
20

21
DISTANCE_THRESHOLD_CENTROID: int = 30
×
22

23

24
class NorFairTracker(EvaDBTrackerAbstractUDF):
×
25
    @property
×
26
    def name(self) -> str:
×
27
        return "NorFairTracker"
×
28

29
    def setup(self, distance_threshold=DISTANCE_THRESHOLD_CENTROID) -> None:
×
30
        # https://github.com/tryolabs/norfair/blob/74b11edde83941dd6e32bcccd5fa849e16bf8564/norfair/tracker.py#L18
31
        try_to_import_norfair()
×
32
        from norfair import Tracker
×
33

34
        self.tracker = Tracker(
×
35
            distance_function="euclidean",
36
            distance_threshold=distance_threshold,
37
        )
38
        self.prev_frame_id = None
×
39

40
    def forward(self, frame_id, frame, labels, bboxes, scores):
×
41
        from norfair import Detection
×
42

43
        norfair_detections = [
×
44
            Detection(
45
                points=get_centroid(bbox),
46
                scores=np.array([score]),
47
                label=hash(label) % 10**8,
48
                data=(label, bbox, score),
49
            )
50
            for (bbox, score, label) in zip(bboxes, scores, labels)
51
        ]
52

53
        # calculate jump between consecutive update calls
54
        period = frame_id - self.prev_frame_id if self.prev_frame_id else 1
×
55
        self.prev_frame_id = frame_id
×
56

57
        # call tracker
58
        tracked_objects = self.tracker.update(
×
59
            detections=norfair_detections, period=period
60
        )
61
        bboxes_xyxy = []
×
62
        labels = []
×
63
        scores = []
×
64
        ids = []
×
65
        for obj in tracked_objects:
×
66
            det = obj.last_detection.data
×
67
            labels.append(det[0])
×
68
            bboxes_xyxy.append(det[1])
×
69
            scores.append(det[2])
×
70
            ids.append(obj.id)
×
71

72
        return np.array(ids), np.array(labels), np.array(bboxes_xyxy), np.array(scores)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc