Download lib/test/tracker/basetracker.py from AhmedLabib1/stark-full: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/AhmedLabib1/stark-full/resolve/main/lib/test/tracker/basetracker.py
- Command line
-
hf download hf://AhmedLabib1/stark-full/lib/test/tracker/basetracker.py
-
curl -L -o basetracker.py https://huggingface.co/AhmedLabib1/stark-full/resolve/main/lib/test/tracker/basetracker.py
1.03 kB
| from _collections import OrderedDict | |
| class BaseTracker: | |
| """Base class for all trackers.""" | |
| def __init__(self, params): | |
| self.params = params | |
| self.visdom = None | |
| def predicts_segmentation_mask(self): | |
| return False | |
| def initialize(self, image, info: dict) -> dict: | |
| """Overload this function in your tracker. This should initialize the model.""" | |
| raise NotImplementedError | |
| def track(self, image, info: dict = None) -> dict: | |
| """Overload this function in your tracker. This should track in the frame and update the model.""" | |
| raise NotImplementedError | |
| def visdom_draw_tracking(self, image, box, segmentation=None): | |
| if isinstance(box, OrderedDict): | |
| box = [v for k, v in box.items()] | |
| else: | |
| box = (box,) | |
| if segmentation is None: | |
| self.visdom.register((image, *box), 'Tracking', 1, 'Tracking') | |
| else: | |
| self.visdom.register((image, *box, segmentation), 'Tracking', 1, 'Tracking') |