UltraLight-VM-UNet icon indicating copy to clipboard operation
UltraLight-VM-UNet copied to clipboard

测试过程中模型加载有问题 随机种子没变 但是效果达不到原来训练得到的最好模型效果

Open pengzinuo opened this issue 9 months ago • 9 comments

作者您好,在我测试数据集isic2017过程中,拿以前的模型权重却发现和以前达到的效果不一样,我发现您放在了cpu上,我去掉这个,效果有提升,但还是不如之前 首先我检查了模型参数是否匹配 odict_keys(['module.encoder1.0.weight', 'module.encoder1.0.bias', 'module.encoder2.0.weight', 'module.encoder2.0.bias', 'module.encoder3.0.weight', 'module.encoder3.0.bias', 'module.encoder4.0.skip_scale', 'module.encoder4.0.norm.weight', 'module.encoder4.0.norm.bias', 'module.encoder4.0.mamba.A_log', 'module.encoder4.0.mamba.D', 'module.encoder4.0.mamba.in_proj.weight', 'module.encoder4.0.mamba.conv1d.weight', 'module.encoder4.0.mamba.conv1d.bias', 'module.encoder4.0.mamba.x_proj.weight', 'module.encoder4.0.mamba.dt_proj.weight', 'module.encoder4.0.mamba.dt_proj.bias', 'module.encoder4.0.mamba.out_proj.weight', 'module.encoder4.0.proj.weight', 'module.encoder4.0.proj.bias', 'module.encoder5.0.skip_scale', 'module.encoder5.0.norm.weight', 'module.encoder5.0.norm.bias', 'module.encoder5.0.mamba.A_log', 'module.encoder5.0.mamba.D', 'module.encoder5.0.mamba.in_proj.weight', 'module.encoder5.0.mamba.conv1d.weight', 'module.encoder5.0.mamba.conv1d.bias', 'module.encoder5.0.mamba.x_proj.weight', 'module.encoder5.0.mamba.dt_proj.weight', 'module.encoder5.0.mamba.dt_proj.bias', 'module.encoder5.0.mamba.out_proj.weight', 'module.encoder5.0.proj.weight', 'module.encoder5.0.proj.bias', 'module.encoder6.0.skip_scale', 'module.encoder6.0.norm.weight', 'module.encoder6.0.norm.bias', 'module.encoder6.0.mamba.A_log', 'module.encoder6.0.mamba.D', 'module.encoder6.0.mamba.in_proj.weight', 'module.encoder6.0.mamba.conv1d.weight', 'module.encoder6.0.mamba.conv1d.bias', 'module.encoder6.0.mamba.x_proj.weight', 'module.encoder6.0.mamba.dt_proj.weight', 'module.encoder6.0.mamba.dt_proj.bias', 'module.encoder6.0.mamba.out_proj.weight', 'module.encoder6.0.proj.weight', 'module.encoder6.0.proj.bias', 'module.scab.catt.get_all_att.weight', 'module.scab.catt.att1.weight', 'module.scab.catt.att1.bias', 'module.scab.catt.att2.weight', 'module.scab.catt.att2.bias', 'module.scab.catt.att3.weight', 'module.scab.catt.att3.bias', 'module.scab.catt.att4.weight', 'module.scab.catt.att4.bias', 'module.scab.catt.att5.weight', 'module.scab.catt.att5.bias', 'module.scab.satt.shared_conv2d.0.weight', 'module.scab.satt.shared_conv2d.0.bias', 'module.decoder1.0.skip_scale', 'module.decoder1.0.norm.weight', 'module.decoder1.0.norm.bias', 'module.decoder1.0.mamba.A_log', 'module.decoder1.0.mamba.D', 'module.decoder1.0.mamba.in_proj.weight', 'module.decoder1.0.mamba.conv1d.weight', 'module.decoder1.0.mamba.conv1d.bias', 'module.decoder1.0.mamba.x_proj.weight', 'module.decoder1.0.mamba.dt_proj.weight', 'module.decoder1.0.mamba.dt_proj.bias', 'module.decoder1.0.mamba.out_proj.weight', 'module.decoder1.0.proj.weight', 'module.decoder1.0.proj.bias', 'module.decoder2.0.skip_scale', 'module.decoder2.0.norm.weight', 'module.decoder2.0.norm.bias', 'module.decoder2.0.mamba.A_log', 'module.decoder2.0.mamba.D', 'module.decoder2.0.mamba.in_proj.weight', 'module.decoder2.0.mamba.conv1d.weight', 'module.decoder2.0.mamba.conv1d.bias', 'module.decoder2.0.mamba.x_proj.weight', 'module.decoder2.0.mamba.dt_proj.weight', 'module.decoder2.0.mamba.dt_proj.bias', 'module.decoder2.0.mamba.out_proj.weight', 'module.decoder2.0.proj.weight', 'module.decoder2.0.proj.bias', 'module.decoder3.0.skip_scale', 'module.decoder3.0.norm.weight', 'module.decoder3.0.norm.bias', 'module.decoder3.0.mamba.A_log', 'module.decoder3.0.mamba.D', 'module.decoder3.0.mamba.in_proj.weight', 'module.decoder3.0.mamba.conv1d.weight', 'module.decoder3.0.mamba.conv1d.bias', 'module.decoder3.0.mamba.x_proj.weight', 'module.decoder3.0.mamba.dt_proj.weight', 'module.decoder3.0.mamba.dt_proj.bias', 'module.decoder3.0.mamba.out_proj.weight', 'module.decoder3.0.proj.weight', 'module.decoder3.0.proj.bias', 'module.decoder4.0.weight', 'module.decoder4.0.bias', 'module.decoder5.0.weight', 'module.decoder5.0.bias', 'module.ebn1.weight', 'module.ebn1.bias', 'module.ebn2.weight', 'module.ebn2.bias', 'module.ebn3.weight', 'module.ebn3.bias', 'module.ebn4.weight', 'module.ebn4.bias', 'module.ebn5.weight', 'module.ebn5.bias', 'module.dbn1.weight', 'module.dbn1.bias', 'module.dbn2.weight', 'module.dbn2.bias', 'module.dbn3.weight', 'module.dbn3.bias', 'module.dbn4.weight', 'module.dbn4.bias', 'module.dbn5.weight', 'module.dbn5.bias', 'module.final.weight', 'module.final.bias'])

odict_keys(['module.encoder1.0.weight', 'module.encoder1.0.bias', 'module.encoder2.0.weight', 'module.encoder2.0.bias', 'module.encoder3.0.weight', 'module.encoder3.0.bias', 'module.encoder4.0.skip_scale', 'module.encoder4.0.norm.weight', 'module.encoder4.0.norm.bias', 'module.encoder4.0.mamba.A_log', 'module.encoder4.0.mamba.D', 'module.encoder4.0.mamba.in_proj.weight', 'module.encoder4.0.mamba.conv1d.weight', 'module.encoder4.0.mamba.conv1d.bias', 'module.encoder4.0.mamba.x_proj.weight', 'module.encoder4.0.mamba.dt_proj.weight', 'module.encoder4.0.mamba.dt_proj.bias', 'module.encoder4.0.mamba.out_proj.weight', 'module.encoder4.0.proj.weight', 'module.encoder4.0.proj.bias', 'module.encoder5.0.skip_scale', 'module.encoder5.0.norm.weight', 'module.encoder5.0.norm.bias', 'module.encoder5.0.mamba.A_log', 'module.encoder5.0.mamba.D', 'module.encoder5.0.mamba.in_proj.weight', 'module.encoder5.0.mamba.conv1d.weight', 'module.encoder5.0.mamba.conv1d.bias', 'module.encoder5.0.mamba.x_proj.weight', 'module.encoder5.0.mamba.dt_proj.weight', 'module.encoder5.0.mamba.dt_proj.bias', 'module.encoder5.0.mamba.out_proj.weight', 'module.encoder5.0.proj.weight', 'module.encoder5.0.proj.bias', 'module.encoder6.0.skip_scale', 'module.encoder6.0.norm.weight', 'module.encoder6.0.norm.bias', 'module.encoder6.0.mamba.A_log', 'module.encoder6.0.mamba.D', 'module.encoder6.0.mamba.in_proj.weight', 'module.encoder6.0.mamba.conv1d.weight', 'module.encoder6.0.mamba.conv1d.bias', 'module.encoder6.0.mamba.x_proj.weight', 'module.encoder6.0.mamba.dt_proj.weight', 'module.encoder6.0.mamba.dt_proj.bias', 'module.encoder6.0.mamba.out_proj.weight', 'module.encoder6.0.proj.weight', 'module.encoder6.0.proj.bias', 'module.scab.catt.get_all_att.weight', 'module.scab.catt.att1.weight', 'module.scab.catt.att1.bias', 'module.scab.catt.att2.weight', 'module.scab.catt.att2.bias', 'module.scab.catt.att3.weight', 'module.scab.catt.att3.bias', 'module.scab.catt.att4.weight', 'module.scab.catt.att4.bias', 'module.scab.catt.att5.weight', 'module.scab.catt.att5.bias', 'module.scab.satt.shared_conv2d.0.weight', 'module.scab.satt.shared_conv2d.0.bias', 'module.decoder1.0.skip_scale', 'module.decoder1.0.norm.weight', 'module.decoder1.0.norm.bias', 'module.decoder1.0.mamba.A_log', 'module.decoder1.0.mamba.D', 'module.decoder1.0.mamba.in_proj.weight', 'module.decoder1.0.mamba.conv1d.weight', 'module.decoder1.0.mamba.conv1d.bias', 'module.decoder1.0.mamba.x_proj.weight', 'module.decoder1.0.mamba.dt_proj.weight', 'module.decoder1.0.mamba.dt_proj.bias', 'module.decoder1.0.mamba.out_proj.weight', 'module.decoder1.0.proj.weight', 'module.decoder1.0.proj.bias', 'module.decoder2.0.skip_scale', 'module.decoder2.0.norm.weight', 'module.decoder2.0.norm.bias', 'module.decoder2.0.mamba.A_log', 'module.decoder2.0.mamba.D', 'module.decoder2.0.mamba.in_proj.weight', 'module.decoder2.0.mamba.conv1d.weight', 'module.decoder2.0.mamba.conv1d.bias', 'module.decoder2.0.mamba.x_proj.weight', 'module.decoder2.0.mamba.dt_proj.weight', 'module.decoder2.0.mamba.dt_proj.bias', 'module.decoder2.0.mamba.out_proj.weight', 'module.decoder2.0.proj.weight', 'module.decoder2.0.proj.bias', 'module.decoder3.0.skip_scale', 'module.decoder3.0.norm.weight', 'module.decoder3.0.norm.bias', 'module.decoder3.0.mamba.A_log', 'module.decoder3.0.mamba.D', 'module.decoder3.0.mamba.in_proj.weight', 'module.decoder3.0.mamba.conv1d.weight', 'module.decoder3.0.mamba.conv1d.bias', 'module.decoder3.0.mamba.x_proj.weight', 'module.decoder3.0.mamba.dt_proj.weight', 'module.decoder3.0.mamba.dt_proj.bias', 'module.decoder3.0.mamba.out_proj.weight', 'module.decoder3.0.proj.weight', 'module.decoder3.0.proj.bias', 'module.decoder4.0.weight', 'module.decoder4.0.bias', 'module.decoder5.0.weight', 'module.decoder5.0.bias', 'module.ebn1.weight', 'module.ebn1.bias', 'module.ebn2.weight', 'module.ebn2.bias', 'module.ebn3.weight', 'module.ebn3.bias', 'module.ebn4.weight', 'module.ebn4.bias', 'module.ebn5.weight', 'module.ebn5.bias', 'module.dbn1.weight', 'module.dbn1.bias', 'module.dbn2.weight', 'module.dbn2.bias', 'module.dbn3.weight', 'module.dbn3.bias', 'module.dbn4.weight', 'module.dbn4.bias', 'module.dbn5.weight', 'module.dbn5.bias', 'module.final.weight', 'module.final.bias'])

Model weights loaded successfully. Parameter module.encoder1.0.weight matches. Parameter module.encoder1.0.bias matches. Parameter module.encoder2.0.weight matches. Parameter module.encoder2.0.bias matches. Parameter module.encoder3.0.weight matches. Parameter module.encoder3.0.bias matches. Parameter module.encoder4.0.skip_scale matches. Parameter module.encoder4.0.norm.weight matches. Parameter module.encoder4.0.norm.bias matches. Parameter module.encoder4.0.mamba.A_log matches. Parameter module.encoder4.0.mamba.D matches. Parameter module.encoder4.0.mamba.in_proj.weight matches. Parameter module.encoder4.0.mamba.conv1d.weight matches. Parameter module.encoder4.0.mamba.conv1d.bias matches. Parameter module.encoder4.0.mamba.x_proj.weight matches. Parameter module.encoder4.0.mamba.dt_proj.weight matches. Parameter module.encoder4.0.mamba.dt_proj.bias matches. Parameter module.encoder4.0.mamba.out_proj.weight matches. Parameter module.encoder4.0.proj.weight matches. Parameter module.encoder4.0.proj.bias matches. Parameter module.encoder5.0.skip_scale matches. Parameter module.encoder5.0.norm.weight matches. Parameter module.encoder5.0.norm.bias matches. Parameter module.encoder5.0.mamba.A_log matches. Parameter module.encoder5.0.mamba.D matches. Parameter module.encoder5.0.mamba.in_proj.weight matches. Parameter module.encoder5.0.mamba.conv1d.weight matches. Parameter module.encoder5.0.mamba.conv1d.bias matches. Parameter module.encoder5.0.mamba.x_proj.weight matches. Parameter module.encoder5.0.mamba.dt_proj.weight matches. Parameter module.encoder5.0.mamba.dt_proj.bias matches. Parameter module.encoder5.0.mamba.out_proj.weight matches. Parameter module.encoder5.0.proj.weight matches. Parameter module.encoder5.0.proj.bias matches. Parameter module.encoder6.0.skip_scale matches. Parameter module.encoder6.0.norm.weight matches. Parameter module.encoder6.0.norm.bias matches. Parameter module.encoder6.0.mamba.A_log matches. Parameter module.encoder6.0.mamba.D matches. Parameter module.encoder6.0.mamba.in_proj.weight matches. Parameter module.encoder6.0.mamba.conv1d.weight matches. Parameter module.encoder6.0.mamba.conv1d.bias matches. Parameter module.encoder6.0.mamba.x_proj.weight matches. Parameter module.encoder6.0.mamba.dt_proj.weight matches. Parameter module.encoder6.0.mamba.dt_proj.bias matches. Parameter module.encoder6.0.mamba.out_proj.weight matches. Parameter module.encoder6.0.proj.weight matches. Parameter module.encoder6.0.proj.bias matches. Parameter module.scab.catt.get_all_att.weight matches. Parameter module.scab.catt.att1.weight matches. Parameter module.scab.catt.att1.bias matches. Parameter module.scab.catt.att2.weight matches. Parameter module.scab.catt.att2.bias matches. Parameter module.scab.catt.att3.weight matches. Parameter module.scab.catt.att3.bias matches. Parameter module.scab.catt.att4.weight matches. Parameter module.scab.catt.att4.bias matches. Parameter module.scab.catt.att5.weight matches. Parameter module.scab.catt.att5.bias matches. Parameter module.scab.satt.shared_conv2d.0.weight matches. Parameter module.scab.satt.shared_conv2d.0.bias matches. Parameter module.decoder1.0.skip_scale matches. Parameter module.decoder1.0.norm.weight matches. Parameter module.decoder1.0.norm.bias matches. Parameter module.decoder1.0.mamba.A_log matches. Parameter module.decoder1.0.mamba.D matches. Parameter module.decoder1.0.mamba.in_proj.weight matches. Parameter module.decoder1.0.mamba.conv1d.weight matches. Parameter module.decoder1.0.mamba.conv1d.bias matches. Parameter module.decoder1.0.mamba.x_proj.weight matches. Parameter module.decoder1.0.mamba.dt_proj.weight matches. Parameter module.decoder1.0.mamba.dt_proj.bias matches. Parameter module.decoder1.0.mamba.out_proj.weight matches. Parameter module.decoder1.0.proj.weight matches. Parameter module.decoder1.0.proj.bias matches. Parameter module.decoder2.0.skip_scale matches. Parameter module.decoder2.0.norm.weight matches. Parameter module.decoder2.0.norm.bias matches. Parameter module.decoder2.0.mamba.A_log matches. Parameter module.decoder2.0.mamba.D matches. Parameter module.decoder2.0.mamba.in_proj.weight matches. Parameter module.decoder2.0.mamba.conv1d.weight matches. Parameter module.decoder2.0.mamba.conv1d.bias matches. Parameter module.decoder2.0.mamba.x_proj.weight matches. Parameter module.decoder2.0.mamba.dt_proj.weight matches. Parameter module.decoder2.0.mamba.dt_proj.bias matches. Parameter module.decoder2.0.mamba.out_proj.weight matches. Parameter module.decoder2.0.proj.weight matches. Parameter module.decoder2.0.proj.bias matches. Parameter module.decoder3.0.skip_scale matches. Parameter module.decoder3.0.norm.weight matches. Parameter module.decoder3.0.norm.bias matches. Parameter module.decoder3.0.mamba.A_log matches. Parameter module.decoder3.0.mamba.D matches. Parameter module.decoder3.0.mamba.in_proj.weight matches. Parameter module.decoder3.0.mamba.conv1d.weight matches. Parameter module.decoder3.0.mamba.conv1d.bias matches. Parameter module.decoder3.0.mamba.x_proj.weight matches. Parameter module.decoder3.0.mamba.dt_proj.weight matches. Parameter module.decoder3.0.mamba.dt_proj.bias matches. Parameter module.decoder3.0.mamba.out_proj.weight matches. Parameter module.decoder3.0.proj.weight matches. Parameter module.decoder3.0.proj.bias matches. Parameter module.decoder4.0.weight matches. Parameter module.decoder4.0.bias matches. Parameter module.decoder5.0.weight matches. Parameter module.decoder5.0.bias matches. Parameter module.ebn1.weight matches. Parameter module.ebn1.bias matches. Parameter module.ebn2.weight matches. Parameter module.ebn2.bias matches. Parameter module.ebn3.weight matches. Parameter module.ebn3.bias matches. Parameter module.ebn4.weight matches. Parameter module.ebn4.bias matches. Parameter module.ebn5.weight matches. Parameter module.ebn5.bias matches. Parameter module.dbn1.weight matches. Parameter module.dbn1.bias matches. Parameter module.dbn2.weight matches. Parameter module.dbn2.bias matches. Parameter module.dbn3.weight matches. Parameter module.dbn3.bias matches. Parameter module.dbn4.weight matches. Parameter module.dbn4.bias matches. Parameter module.dbn5.weight matches. Parameter module.dbn5.bias matches. Parameter module.final.weight matches. Parameter module.final.bias matches. Model weights match. 我匹配了 原来结果是: 2024-04-24 20:15:18 - test of best model, loss: 0.2915,miou: 0.7798316090075763, f1_or_dsc: 0.8762981903017284, accuracy: 0.9633194732666016, specificity: 0.9808625097235345, sensitivity: 0.8641748429930506, confusion_matrix: [[32770537 639382][ 802955 5108726]] 现在再一次加载测试(models/best-epoch104-loss0.2678.pth),结果是: test of best model, loss: 0.3700,miou: 0.7395731743810359, f1_or_dsc: 0.8502926870485759, accuracy: 0.9572845458984375, specificity: 0.9839004398663762, sensitivity: 0.8068645787890111, confusion_matrix: [[32872034 537885] [ 1141755 4769926]] 我拿你给出的权重(UltraLight_VM_UNet.pth)去测试得到的结果是: test of best model, loss: 0.5090,miou: 0.6089312019839543, f1_or_dsc: 0.756938769330955, accuracy: 0.9171144612630209, specificity: 0.927495125025595, sensitivity: 0.858448045488246, confusion_matrix: [[30987537 2422382] [ 836810 5074871]]

pengzinuo avatar May 16 '24 14:05 pengzinuo