Example #1
0
def main():
    for epoch in parse_epoch(args.epoch):
        # get checkpoint
        checkpoint_pth = get_checkpoint_path(args.training_base_param, epoch)

        if args.exp_id == '':
            exp_id = args.training_base_param + '.epoch{}'.format(epoch)
        else:
            exp_id = args.exp_id
        print('=> Evaluating: {}'.format(exp_id))

        if args.dataset in ['CVPR13', 'OTB50', 'OTB100']:
            # for OTB datasets, we save results into the same directory
            save_dataset_name = 'OTB100'
        else:
            save_dataset_name = args.dataset

        # set up parameters
        params = {
            'dataset_name': args.dataset,
            'checkpoint': checkpoint_pth,
            'tracking_base_param': args.tracking_base_param,
            'num_repeat': args.num_repeat,
            'exp_id': exp_id,
            'result_dir': env_settings().results_path,
            'save_dataset_name': save_dataset_name,
        }

        metrics = run_tracking_and_evaluate(params)
        save_info(params, metrics)
Example #2
0
    def initialize(self):
        with fluid.dygraph.guard():
            if os.path.isabs(self.net_path):
                net_path_full = self.net_path
            else:
                net_path_full = os.path.join(env_settings().network_path,
                                             self.net_path)

            self.net = siamfc_alexnet(
                backbone_pretrained=False,
                backbone_is_test=True,
                estimator_is_test=True)

            state_dictsm, _ = fluid.load_dygraph(net_path_full)
            self.net.load_dict(state_dictsm)
            self.net.train()

            self.target_estimator = self.net.target_estimator

        self.layer_stride = {'conv5': 8}
        self.layer_dim = {'conv5': 256}

        self.estimator_feature_layers = self.net.target_estimator_layer

        if isinstance(self.pool_stride, int) and self.pool_stride == 1:
            self.pool_stride = [1] * len(self.output_layers)

        self.feature_layers = sorted(
            list(set(self.output_layers + self.estimator_feature_layers)))

        self.mean = np.reshape([0., 0., 0.], [1, -1, 1, 1])
        self.std = np.reshape([1 / 255., 1 / 255., 1 / 255.], [1, -1, 1, 1])
Example #3
0
def run_tracking_and_evaluate(params):
    """Receive hyperparameters and return the evaluation metric"""
    # load dataset
    root = os.path.abspath(
        osp.join(env_settings().dataset_path, params['save_dataset_name']))
    dataset = DatasetFactory.create_dataset(name=params['dataset_name'],
                                            dataset_root=root)

    run_one_dataset(dataset, params)
    metrics = compute_evaluation_metrics(dataset, params)

    return metrics
Example #4
0
    def initialize(self):
        with fluid.dygraph.guard():
            if os.path.isabs(self.net_path):
                net_path_full = self.net_path
            else:
                net_path_full = os.path.join(env_settings().network_path, self.net_path)

            self.net = SiamMask_ResNet50_sharp(backbone_pretrained=False, is_test=True)

            state_dict, _ = fluid.load_dygraph(net_path_full)
            self.net.load_dict(state_dict)
            self.net.eval()
Example #5
0
    def initialize(self):
        with fluid.dygraph.guard():
            if os.path.isabs(self.net_path):
                net_path_full = self.net_path
            else:
                net_path_full = os.path.join(env_settings().network_path,
                                             self.net_path)

            self.net = atom_resnet18(
                backbone_pretrained=False,
                backbone_is_test=True,
                iounet_is_test=True)

            state_dictsm, _ = fluid.load_dygraph(net_path_full)
            self.net.load_dict(state_dictsm)
            self.net.train()

            self.iou_predictor = self.net.bb_regressor

        self.layer_stride = {
            'conv0': 2,
            'conv1': 2,
            'block0': 4,
            'block1': 8,
            'block2': 16,
            'block3': 32,
            'classification': 16,
            'fc': None
        }
        self.layer_dim = {
            'conv0': 64,
            'conv1': 64,
            'block0': 64,
            'block1': 128,
            'block2': 256,
            'block3': 512,
            'classification': 256,
            'fc': None
        }

        self.iounet_feature_layers = self.net.bb_regressor_layer

        if isinstance(self.pool_stride, int) and self.pool_stride == 1:
            self.pool_stride = [1] * len(self.output_layers)

        self.feature_layers = sorted(
            list(set(self.output_layers + self.iounet_feature_layers)))

        self.mean = np.reshape([0.485, 0.456, 0.406], [1, -1, 1, 1])
        self.std = np.reshape([0.229, 0.224, 0.225], [1, -1, 1, 1])
Example #6
0
def get_checkpoint_path(training_base_param, epoch):
    model_dir = osp.abspath(
        osp.join(env_settings().network_path, *training_base_param.split('.')))
    model_names = glob(model_dir + '/*.pdparams')
    prefix = '_'.join(model_names[0].split('_')[:-1])
    return osp.join(model_dir, '{}_ep{:04d}'.format(prefix, epoch))