junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.8k stars 6.29k forks source link

Error testing my own dataset using pix2pix #1638

Open Rentong2022 opened 6 months ago

Rentong2022 commented 6 months ago

After training my dataset with pix2pix, I wanted to test it, but encountered the following issue: Traceback (most recent call last): File "C:\Users\o\Desktop\Graduation_Design_Code\pytorch-pix2pixgan\pytorch-CycleGAN-and-pix2pix-master\test.py", line 52, in model.setup(opt) # regular setup: load and print networks; create schedulers File "C:\Users\o\Desktop\Graduation_Design_Code\pytorch-pix2pixgan\pytorch-CycleGAN-and-pix2pix-master\models\base_model.py", line 88, in setup self.load_networks(load_suffix) File "C:\Users\o\Desktop\Graduation_Design_Code\pytorch-pix2pixgan\pytorch-CycleGAN-and-pix2pix-master\models\base_model.py", line 210, in load_networks for key in list(state_dict.keys()): # need to copy keys here because we mutate in loop File "D:\anaconda\envs\rt\lib\site-packages\torch\nn\modules\module.py", line 1207, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'UnetGenerator' object has no attribute 'keys' How should I solve it? Thank you all