zychen-ustc / PSD-Principled-Synthetic-to-Real-Dehazing-Guided-by-Physical-Priors

Zeyuan Chen, Yangchao Wang, Yang Yang and Dong Liu. "PSD: Principled Synthetic-to-Real Dehazing Guided by Physical Priors". IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
MIT License
120 stars 19 forks source link

预训练问题 #12

Closed chenxiG closed 2 years ago

chenxiG commented 2 years ago

您好,感谢为图像去雾提供了一个很好的解决思路,向您表示真挚的感谢。但是在运行main.py的时候,选择的是FFANet,前面DATALOADER的时候是正确的,输出的:DATALOADER ### DONE!也开了第一个Epoch,但是之后就开始报错了,具体的显示如下(为了验证可行性,只选择了34张照片进行训练): DATALOADER DONE! Epoch: 0, Iteration: 0, Loss: 0.14289504289627075, Rec_Loss1: 0.05949130654335022, Rec_loss2: 0.08340374380350113 Epoch: 0, Iteration: 1, Loss: 0.04430900514125824, Rec_Loss1: 0.02571740560233593, Rec_loss2: 0.01859159767627716 Epoch: 0, Iteration: 2, Loss: 0.1531301736831665, Rec_Loss1: 0.07720714807510376, Rec_loss2: 0.07592301815748215 Epoch: 0, Iteration: 3, Loss: 0.04206860437989235, Rec_Loss1: 0.014385269023478031, Rec_loss2: 0.027683334425091743 Epoch: 0, Iteration: 4, Loss: 0.024794980883598328, Rec_Loss1: 0.018735533580183983, Rec_loss2: 0.0060594468377530575 Epoch: 0, Iteration: 5, Loss: 0.02767857350409031, Rec_Loss1: 0.004832420963793993, Rec_loss2: 0.022846153005957603 Epoch: 0, Iteration: 6, Loss: 0.05871203541755676, Rec_Loss1: 0.02811766229569912, Rec_loss2: 0.030594373121857643 Epoch: 0, Iteration: 7, Loss: 0.05164826288819313, Rec_Loss1: 0.024732043966650963, Rec_loss2: 0.026916218921542168 Epoch: 0, Iteration: 8, Loss: 0.059729255735874176, Rec_Loss1: 0.0336235910654068, Rec_loss2: 0.026105666533112526 Epoch: 0, Iteration: 9, Loss: 0.03006775490939617, Rec_Loss1: 0.013887450098991394, Rec_loss2: 0.016180304810404778 Epoch: 0, Iteration: 10, Loss: 0.02384977787733078, Rec_Loss1: 0.011282042600214481, Rec_loss2: 0.012567736208438873 Epoch: 0, Iteration: 11, Loss: 0.028310412541031837, Rec_Loss1: 0.022773319855332375, Rec_loss2: 0.005537092685699463 Epoch: 0, Iteration: 12, Loss: 0.009352276101708412, Rec_Loss1: 0.002952676033601165, Rec_loss2: 0.006399600300937891 Epoch: 0, Iteration: 13, Loss: 0.011586668901145458, Rec_Loss1: 0.005171761382371187, Rec_loss2: 0.006414907518774271 Epoch: 0, Iteration: 14, Loss: 0.01459668017923832, Rec_Loss1: 0.005380912218242884, Rec_loss2: 0.009215767495334148 Epoch: 0, Iteration: 15, Loss: 0.01685214228928089, Rec_Loss1: 0.006959381978958845, Rec_loss2: 0.009892760775983334 Epoch: 0, Iteration: 16, Loss: 0.009804013185203075, Rec_Loss1: 0.0033319436479359865, Rec_loss2: 0.0064720697700977325 Epoch: 0, Iteration: 17, Loss: 0.016198759898543358, Rec_Loss1: 0.005649095866829157, Rec_loss2: 0.010549664497375488 Epoch: 0, Iteration: 18, Loss: 0.016497818753123283, Rec_Loss1: 0.007637546863406897, Rec_loss2: 0.008860272355377674 Epoch: 0, Iteration: 19, Loss: 0.007037108298391104, Rec_Loss1: 0.0028563570231199265, Rec_loss2: 0.004180751275271177 Epoch: 0, Iteration: 20, Loss: 0.024494905024766922, Rec_Loss1: 0.010508932173252106, Rec_loss2: 0.013985971920192242 Epoch: 0, Iteration: 21, Loss: 0.017702093347907066, Rec_Loss1: 0.0060675074346363544, Rec_loss2: 0.011634585447609425 Epoch: 0, Iteration: 22, Loss: 0.028357721865177155, Rec_Loss1: 0.005747524555772543, Rec_loss2: 0.022610196843743324 Epoch: 0, Iteration: 23, Loss: 0.018168855458498, Rec_Loss1: 0.004355086944997311, Rec_loss2: 0.01381376851350069 Epoch: 0, Iteration: 24, Loss: 0.018373781815171242, Rec_Loss1: 0.005595667753368616, Rec_loss2: 0.012778114527463913 Epoch: 0, Iteration: 25, Loss: 0.009770587086677551, Rec_Loss1: 0.006647426635026932, Rec_loss2: 0.0031231604516506195 Epoch: 0, Iteration: 26, Loss: 0.009897572919726372, Rec_Loss1: 0.0016765507170930505, Rec_loss2: 0.008221021853387356 Epoch: 0, Iteration: 27, Loss: 0.010041097179055214, Rec_Loss1: 0.0023588703479617834, Rec_loss2: 0.007682227063924074 Epoch: 0, Iteration: 28, Loss: 0.0069048767909407616, Rec_Loss1: 0.0014798814663663507, Rec_loss2: 0.005424995440989733 Epoch: 0, Iteration: 29, Loss: 0.02984018251299858, Rec_Loss1: 0.005807706620544195, Rec_loss2: 0.0240324754267931 Epoch: 0, Iteration: 30, Loss: 0.005661278031766415, Rec_Loss1: 0.0023895849008113146, Rec_loss2: 0.0032716933637857437 Epoch: 0, Iteration: 31, Loss: 0.021612636744976044, Rec_Loss1: 0.008022915571928024, Rec_loss2: 0.013589720241725445 Epoch: 0, Iteration: 32, Loss: 0.028909411281347275, Rec_Loss1: 0.010480371303856373, Rec_loss2: 0.018429039046168327 Epoch: 0, Iteration: 33, Loss: 0.010996435768902302, Rec_Loss1: 0.0022096827160567045, Rec_loss2: 0.008786752820014954 Epoch: 0, Iteration: 34, Loss: 0.009218547493219376, Rec_Loss1: 0.0021805008873343468, Rec_loss2: 0.007038047071546316 Traceback (most recent call last): File "E:/xixixi/Dehaze/main.py", line 101, in val_psnr, val_ssim = validation(net, val_data_loader, device, category) # TypeError: validation() missing 1 required positional argument: 'category'

进程已结束,退出代码为 1 ` 我对utils.py中的def validation进行了检查,没有察觉的有问题,该添加的路径和目录也添加了,但始终都报这个错误。 最后,对您的帮助表示感谢。

zychen-ustc commented 2 years ago

您好!我猜测是不是没有给category赋值?你可以检验一下在调用validation这个函数前是否存在名为category的变量。另外,实际上category这个参数并不是必要的,你可以修改validation函数把它去掉,然后把对应的调用到category的部分改成一个固定的字符串(如'outdoor')即可。

JOoooooOOOOOoe commented 2 years ago

您好,感谢为图像去雾提供了一个很好的解决思路,向您表示真挚的感谢。但是在运行main.py的时候,选择的是FFANet,前面DATALOADER的时候是正确的,输出的:DATALOADER ### DATALOADER DONE! Epoch: 0, Iteration: 0, Loss: 0.14289504289627075, Rec_Loss1: 0.05949130654335022, Rec_loss2: 0.08340374380350113 Epoch: 0, Iteration: 1, Loss: 0.04430900514125824, Rec_Loss1: 0.02571740560233593, Rec_loss2: 0.01859159767627716 Epoch: 0, Iteration: 2, Loss: 0.1531301736831665, Rec_Loss1: 0.07720714807510376, Rec_loss2: 0.07592301815748215 Epoch: 0, Iteration: 3, Loss: 0.04206860437989235, Rec_Loss1: 0.014385269023478031, Rec_loss2: 0.027683334425091743 Epoch: 0, Iteration: 4, Loss: 0.024794980883598328, Rec_Loss1: 0.018735533580183983, Rec_loss2: 0.0060594468377530575 Epoch: 0, Iteration: 5, Loss: 0.02767857350409031, Rec_Loss1: 0.004832420963793993, Rec_loss2: 0.022846153005957603 Epoch: 0, Iteration: 6, Loss: 0.05871203541755676, Rec_Loss1: 0.02811766229569912, Rec_loss2: 0.030594373121857643 Epoch: 0, Iteration: 7, Loss: 0.05164826288819313, Rec_Loss1: 0.024732043966650963, Rec_loss2: 0.026916218921542168 Epoch: 0, Iteration: 8, Loss: 0.059729255735874176, Rec_Loss1: 0.0336235910654068, Rec_loss2: 0.026105666533112526 Epoch: 0, Iteration: 9, Loss: 0.03006775490939617, Rec_Loss1: 0.013887450098991394, Rec_loss2: 0.016180304810404778 Epoch: 0, Iteration: 10, Loss: 0.02384977787733078, Rec_Loss1: 0.011282042600214481, Rec_loss2: 0.012567736208438873 Epoch: 0, Iteration: 11, Loss: 0.028310412541031837, Rec_Loss1: 0.022773319855332375, Rec_loss2: 0.005537092685699463 Epoch: 0, Iteration: 12, Loss: 0.009352276101708412, Rec_Loss1: 0.002952676033601165, Rec_loss2: 0.006399600300937891 Epoch: 0, Iteration: 13, Loss: 0.011586668901145458, Rec_Loss1: 0.005171761382371187, Rec_loss2: 0.006414907518774271 Epoch: 0, Iteration: 14, Loss: 0.01459668017923832, Rec_Loss1: 0.005380912218242884, Rec_loss2: 0.009215767495334148 Epoch: 0, Iteration: 15, Loss: 0.01685214228928089, Rec_Loss1: 0.006959381978958845, Rec_loss2: 0.009892760775983334 Epoch: 0, Iteration: 16, Loss: 0.009804013185203075, Rec_Loss1: 0.0033319436479359865, Rec_loss2: 0.0064720697700977325 Epoch: 0, Iteration: 17, Loss: 0.016198759898543358, Rec_Loss1: 0.005649095866829157, Rec_loss2: 0.010549664497375488 Epoch: 0, Iteration: 18, Loss: 0.016497818753123283, Rec_Loss1: 0.007637546863406897, Rec_loss2: 0.008860272355377674 Epoch: 0, Iteration: 19, Loss: 0.007037108298391104, Rec_Loss1: 0.0028563570231199265, Rec_loss2: 0.004180751275271177 Epoch: 0, Iteration: 20, Loss: 0.024494905024766922, Rec_Loss1: 0.010508932173252106, Rec_loss2: 0.013985971920192242 Epoch: 0, Iteration: 21, Loss: 0.017702093347907066, Rec_Loss1: 0.0060675074346363544, Rec_loss2: 0.011634585447609425 Epoch: 0, Iteration: 22, Loss: 0.028357721865177155, Rec_Loss1: 0.005747524555772543, Rec_loss2: 0.022610196843743324 Epoch: 0, Iteration: 23, Loss: 0.018168855458498, Rec_Loss1: 0.004355086944997311, Rec_loss2: 0.01381376851350069 Epoch: 0, Iteration: 24, Loss: 0.018373781815171242, Rec_Loss1: 0.005595667753368616, Rec_loss2: 0.012778114527463913 Epoch: 0, Iteration: 25, Loss: 0.009770587086677551, Rec_Loss1: 0.006647426635026932, Rec_loss2: 0.0031231604516506195 Epoch: 0, Iteration: 26, Loss: 0.009897572919726372, Rec_Loss1: 0.0016765507170930505, Rec_loss2: 0.008221021853387356 Epoch: 0, Iteration: 27, Loss: 0.010041097179055214, Rec_Loss1: 0.0023588703479617834, Rec_loss2: 0.007682227063924074 Epoch: 0, Iteration: 28, Loss: 0.0069048767909407616, Rec_Loss1: 0.0014798814663663507, Rec_loss2: 0.005424995440989733 Epoch: 0, Iteration: 29, Loss: 0.02984018251299858, Rec_Loss1: 0.005807706620544195, Rec_loss2: 0.0240324754267931 Epoch: 0, Iteration: 30, Loss: 0.005661278031766415, Rec_Loss1: 0.0023895849008113146, Rec_loss2: 0.0032716933637857437 Epoch: 0, Iteration: 31, Loss: 0.021612636744976044, Rec_Loss1: 0.008022915571928024, Rec_loss2: 0.013589720241725445 Epoch: 0, Iteration: 32, Loss: 0.028909411281347275, Rec_Loss1: 0.010480371303856373, Rec_loss2: 0.018429039046168327 Epoch: 0, Iteration: 33, Loss: 0.010996435768902302, Rec_Loss1: 0.0022096827160567045, Rec_loss2: 0.008786752820014954 Epoch: 0, Iteration: 34, Loss: 0.009218547493219376, Rec_Loss1: 0.0021805008873343468, Rec_loss2: 0.007038047071546316 Traceback (most recent call last): File "E:/xixixi/Dehaze/main.py", line 101, in val_psnr, val_ssim = validation(net, val_data_loader, device, category) # TypeError: validation() missing 1 required positional argument: 'category'DONE!也开了第一个Epoch,但是之后就开始报错了,具体的显示如下(为了验证可行性,只选择了34张照片进行训练):

进程已结束,退出代码为 1 ' 我对 utils.py 中的def validation进行了检查,没有察觉的有问题,该添加的路径和目录也添加了,但始终都报这个错误。 最后,对您的帮助表示感谢。

请问你解决了吗,怎么解决的呢