Skip to content

Commit

Permalink
Update ood.py
Browse files Browse the repository at this point in the history
  • Loading branch information
iCGY96 authored Nov 1, 2022
1 parent afb0189 commit 728eadb
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ood.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,13 @@ def main():
results = test(net, criterion, testloader, outloader, epoch=epoch, **options)
print("Acc (%): {:.3f}\t AUROC (%): {:.3f}\t OSCR (%): {:.3f}\t".format(results['ACC'], results['AUROC'], results['OSCR']))

if results['AUROC'] + results['ACC'] > score_now:
score_now = results['AUROC'] + results['ACC']
save_networks(net, model_path, file_name, criterion=criterion)
if options['cs']:
save_GAN(netG, netD, model_path, file_name)
fake = netG(fixed_noise)
GAN_path = os.path.join(model_path, 'samples')
mkdir_if_missing(GAN_path)
vutils.save_image(fake.data, '%s/gan_samples_epoch_%03d.png'%(GAN_path, epoch), normalize=True)
save_networks(net, model_path, file_name, criterion=criterion)
if options['cs']:
save_GAN(netG, netD, model_path, file_name)
fake = netG(fixed_noise)
GAN_path = os.path.join(model_path, 'samples')
mkdir_if_missing(GAN_path)
vutils.save_image(fake.data, '%s/gan_samples_epoch_%03d.png'%(GAN_path, epoch), normalize=True)

if options['stepsize'] > 0: scheduler.step()

Expand Down

0 comments on commit 728eadb

Please sign in to comment.