Exemple #1
0
import seaborn as sns
import tikzplotlib
from tqdm import tqdm, trange
import torch.utils.data as data_utils

parser = argparse.ArgumentParser()
parser.add_argument('--randseed', type=int, default=123)
args = parser.parse_args()

train_loader = dl.CIFAR10(train=True, augm_flag=False)
val_loader, test_loader = dl.CIFAR10(train=False, val_size=2000)
targets = torch.cat([y for x, y in test_loader], dim=0).numpy()
print(len(train_loader.dataset), len(val_loader.dataset),
      len(test_loader.dataset))

test_loader_SVHN = dl.SVHN(train=False)
test_loader_LSUN = dl.LSUN_CR(train=False)

tab_ood = {
    'CIFAR10 - CIFAR10': [],
    'CIFAR10 - SVHN': [],
    'CIFAR10 - LSUN': [],
    'CIFAR10 - FarAway': [],
    'CIFAR10 - Adversarial': [],
    'CIFAR10 - FarAwayAdv': []
}

tab_cal = {'DKL': ([], [])}

delta = 2000
Exemple #2
0
import numpy as np
import argparse
import pickle
import os, sys
import matplotlib.pyplot as plt
import seaborn as sns
import tikzplotlib
from tqdm import tqdm, trange
import torch.utils.data as data_utils
from util.plotting import plot_histogram

parser = argparse.ArgumentParser()
parser.add_argument('--randseed', type=int, default=123)
args = parser.parse_args()

train_loader = dl.SVHN(train=True, augm_flag=False)
val_loader, test_loader = dl.SVHN(train=False, val_size=2000)
targets = torch.cat([y for x, y in test_loader], dim=0).numpy()
print(len(train_loader.dataset), len(val_loader.dataset),
      len(test_loader.dataset))

test_loader_CIFAR10 = dl.CIFAR10(train=False)
test_loader_LSUN = dl.LSUN_CR(train=False)

tab_ood = {
    'SVHN - SVHN': [],
    'SVHN - CIFAR10': [],
    'SVHN - LSUN': [],
    'SVHN - FarAway': [],
    'SVHN - Adversarial': [],
    'SVHN - FarAwayAdv': []