Пример #1
0
def parse_args():
    parser = argparse.ArgumentParser(
        description="Train classification models on ImageNet",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    models.add_model_args(parser)
    fit.add_fit_args(parser)
    data.add_data_args(parser)
    dali.add_dali_args(parser)
    data.add_data_aug_args(parser)
    return parser.parse_args()
Пример #2
0
def main():
    parser = argparse.ArgumentParser(
        description='train unet',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    fit.add_fit_args(parser)
    seed = 2012310818
    np.random.seed(seed)
    parser.set_defaults(batch_size=16,
                        num_epochs=40,
                        lr=0.0001,
                        optimizer='adam'
                        # lr_step_epochs='10',
                        # lr_factor = 0.8
                        )
    args = parser.parse_args()
    kv = mx.kvstore.create(args.kv_store)

    unet = segnet(workspace=workspace)
    train, val, lt, lv = data_iter(args, kv)
    fit.fit(args, unet[2], data_iter)
Пример #3
0
                        help='the number of classes')
    parser.add_argument('--num-examples',
                        type=int,
                        default=60000,
                        help='the number of training examples')

    parser.add_argument(
        '--add_stn',
        action="store_true",
        default=False,
        help='Add Spatial Transformer Network Layer (lenet only)')
    parser.add_argument('--image_shape',
                        default='1, 28, 28',
                        help='shape of training images')

    fit.add_fit_args(parser)

    choose_labels = [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]

    for index, choose_label in enumerate(choose_labels):
        if index == 0:
            train_mission_first(parser=parser,
                                choose_label=choose_label,
                                save_dir_thistime=list_to_str(choose_label))
        else:
            model, reg_params = train_mission_second_update_omega(
                parser=parser,
                choose_label_lasttime=choose_labels[index - 1],
                choose_label=choose_label,
                save_dir_lasttime=list_to_str(choose_labels[index - 1]),
                save_dir_thistime=list_to_str(choose_label),