def test_2Dexperiment(): c = Config() c.batch_size = 200 c.n_epochs = 40 c.learning_rate = 0.001 if torch.cuda.is_available(): c.use_cuda = True else: c.use_cuda = False c.rnd_seed = 1 c.log_interval = 200 # model-specific c.n_coupling = 8 c.prior = 'gauss' exp = SmileyExperiment( c, name='gauss', n_epochs=c.n_epochs, seed=42, base_dir='experiment_dir', loggers={'visdom': ['visdom', { "exp_name": "myenv" }]}) exp.run() # sampling samples = exp.model.sample(1000).cpu().numpy() sns.jointplot(samples[:, 0], samples[:, 1]) plt.show()
def test_MNIST_experiment(): c = Config() c.batch_size = 64 c.n_epochs = 50 c.learning_rate = 0.001 c.weight_decay = 5e-5 if torch.cuda.is_available(): c.use_cuda = True else: c.use_cuda = False c.rnd_seed = 1 c.log_interval = 100 c.subset_size = 10 # model-specific c.n_coupling = 8 c.n_filters = 64 exp = MNISTExperiment( c, name='mnist_test', n_epochs=c.n_epochs, seed=42, base_dir='experiment_dir', loggers={'visdom': ['visdom', { "exp_name": "myenv" }]}) exp.run() exp.model.eval() exp.model.to('cpu') with torch.no_grad(): samples = exp.model.sample(16, device='cpu') img_grid = make_grid(samples).permute((1, 2, 0)) plt.imshow(img_grid) plt.show() return exp.model
def test_Resnet(): c = Config() c.batch_size = 64 c.batch_size_test = 1000 c.n_epochs = 10 c.learning_rate = 0.01 c.momentum = 0.9 if torch.cuda.is_available(): c.use_cuda = True else: c.use_cuda = False c.rnd_seed = 1 c.log_interval = 200 exp = MNIST_classification(config=c, name='experiment', n_epochs=c.n_epochs, seed=42, base_dir='./experiment_dir', loggers={"visdom": "visdom"}) exp.run()
def get_config(): c = Config() c.batch_size = 6 c.patch_size = 512 c.n_epochs = 20 c.learning_rate = 0.0002 c.do_ce_weighting = True c.do_batchnorm = True if torch.cuda.is_available(): c.use_cuda = True else: c.use_cuda = False c.rnd_seed = 1 c.log_interval = 200 c.base_dir='/media/kleina/Data2/output/meddec' c.data_dir='/media/kleina/Data2/Data/meddec/Task07_Pancreas_expert_preprocessed' c.split_dir='/media/kleina/Data2/Data/meddec/Task07_Pancreas_preprocessed' c.data_file = 'C:/dev/data/Endoviz2018/GIANA/polyp_detection_segmentation/image_gt_data_file_list_all_640x640.csv' c.additional_slices=5 c.name='' print(c) return c
import numpy as np import torch from trixi.util import Config from experiment import MNISTexperiment from util import plot_dependency_map import matplotlib.pyplot as plt c = Config() c.batch_size = 128 c.n_epochs = 10 c.learning_rate = 0.001 if torch.cuda.is_available(): c.use_cuda = True else: c.use_cuda = False c.rnd_seed = 1 c.log_interval = 100 exp = MNISTexperiment(config=c, name='test', n_epochs=c.n_epochs, seed=c.rnd_seed, base_dir='./experiment_dir', loggers={"visdom": ["visdom", { "exp_name": "myenv" }]}) # # run backpropagation for each dimension to compute what other # # dimensions it depends on. # exp.setup() # d = 28