Exemplo n.º 1
0
def main_train() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_08_1')

    model = CNNAugDataRegularized((32, 64, 128, 256), (1024, 128), 4, device)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    model.train(data, 60, 20, tracker, learning_rate=0.0001)

    tracker.graphs()
    tracker.save('metrics.csv')
def main_train() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_26_2')

    model = TransferCNN(device)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    model.train(data, 20, 20, tracker, learning_rate = 0.0001)
    
    tracker.graphs()
    tracker.save('metrics.csv')
def main_try() -> None:
    train_X, train_y, val_X, val_y = get_128px_train_data()
    tracker = PerformanceTracker(
        os.path.join('modelling', 'model_2020_03_31_1'))
    model.train((train_X, train_y),
                45,
                10,
                val=(val_X, val_y),
                tracker=tracker)

    tracker.graphs()
    tracker.save('metrics.csv')
Exemplo n.º 4
0
def main_train() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_26_1')

    conv_filter_nums = (16, 32, 64, 64, 128, 128)
    neuron_nums = (512, 128)

    model = BigCNN(conv_filter_nums, neuron_nums, device)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    model.train(data, 40, 20, tracker, learning_rate=0.0001)

    tracker.graphs()
    tracker.save('metrics.csv')
def main_train() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_25_1')

    model = DropoutCNN((32, 64, 128, 256), (512, 128),
                       4,
                       device,
                       drop_dense_p=0.2,
                       drop_conv_p=0.2)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    model.train(data, 40, 20, tracker, learning_rate=0.0001)

    tracker.graphs()
    tracker.save('metrics.csv')
Exemplo n.º 6
0
def main() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_05_10_1')

    model = VGGStyleNet(4, device)
    summary(model.cuda(), (3, 128, 128))
    print(model)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    model.train(data, 40, 64, tracker, learning_rate=0.00001)

    tracker.graphs()
    tracker.save('metrics.csv')

    test_X, imgs_ids = data.get_test()
    pred_y = model.predict(test_X)
    create_submit(pred_y, imgs_ids, path.join(save_dir, 'submission.csv'))
Exemplo n.º 7
0
def main() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_05_10_2')
    batch_size = 64
    epochs = 15

    model = VGGStyleBNNet(4, device)
    summary(model.cuda(), (3, 128, 128))
    print(model)
    data = FirstAugmentedDataset()
    tracker = PerformanceTracker(save_dir)
    try:
        model.train(data, epochs, batch_size, tracker, learning_rate=0.001)
    except KeyboardInterrupt:
        print('Training interrupted, writing stats...')
    finally:
        tracker.graphs()
        tracker.save('metrics.csv')

    test_X, imgs_ids = data.get_test()
    pred_y = model.predict(test_X, batch_size)
    create_submit(pred_y, imgs_ids, path.join(save_dir, 'submission.csv'))