Exemple #1
0
from __future__ import print_function
import os,sys,inspect

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
sys.path.insert(0,parentdir)

from utils.args import args

import setup.categories.ae_setup as AESetup
from models.autoencoders import *
from datasets.NIH_Chest import NIHChestBinaryTrainSplit

if __name__ == "__main__":
    dataset = NIHChestBinaryTrainSplit(root_path=os.path.join(args.root_path, "NIHCC"), binary=True, expand_channels=False, downsample=64)
    model = Generic_VAE(dims=(1, 64, 64), max_channels=512, depth=12, n_hidden=512)
    #model = ALILikeVAE(dims=(1, 64, 64))
    AESetup.train_variational_autoencoder(args, model=model, dataset=dataset.get_D1_train(), BCE_Loss=False)

Exemple #2
0
from __future__ import print_function
import os, sys, inspect

currentdir = os.path.dirname(
    os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
sys.path.insert(0, parentdir)

from utils.args import args

import setup.categories.ae_setup as AESetup
from models.autoencoders import Generic_VAE, Generic_AE, Residual_AE
from datasets.NIH_Chest import NIHChestBinaryTrainSplit

if __name__ == "__main__":
    dataset = NIHChestBinaryTrainSplit(root_path=os.path.join(
        args.root_path, "NIHCC"),
                                       binary=True,
                                       expand_channels=False,
                                       downsample=64)
    model = Residual_AE(dims=(1, 64, 64))
    AESetup.train_autoencoder(args,
                              model=model,
                              dataset=dataset.get_D1_train(),
                              BCE_Loss=False)
currentdir = os.path.dirname(
    os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
sys.path.insert(0, parentdir)

import models as Models
import global_vars as Global
from utils.args import args

import categories.classifier_setup as CLSetup
from models.classifiers import NIHDenseBinary, NIHChestVGG
from datasets.NIH_Chest import NIHChestBinaryTrainSplit

if __name__ == "__main__":
    dataset = NIHChestBinaryTrainSplit(root_path=os.path.join(
        args.root_path, "NIHCC"),
                                       binary=True)
    model = NIHChestVGG()
    CLSetup.train_classifier(args, model=model, dataset=dataset.get_D1_train())

    # task_list = [
    #     # The list of models,   The function that does the training,    Can I skip-test?,   suffix of the operation.
    #     # The procedures that can be skip-test are the ones that we can determine
    #     # whether we have done them before without instantiating the network architecture or dataset.
    #     # saves quite a lot of time when possible.
    #     (Global.dataset_reference_classifiers, CLSetup.train_classifier,            True, ['base0']),
    #     (Global.dataset_reference_classifiers, KLogisticSetup.train_classifier,     True, ['KLogistic']),
    #     (Global.dataset_reference_classifiers, DeepEnsembleSetup.train_classifier,  True, ['DE.%d'%i for i in range(5)]),
    #     (Global.dataset_reference_autoencoders, AESetup.train_BCE_AE,               False, []),
    #     (Global.dataset_reference_autoencoders, AESetup.train_MSE_AE,               False, []),
    #     (Global.dataset_reference_vaes, AESetup.train_variational_autoencoder,      False, []),
Exemple #4
0
        'bceaeknn/1',
        'vaemseaeknn/2',
        'vaebceaeknn/2',
        'mseaeknn/2',
        'bceaeknn/2',
        'vaemseaeknn/4',
        'vaebceaeknn/4',
        'mseaeknn/4',
        'bceaeknn/4',
        'vaemseaeknn/8',
        'vaebceaeknn/8',
        'mseaeknn/8',
        'bceaeknn/8',
    ]

    D1 = NIHChestBinaryTrainSplit(
        root_path=os.path.join(args.root_path, 'NIHCC'))
    D164 = NIHChestBinaryTrainSplit(root_path=os.path.join(
        args.root_path, 'NIHCC'),
                                    downsample=64)
    args.D1 = 'NIHCC'

    #Usecase 1 Evaluation
    d2s = [
        'CIFAR10',
        'UniformNoise',
        'MURAHAND',
    ]
    D2s = []
    for d2 in d2s:
        dataset = Global.all_datasets[d2]
        if 'dataset_path' in dataset.__dict__:
from __future__ import print_function
import os, sys, inspect
from termcolor import colored
import torch
currentdir = os.path.dirname(
    os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
sys.path.insert(0, parentdir)

import models as Models
import global_vars as Global
from utils.args import args

import categories.classifier_setup as CLSetup
from models.classifiers import NIHDenseBinary
from datasets.NIH_Chest import NIHChestBinaryTrainSplit

if __name__ == "__main__":
    dataset = NIHChestBinaryTrainSplit(root_path=os.path.join(
        args.root_path, "NIHCC"),
                                       binary=True)
    model = NIHDenseBinary("mono_model.pth.tar")
    CLSetup.train_classifier(args,
                             model=model,
                             dataset=dataset.get_D1_train(),
                             balanced=True)