def train(): opt = Options().parse() opt.baseline = True print("Model Config: ", opt) model = Model(opt) model.train()
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)
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)
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