def main_train() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_29_1')

    model = StrideCNN((16, 32, 64, 256), (512, 128), 4, device)
    print(model)
    summary(model.cuda(), (3, 128, 128))
Пример #2
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')
Пример #4
0
def main_predict() -> None:
    detect_gpu()
    device = get_device()
    save_dir = path.join('modelling', 'model_2020_04_08_2')

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

    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'))
Пример #5
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')
def main_predict() -> 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, 30, 20, tracker, learning_rate=0.0001)

    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'))
Пример #8
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'))
Пример #9
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'))
# Python libraries
import os

# Internal modules
from util.get_128px_data import get_128px_test_data, get_128px_train_data
from util.use_gpu import detect_gpu, get_device
from modelling.model_2020_03_31_1.ConvolutionalNeuralNet import ConvolutionalNeuralNet
from util.PerformanceTracker import PerformanceTracker
from util.create_submit import create_submit

detect_gpu()
device = get_device()
model = ConvolutionalNeuralNet((64, 128, 512, 1024), (1024, 1024), 4, device)


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')


def main_full() -> None:
    train_X, train_y, val_X, val_y = get_128px_train_data(val_size=2)