示例#1
0
 def __init__(self):  # don't override the super init
     self.all_dataset = []
     self.num = 0
     start_idx = 0
     for name in cfg.DATASET.NAMES:
         sub_cfg = getattr(cfg.DATASET, name)
         sub_dataset = SubDataset(name, sub_cfg.DATA_DIR, sub_cfg.ANNO_FILE,
                                  sub_cfg.FRAME_RANGE, start_idx,
                                  sub_cfg.NUM_USE)
         sub_dataset.log()
         self.all_dataset.append(sub_dataset)
         start_idx += sub_dataset.num
         self.num += sub_dataset.num_use
     # self.num = cfg.DATASET.VIDEO_PER_EPOCH if cfg.DATASET.VIDEO_PER_EPOCH > 0 else self.num
     self.anchor_target = AnchorTarget(cfg.ANCHOR.SCALES, cfg.ANCHOR.RATIOS,
                                       cfg.ANCHOR.STRIDE,
                                       cfg.TRAIN.SEARCH_SIZE // 2,
                                       cfg.TRAIN.OUTPUT_SIZE)
     self.template_aug = Augmentation(cfg.DATASET.EXAMPLAR.SHIFT,
                                      cfg.DATASET.EXAMPLAR.SCALE,
                                      cfg.DATASET.EXAMPLAR.BLUR,
                                      cfg.DATASET.EXAMPLAR.FLIP,
                                      cfg.DATASET.EXAMPLAR.COLOR)
     self.search_aug = Augmentation(cfg.DATASET.SEARCH.SHIFT,
                                    cfg.DATASET.SEARCH.SCALE,
                                    cfg.DATASET.SEARCH.BLUR,
                                    cfg.DATASET.SEARCH.FLIP,
                                    cfg.DATASET.SEARCH.COLOR)
示例#2
0
 def __init__(self, model):
     super().__init__()
     self.model = model
     self.model.eval()
     self.anchor_generator = AnchorGenerator(cfg.ANCHOR.SCALES,
                                             cfg.ANCHOR.RATIOS,
                                             cfg.ANCHOR.STRIDE)
     self.score_size = (cfg.TRACK.INSTANCE_SIZE - cfg.TRACK.EXAMPLAR_SIZE) // \
                       cfg.ANCHOR.STRIDE + 1 + cfg.TRACK.BASE_SIZE
     hanning = np.hanning(self.score_size)
     window = np.outer(hanning, hanning)
     self.window = np.tile(window.flatten(),
                           self.anchor_generator.anchor_num)
     self.all_anchor = self.anchor_generator.generate_all_anchors(
         cfg.TRACK.INSTANCE_SIZE // 2, self.score_size)
     self.anchor_target = AnchorTarget(cfg.ANCHOR.SCALES, cfg.ANCHOR.RATIOS,
                                       cfg.ANCHOR.STRIDE,
                                       cfg.TRACK.INSTANCE_SIZE // 2,
                                       self.score_size)
     self.search_aug = Augmentation(cfg.DATASET.SEARCH.SHIFT,
                                    cfg.DATASET.SEARCH.SCALE,
                                    cfg.DATASET.SEARCH.BLUR,
                                    cfg.DATASET.SEARCH.FLIP,
                                    cfg.DATASET.SEARCH.COLOR)