def __init__(self, cfg, meta):
    self.cfg = deepcopy(cfg)
    if self.cfg.MODEL.DEVICE.startswith('cuda:'):
        torch.cuda.set_device(self.cfg.MODEL.DEVICE)
        self.cfg.MODEL.DEVICE = 'cuda'
    self.model = cfg.build_model(self.cfg)
    self.model.eval()
    self.metadata = meta
    checkpointer = DefaultCheckpointer(self.model)
    checkpointer.load(cfg.MODEL.WEIGHTS)
    self.transform_gen = build_transform_gens(cfg.INPUT.AUG.TEST_PIPELINES)
    self.input_format = cfg.INPUT.FORMAT
    assert (self.input_format in ['RGB', 'BGR']), self.input_format
def __init__(self, cfg, meta):
    self.cfg = deepcopy(cfg)
    if self.cfg.MODEL.DEVICE.startswith('cuda:'):
        torch.cuda.set_device(self.cfg.MODEL.DEVICE)
        self.cfg.MODEL.DEVICE = 'cuda'
    self.model = cfg.build_model(self.cfg)
    self.model.eval()
    self.metadata = meta
    checkpointer = DefaultCheckpointer(self.model)
    checkpointer.load(cfg.MODEL.WEIGHTS)
    self.transform_gen = build_transform_gens(cfg.INPUT.AUG.TEST_PIPELINES)
    self.input_format = cfg.INPUT.FORMAT
    assert (self.input_format in ['RGB', 'BGR']), self.input_format