示例#1
0
def train(net: SiameseEMG):
    gesture_list = list(range(8))
    train_set = CapgTriplet(gesture_list,
                            sequence_len=20,
                            frame_x=False,
                            train=True)
    net.dataset = train_set
    net.fit_with_dataset()
    return net
示例#2
0
def main(train_args):
    # 1. 设置好optimizer
    # 2. 定义好model
    args = {**train_args, **hyperparameters}
    all_gestures = list(range(8))

    model = SiameseLSTM(args['input_size'], args['hidden_size'],
                        len(all_gestures), args['layer'], args['dropout'])
    name = args['name']
    sub_folder = args['sub_folder']

    # from emg.utils import config_tensorboard
    # tensorboard_cb = config_tensorboard(name, sub_folder, model, (1, 10, 128))
    #
    # from emg.utils.lr_scheduler import DecayLR
    # lr_callback = DecayLR(start_lr=args['lr'], gamma=0.5, step_size=args['lr_step'])

    net = SiameseEMG(module=model,
                     model_name=name,
                     sub_folder=sub_folder,
                     hyperparamters=args,
                     optimizer=torch.optim.Adam,
                     gesture_list=[],
                     callbacks=[])

    net = train(net)
示例#3
0
def main(train_args, TEST_MODE=False):
    args = train_args
    all_gestures = list(range(20))

    model = SiameseCNN(len(all_gestures))
    name = args['name']
    sub_folder = args['sub_folder']

    # from emg.utils import config_tensorboard
    # tensorboard_cb = config_tensorboard(name, sub_folder)
    #
    # from emg.utils.lr_scheduler import DecayLR
    # lr_callback = DecayLR(start_lr=args['lr'], gamma=0.5, step_size=args['lr_step'])

    net = SiameseEMG(module=model,
                     model_name=name,
                     sub_folder=sub_folder,
                     hyperparamters=args,
                     optimizer=torch.optim.Adam,
                     gesture_list=[],
                     callbacks=[])

    net = train(net)