def load(self, path, load_optimizer=True, parse_opt=False, cpu_flag: bool=True):
    if cpu_flag:
        state_dict = t.load(path, map_location=t.device('cpu'))
    else:
        state_dict = t.load(path)
    if ('model' in state_dict):
        self.faster_rcnn.load_state_dict(state_dict['model'])
    else:
        self.faster_rcnn.load_state_dict(state_dict)
        return self
    if parse_opt:
        opt._parse(state_dict['config'])
    if (('optimizer' in state_dict) and load_optimizer):
        self.optimizer.load_state_dict(state_dict['optimizer'])
    return self
def load(self, path, load_optimizer=True, parse_opt=False, cpu_flag: bool=True):
    if cpu_flag:
        state_dict = t.load(path, map_location=t.device('cpu'))
    else:
        state_dict = t.load(path)
    if ('model' in state_dict):
        self.faster_rcnn.load_state_dict(state_dict['model'])
    else:
        self.faster_rcnn.load_state_dict(state_dict)
        return self
    if parse_opt:
        opt._parse(state_dict['config'])
    if (('optimizer' in state_dict) and load_optimizer):
        self.optimizer.load_state_dict(state_dict['optimizer'])
    return self