コード例 #1
0
def start(args):
    if args.order == 'train':
        train(args)
    elif args.order == 'valid':
        valid(args)
        compute_mAP(args)
        draw(args, 'loss')
    elif args.order == 'draw':
        draw(args)
コード例 #2
0
def train():
    if request.method == 'POST':
        dt = {'dataset_dir': request.form['dataset_dir']}
    else:
        dt = {'dataset_dir': request.args.get('dir')}

    return operations.train(dt)
コード例 #3
0
def start():
    args = set_global_variables()
    import operations
    if args.order == 'train':
        operations.train(args)
        print("#------train process is over!------#")
    elif args.order == 'valid':
        args.draw_option = 'mAP'
        operations.valid(args)
        operations.compute(args)
        operations.draw(args)
        print("#------valid process is over!------#")
    elif args.order == 'draw':
        operations.draw(args)
    elif args.order == 'compute':
        if args.compute_step is None:
            print("The compute_step cannot be None!")
            exit()
        operations.compute(args)
コード例 #4
0
    print(net)

    print()

    avg_train_loss = 0
    avg_train_acc = 0
    avg_val_loss = 0
    avg_val_acc = 0

    loaders = get_strange_symbol_loader_with_validation(
        batch_size=args.batch_size, validation_split=args.s)

    train_loader, val_loader = loaders
    train_stats = train(net,
                        train_loader,
                        args.learning_rate,
                        args.momentum,
                        epochs=args.epochs,
                        epslon=args.epslon)

    print('[TRAINING] Final loss', train_stats[0])
    print('[TRAINING] Final acc', train_stats[1])

    avg_val_loss, avg_val_acc = validate(net, val_loader)

    print('[VALIDATION] Final loss', avg_val_loss)
    print('[VALIDATION] Final acc', avg_val_acc)

    print()

    predictions = []
    labels = []