Example #1
0
    def initialize(self):
        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, _ = load_network(net_path_full, backbone_pretrained=False)

        if self.use_gpu:
            self.net.cuda()
        self.net.eval()

        # self.iou_predictor = self.net.bb_regressor  # original
        self.rgb_bb_regressor = self.net.rgb_bb_regressor
        self.t_bb_regressor = self.net.t_bb_regressor
        self.iou_guess = self.net.iou_guess

        self.layer_stride = {
            'conv1': 2,
            'layer1': 4,
            'layer2': 8,
            'layer3': 16,
            'layer4': 32,
            'classification': 16,
            'fc': None
        }
        self.layer_dim = {
            'conv1': 64,
            'layer1': 64,
            'layer2': 128,
            'layer3': 256,
            'layer4': 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 = torch.Tensor([0.485, 0.456, 0.406]).view(1, -1, 1, 1)
        self.std = torch.Tensor([0.229, 0.224, 0.225]).view(1, -1, 1, 1)
    def __init__(self, name: str, parameter_name: str, exp_name: str, run_id: int = None, checkpoint_id = None, flag: str = None):
        self.name = name
        self.exp_name = exp_name
        self.parameter_name = parameter_name
        self.run_id = run_id
        self.flag = flag
        self.checkpoint_id = checkpoint_id

        env = env_settings()

        tracker_module = importlib.import_module('core.tracker.{}'.format(self.name))

        self.parameters = self.get_parameters()
        self.tracker_class = tracker_module.get_tracker_class()

        self.default_visualization = getattr(self.parameters, 'visualization', False)
        self.default_debug = getattr(self.parameters, 'debug', 0)
Example #3
0
    def initialize(self):
        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)

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

        self.layer_stride = {
            'vggconv1': 2,
            'conv1': 2,
            'layer1': 4,
            'layer2': 8,
            'layer3': 16,
            'layer4': 32,
            'fc': None
        }
        self.layer_dim = {
            'vggconv1': 96,
            'conv1': 64,
            'layer1': 64,
            'layer2': 128,
            'layer3': 256,
            'layer4': 512,
            'fc': None
        }

        self.mean = torch.Tensor([0.485, 0.456, 0.406]).view(1, -1, 1, 1)
        self.std = torch.Tensor([0.229, 0.224, 0.225]).view(1, -1, 1, 1)

        self.net = resnet18_vggmconv1(self.output_layers, path=net_path_full)
        if self.use_gpu:
            self.net.cuda()
        self.net.eval()
Example #4
0
 def __init__(self):
     self.env_settings = env_settings()