knazeri / edge-connect

EdgeConnect: Structure Guided Image Inpainting using Edge Prediction, ICCV 2019 https://arxiv.org/abs/1901.00212
http://openaccess.thecvf.com/content_ICCVW_2019/html/AIM/Nazeri_EdgeConnect_Structure_Guided_Image_Inpainting_using_Edge_Prediction_ICCVW_2019_paper.html
Other
2.5k stars 528 forks source link

Weights init error #154

Open miaodd98 opened 4 years ago

miaodd98 commented 4 years ago

Hello, I modified your model with other convolution models. When training the modified model, weight initialization function throws out an error:

Traceback (most recent call last): File "train.py", line 2, in main(mode=1) File "/home/mw/Desktop/codes/edge-connect-RNB+L/main.py", line 48, in main model = EdgeConnect(config) File "/home/mw/Desktop/codes/edge-connect-RNB+L/src/edge_connect.py", line 29, in init self.inpaint_model = InpaintingModel(config).to(config.DEVICE) File "/home/mw/Desktop/codes/edge-connect-RNB+L/src/models.py", line 159, in init generator = InpaintGenerator() File "/home/mw/Desktop/codes/edge-connect-RNB+L/src/networks.py", line 110, in init self.init_weights() File "/home/mw/Desktop/codes/edge-connect-RNB+L/src/networks.py", line 36, in init_weights self.apply(init_func) File "/home/mw/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 287, in apply module.apply(fn) File "/home/mw/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 287, in apply module.apply(fn) File "/home/mw/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 287, in apply module.apply(fn) File "/home/mw/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 288, in apply fn(self) File "/home/mw/Desktop/codes/edge-connect-RNB+L/src/networks.py", line 33, in initfunc nn.init.normal(m.weight.data, 1.0, gain) AttributeError: 'NoneType' object has no attribute 'data'

It seems that something is wrong with weight initialization, anyone got any ideas? Many Thanks!