jingyuanli001 / RFR-Inpainting

The source code for CVPR 2020 accepted paper "Recurrent Feature Reasoning for Image Inpainting"
MIT License
358 stars 76 forks source link

May some problem in model.py?? #6

Closed Zhijun-Yu closed 4 years ago

Zhijun-Yu commented 4 years ago

when i train/test model,arise some problem about load pretrained model .The code in model.py as follow def initialize_model(self, path=None, train=True): self.G = RFRNet() if train: self.lossNet = VGG16FeatureExtractor() self.optm_G = optim.Adam(self.G.parameters(), lr = 2e-4) try: start_iter = load_ckpt(path, [('generator', self.G)], [('optimizer_G', self.optm_G)]) print("here") if train: self.optm_G = optim.Adam(self.G.parameters(), lr = 2e-4) print('Model Initialized, iter: ', start_iter) self.iter = start_iter except: print('No trained model, from start')

,and in utils.io---->load_ckpt(),the code as follow

if optimizers is not None: for prefix, optimizer in optimizers: optimizer.load_state_dict(ckpt_dict[prefix])

may self.optm_G = optim.Adam(self.G.parameters(), lr = 2e-4) should be writen in try???otherwise self.optm_G will be None ,and pretrained model cannot be load .