@@ -0,0 +1,2079 @@
+#!/usr/bin/env python3%0A# Copyright 2004-present Facebook. All Rights Reserved.%0Afrom ..structures import Instances%0Afrom detectron2.utils.registry import Registry%0Afrom ..config.config import CfgNode as CfgNode_%0Afrom detectron2.config import configurable%0A%0A%0ATRACKER_HEADS_REGISTRY = Registry(%22TRACKER_HEADS%22)%0ATRACKER_HEADS_REGISTRY.__doc__ = %22%22%22%0ARegistry for tracking classes.%0A%22%22%22%0A%0A%0Aclass BaseTracker(object):%0A    %22%22%22%0A    A parent class for all trackers%0A    %22%22%22%0A    @configurable%0A    def __init__(self, **kwargs):%0A        self._prev_instances = None  # (D2)instances for previous frame%0A        self._matched_idx = set()  # indices in prev_instances found matching%0A        self._matched_ID = set()  # idendities in prev_instances found matching%0A        self._untracked_prev_idx = set()  # indices in prev_instances not found matching%0A        self._id_count = 0  # used to assign new id%0A%0A    @classmethod%0A    def from_config(cls, cfg: CfgNode_):%0A        raise NotImplementedError(%22Calling BaseTracker::from_config%22)%0A%0A    def update(self, predictions: Instances) -%3E Instances:%0A        %22%22%22%0A        Args:%0A            predictions: D2 Instances for predictions of the current frame%0A        Return:%0A            D2 Instances for predictions of the current frame with ID assigned%0A%0A        _prev_instances and instances will have the following fields:%0A          .pred_boxes               (shape=%5BN, 4%5D)%0A          .scores                   (shape=%5BN,%5D)%0A          .pred_classes             (shape=%5BN,%5D)%0A          .pred_keypoints           (shape=%5BN, M, 3%5D, Optional)%0A          .pred_masks               (shape=List%5B2D_MASK%5D, Optional)   2D_MASK: shape=%5BH, W%5D%0A          .ID                       (shape=%5BN,%5D)%0A%0A        N: # of detected bboxes%0A        H and W: height and width of 2D mask%0A        %22%22%22%0A        raise NotImplementedError(%22Calling BaseTracker::update%22)%0A%0A%0Adef build_tracker_head(cfg: CfgNode_) -%3E BaseTracker:%0A    %22%22%22%0A    Build a semantic segmentation head from %60cfg.MODEL.SEM_SEG_HEAD.NAME%60.%0A    %22%22%22%0A    name = cfg.TRACKING.TRACKER_NAME%0A    return TRACKER_HEADS_REGISTRY.get(name)(cfg)%0A

Add base class