Beispiel #1
0
            )

        if "_rand" in file or "retraininit" in file:
            for i, grapher in enumerate(graphers[:6]):
                percentage_y = bool((i + 1) % 3)
                grapher.graph(
                    percentage_x=True,
                    percentage_y=percentage_y,
                    store=False,
                    show_ref=False,
                    show_delta=False,
                    remove_outlier=False,
                )
                if percentage_y:
                    # grapher._figure.gca().set_xlim([50, 99])
                    grapher._figure.gca().set_ylim([80, 95])

    return results, params, labels, graphers


# get a logger
logger = experiment.Logger()

# get the results specified in the file (and hopefully pre-computed)
results, params, labels, graphers = get_results(FILE, logger)

# %% show the results
for grapher in graphers:
    grapher._figure.show()
    grapher.store_plot()
Beispiel #2
0
PARAM = next(util.file.get_parameters(FILE, 1, 0))

# store mean and std dev for later
if "ImageNet" in PARAM["network"]["dataset"]:
    MEAN_C = [0.485, 0.456, 0.406]
    STD_C = [0.229, 0.224, 0.225]
elif "CIFAR" in PARAM["network"]["dataset"]:
    MEAN_C = [0.4914, 0.4822, 0.4465]
    STD_C = [0.2023, 0.1994, 0.2010]
else:
    raise ValueError("Please adapt script to provide normalization of dset!")
MEAN_C = np.asarray(MEAN_C)[:, np.newaxis, np.newaxis]
STD_C = np.asarray(STD_C)[:, np.newaxis, np.newaxis]

# Now initialize the logger
LOGGER = experiment.Logger()
LOGGER.initialize_from_param(PARAM)

# Initialize the evaluator and run it (will return if nothing to compute)
COMPRESSOR = experiment.Evaluator(LOGGER)
COMPRESSOR.run()

# device settings
torch.cuda.set_device("cuda:0")
DEVICE = torch.device("cuda:0")
DEVICE_STORAGE = torch.device("cpu")

# Generate all the models we like.
# get a list of models
MODELS = [COMPRESSOR.get_all(**kw) for kw in MODELS_ALL_DESCRIPTION]
IDX_RANGES = []