Пример #1
0
def train():
    opt = Options().parse()
    opt.baseline = True
    print("Model Config: ", opt)

    model = Model(opt)
    model.train()
Пример #2
0
def eval_baseline(weight):
    opt = Options().parse()
    opt.baseline = True
    opt.sequence_length = 20
    print("Model Config: ", opt)
    model = Model(opt)
    model.load_weight(weight)
    return model.evaluate(0, keep_frame=False)
Пример #3
0
def eval_baseline(weight, behavior):
    opt = Options().parse()
    opt.baseline = True
    opt.sequence_length = 20
    opt.behavior_layer = 0
    opt.data_dir = '../data/' + behavior
    print("Model Config: ", opt)
    model = Model(opt)
    model.load_weight(weight)
    return model.evaluate(0, keep_frame=True)
Пример #4
0
def predict_baseline(weight, filelist):

    opt = Options().parse()
    opt.baseline = True
    opt.sequence_length = 20
    print("Model Config: ", opt)
    model = Model(opt)
    model.load_weight(weight)
    resultlist, _ = model.predict(filelist)
    resultlist = [[(frame.squeeze().permute([1,2,0]).cpu().detach().numpy()*255).astype(np.uint8) for frame in result]
                  for result in resultlist]
    return resultlist