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.PCAM import PCAM if __name__ == "__main__": dataset = PCAM(root_path=os.path.join(args.root_path, "pcam"), extract=True, downsample=64) model = ALILikeVAE(dims=(3, 64, 64)) AESetup.train_variational_autoencoder(args, model=model, dataset=dataset.get_D1_train(), BCE_Loss=False)
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.PCAM import PCAM if __name__ == "__main__": dataset = PCAM(root_path=os.path.join(args.root_path, "pcam"), extract=True, downsample=64) model = ALILikeVAE(dims=(3, 64, 64)) AESetup.train_variational_autoencoder(args, model=model, dataset=dataset.get_D1_train(), BCE_Loss=True)
'bceaeknn/1', 'vaemseaeknn/8', 'vaebceaeknn/8', 'mseaeknn/8', 'bceaeknn/8', 'alivaemseaeknn/1', 'alivaebceaeknn/1', 'alimseaeknn/1', 'alibceaeknn/1', 'alivaemseaeknn/8', 'alivaebceaeknn/8', 'alimseaeknn/8', 'alibceaeknn/8', ] D1 = PCAM(root_path=os.path.join(args.root_path, 'pcam'), downsample=224) D164 = PCAMResize(D1, 64) args.D1 = 'PCAM' All_ODs = [ 'UniformNoise', 'NormalNoise', 'MNIST', 'FashionMNIST', 'NotMNIST', 'CIFAR100', 'CIFAR10', 'STL10', 'TinyImagenet', 'Malaria',
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.classifier_setup as CLSetup from models.classifiers import PCAMDense from datasets.PCAM import PCAM if __name__ == "__main__": dataset = PCAM(root_path=os.path.join(args.root_path, "pcam"), extract=True, downsample=224) model = PCAMDense("densenet121-a639ec97.pth", train_features=True) CLSetup.train_classifier(args, model=model, dataset=dataset.get_D1_train(), balanced=True)