xaggi / OGNet

Code for the CVPR 2020 paper 'Old is Gold: Redefining the Adversarially Learned One-Class Classifier Training Paradigm'
MIT License
88 stars 16 forks source link

UnboundLocalError: local variable 'd_model_save_path' referenced before assignment #9

Open ltl476 opened 2 years ago

ltl476 commented 2 years ago

Training until high epoch... Epoch 3 / Iteration 0, before phase two: AUC: 0.464402875861, EER: 0.526548672566, EER_thr: 0.999987721443, F1_score: 0.265179677819 Traceback (most recent call last): File "train.py", line 25, in model.train(opt.normal_class) File "/content/gdrive/MyDrive/OGNet-master/model.py", line 146, in train fine_tune() #Phase two File "/content/gdrive/MyDrive/OGNet-master/fine_tune_dicriminator.py", line 24, in fine_tune model.train(load_model_epoch, model_folder_path) File "/content/gdrive/MyDrive/OGNet-master/model_fine_tune_discriminator.py", line 116, in train return d_model_save_path, g_model_save_path UnboundLocalError: local variable 'd_model_save_path' referenced before assignment

I had this problem while training the Oldisgold model.Could you please help me to slove this? Thank you sincerely and best wishes.

yty20 commented 2 years ago

I've run into this problem, too. Find the file where d_model_save_path defined, it is defined inside a if statement, and you need to define it outside the statement or check if it exist when using it.

ltl476 commented 2 years ago

I've run into this problem, too. Find the file where d_model_save_path defined, it is defined inside a if statement, and you need to define it outside the statement or check if it exist when using it.

First, thank you for your help,I 've found the d_model_save_path defined in model.py and model_fine_tune_discriminator.py.Then I defined it outside the if statement,however,it doesn't seem to work.Could you send me your modified py codes please?That'll help me a lot.