Error while executing MyTest_Lunginf.py
Hi, Thank you for this helpful compilation. I am able to generate my weights after training MyTrain_LungInf.py with backbone = 'Res2Net50' However when I am trying to run the MyTest_LungInf.py I am facing the below issue although I have placed the pre-trained weights of 'Inf-Net_Pseduo' in the reuired path. Is it because of some mis-match between the trained 'Semi-Inf-Net-100.pth' and the pre-trained 'Inf-Net_Pseduo'? How could we fix this?
Traceback (most recent call last):
File "MyTest_LungInf.py", line 65, in
Nope, the trained 'Semi-Inf-Net-100.pth' and the pre-trained 'Inf-Net_Pseduo' totally matches. Besides, I have checked the each item in ''Semi-Inf-Net-100.pth" but fail to find the param_name that contains total_ops and total_params. May you provide training details and testing details?
Also I have the same issue too. I trained well (myTrain_lungInf.py) but when I tested (myTest_lungInf.py), mismatch occured.
size mismatch for resnet.layer4.2.conv3.weight: copying a param with shape torch.Size([2048, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([2048, 832, 1, 1]).
I have replied to your e-mail, please check it. @aytek03
I run 100 epoch and I got Inf-Net-100.pth. Then I changed this code in Res2Net.py (in backbone)
def res2net50_v1b_26w_4s(pretrained=False, **kwargs):
#model_lung_infection.load_state_dict(model_zoo.load_url(model_urls['res2net50_v1b_26w_4s']))
model.load_state_dict(model_zoo.load_url(model_urls['res2net50_v1b_26w_4s']))
because name 'model_lung_infection' is not defined in this code.
Then I changed ResNet50 to Res2Net50 but I have this error code in myTest_lungInf.py:
RuntimeError: Error(s) in loading state_dict for Inf_Net: Unexpected key(s) in state_dict: "total_ops", "total_params",..
we do not have total_ops and total_params.
Have do we solve sir?
I find the error in this line:
model.load_state_dict(torch.load('./Snapshots/save_weights/Inf-Net/Inf-Net-100.pth'))
When I directly download the pre-trained weights from your .pth, it works but when I use my trained .pth, I got an error.
Why? I changed to Res2net50 and trained but this system does not work.
I think THOP may result in an error. You better close off it. If you solve this problem, please notify me.
Yes it works sir. When I close THOP settings in MyTrain_LungInf.py then I run MyTest_LungInf.py. Then I got the result images.
Have a nice day! Thank you for your attention to our work.
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
Can you share this code?
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
请问能展示你的解决问题部分的代码吗?同样遇到这个问题,调整了几次都不成功。谢谢了
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
请问能展示你的解决问题部分的代码吗?同样遇到这个问题,调整了几次都不成功。谢谢了
你可以把计算参数的这一段去掉试试
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
请问能展示你的解决问题部分的代码吗?同样遇到这个问题,调整了几次都不成功。谢谢了
你可以把计算参数的这一段去掉试试
感谢作者,拉取新代码修改部分问题后,PseudoGenerator和test都跑通了,非常感谢!
You are welcome!
harvey [email protected] 于2020年8月31日周一 下午11:12写道:
我也遇到了这个问题,我把计算参数的代码放到了train的后面,这样解决了这个问题并且还能计算参数
请问能展示你的解决问题部分的代码吗?同样遇到这个问题,调整了几次都不成功。谢谢了
你可以把计算参数的这一段去掉试试
感谢作者,拉取新代码修改部分问题后,PseudoGenerator和test都跑通了,非常感谢!
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/DengPingFan/Inf-Net/issues/15#issuecomment-683841554, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEUADOUSJQQLSWJFQVUBA3SDO4XRANCNFSM4NXP7KAA .