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

georgia-tech-db / eva / 8ac704ce-924d-4415-96d0-a7a53cd460d1

pending completion
8ac704ce-924d-4415-96d0-a7a53cd460d1

Pull #566

circle-ci

xzdandy
Merge branch 'obj-tracking' of github.com:georgia-tech-db/eva into obj-tracking
Pull Request #566: feat: object tracking

155 of 155 new or added lines in 16 files covered. (100.0%)

9371 of 9588 relevant lines covered (97.74%)

0.98 hits per line

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

91.67
/eva/udfs/trackers/tracker.py
1
# coding=utf-8
2
# Copyright 2018-2022 EVA
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 typing
1✔
16

17
import numpy
1✔
18
import pandas as pd
1✔
19

20
from eva.catalog.catalog_type import NdArrayType
1✔
21
from eva.udfs.abstract.abstract_udf import AbstractUDF
1✔
22
from eva.udfs.decorators.decorators import forward, setup
1✔
23
from eva.udfs.decorators.io_descriptors.data_types import NumpyArray
1✔
24

25

26
class EVATracker(AbstractUDF):
1✔
27
    def __init__(self) -> None:
1✔
28
        pass
1✔
29

30
    def name(self):
1✔
31
        return "EVATracker"
×
32

33
    @setup(cachable=False, udf_type="object_tracker", batchable=False)
1✔
34
    def setup(self):
1✔
35
        pass
×
36

37
    @forward(
1✔
38
        input_signatures=[
39
            NumpyArray("frame_id", type=NdArrayType.INT32, dimensions=(1,)),
40
            NumpyArray("frame", type=NdArrayType.FLOAT32, dimensions=(None, None, 3)),
41
            NumpyArray("bboxes", type=NdArrayType.FLOAT32, dimensions=(None, 4)),
42
            NumpyArray("scores", type=NdArrayType.FLOAT32, dimensions=(None,)),
43
            NumpyArray("labels", type=NdArrayType.INT32, dimensions=(None,)),
44
        ],
45
        output_signatures=[
46
            NumpyArray("track_ids", type=NdArrayType.INT32, dimensions=(None,)),
47
            NumpyArray("track_labels", type=NdArrayType.INT32, dimensions=(None,)),
48
            NumpyArray("track_bboxes", type=NdArrayType.FLOAT32, dimensions=(None, 4)),
49
            NumpyArray("track_scores", type=NdArrayType.FLOAT32, dimensions=(None,)),
50
        ],
51
    )
52
    def forward(
1✔
53
        self,
54
        frame_id: numpy.ndarray,
55
        frame: numpy.ndarray,
56
        labels: numpy.ndarray,
57
        bboxes: numpy.ndarray,
58
        scores: numpy.ndarray,
59
    ) -> typing.Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]:
60
        """
61
        Args:
62
            frame_id (numpy.ndarray): the frame id of current frame
63
            frame (numpy.ndarray): the input frame with shape (C, H, W)
64
            labels (numpy.ndarray): Corresponding labels for each box
65
            bboxes (numpy.ndarray): Array of shape `(n, 4)` or of shape `(4,)` where
66
            each row contains `(xmin, ymin, width, height)`.
67
            scores (numpy.ndarray): Corresponding scores for each box
68
        Returns:
69
            track_ids (numpy.ndarray): Corresponding track id for each box
70
            track_labels (numpy.ndarray): Corresponding labels for each box
71
            track_bboxes (numpy.ndarray):  Array of shape `(n, 4)` of tracked objects
72
            track_scores (numpy.ndarray): Corresponding scores for each box
73
        """
74
        raise NotImplementedError
75

76
    def __call__(self, *args, **kwargs):
1✔
77
        assert isinstance(
1✔
78
            args[0], pd.DataFrame
79
        ), f"Expecting pd.DataFrame, got {type(args[0])}"
80

81
        results = []
1✔
82
        for _, row in args[0].iterrows():
1✔
83
            tuple = (
1✔
84
                numpy.array(row[0]),
85
                numpy.array(row[1]),
86
                numpy.stack(row[2]),
87
                numpy.stack(row[3]),
88
                numpy.stack(row[4]),
89
            )
90
            results.append(self.forward(*tuple))
1✔
91
        return pd.DataFrame(
1✔
92
            results,
93
            columns=["track_ids", "track_labels", "track_bboxes", "track_scores"],
94
        )
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