Exemple #1
0
def FinalTest():
    dataset = 'cus_mnist'
    # dataroot = './data/cus_mnist'
    opt = Options().parse(dataset)
    opt.isTrain = False
    opt.load_weights = True

    ##
    # LOAD DATA
    dataloader = load_data(opt)
    print(opt)
    ##
    # LOAD MODEL
    model = Ganomaly(opt, dataloader)
    ##
    # TRAIN MODEL
    # model.train()
    minVal = None
    maxVal = None
    threshold = None
    with open(opt.dataroot + '/performance.txt', 'r+', encoding='utf-8') as f:
        res = f.readline()
        res = res.split('&')
        res = [float(i) for i in res]
        minVal = res[0]
        maxVal = res[1]
        threshold = res[2]

    model.FinalTest(minVal, maxVal, threshold)
Exemple #2
0
 def run(self):
     # self.option.isize = 128
     self.dataloader = load_data(self.option)
     model = Ganomaly(self.option, self.dataloader)
     minVal = self.modelData[0]
     maxVal = self.modelData[1]
     threshold = self.modelData[2]
     resNor, resAbn = model.FinalTest(minVal, maxVal, threshold)
     opt = {}
     opt['path'] = self.option.dataroot
     opt['modelName'] = self.option.dataset
     self.option.signal.emit(copy.deepcopy(resNor), copy.deepcopy(resAbn), copy.deepcopy(opt))
Exemple #3
0
    def run(self):
        opt = self.opt

        # model.testOne()
        model = Ganomaly(self.opt, self.dataloader)
        ##
        # TRAIN MODEL
        # model.train()
        minVal = None
        maxVal = None
        threshold = None
        with open(opt.dataroot + '/performance.txt', 'r+', encoding='utf-8') as f:
            res = f.readline()
            res = res.split('&')
            res = [float(i) for i in res]
            minVal = res[0]
            maxVal = res[1]
            threshold = res[2]

        model.FinalTest(minVal, maxVal, threshold)