receptive_field = model.base.receptive_field()
pad = (receptive_field - 1)
causal_shift = pad

# initialise everything
actions, out_poses_2d, from_clip_flgs, return_idx, ratings, filenames_final, targets = load_keypoints(
    kpfile_1,
    kpfile_2,  # todo
    rating_file,
    seed,
    None)

generator = SimpleSiameseGenerator(batch_size,
                                   targets,
                                   out_poses_2d,
                                   ratings,
                                   pad=pad,
                                   causal_shift=causal_shift,
                                   test_split=split_ratio,
                                   random_seed=seed)  # todo

loss_fun = CombinedLoss(nn.CrossEntropyLoss(),
                        weighting,
                        supress_cl=supress_cl,
                        margin=loss_margin)
train_parameters = list(model.embedding.parameters()) + list(
    model.classifier.parameters())
optimizer = optim.Adam(train_parameters, lr, amsgrad=True)
losses_train = []
losses_test = []

# run training
예제 #2
0
causal_shift = pad

# initialise everything
actions, out_poses_2d,from_clip_flgs, return_idx, ratings, filenames_final, targets = load_keypoints(kpfile_1,kpfile_2, # todo
                                                                    rating_file,seed,None)
# action_ucf, poses_ucf, files_ucf = fetch_openpose_keypoints(ucf_file)
# action_ucf = [action if action!=8 else 6 for action in action_ucf]
# poses_ucf = [p for a,p in zip(action_ucf,poses_ucf) if a==6]
# files_ucf = [f for a,f in zip(action_ucf,files_ucf) if a==6]
# action_ucf = [action for action in action_ucf if action==6]
# filenames_ucf = [f'ucf_{x}' for x in files_ucf ]
# action_ucf, poses_ucf, filenames_ucf = action_ucf[:50], poses_ucf[:50], filenames_ucf[:50]
# ratings_ucf = [9] * len(action_ucf)

# targets += action_ucf
# out_poses_2d += poses_ucf
# ratings += ratings_ucf
# filenames_final += filenames_ucf

generator = SimpleSiameseGenerator(batch_size, targets, out_poses_2d,ratings,model2,filenames_final, pad=pad,
                 causal_shift=causal_shift, test_split=split_ratio, random_seed=seed,just_emb=True) # todo

model = SimpleRegression([128,64,32])
loss_fun = nn.MSELoss()
optimizer = optim.RMSprop(model.parameters(),lr)
losses_train = []
losses_test = []

# run training
train_model(model,epoch,epochs,lr,lr_decay)
neptune.stop()