Code for MSH-Net: Modality-Shared Hallucination with Joint Adaptation Distillation for Remote Sensing Image Classification Using Missing Modalities
MIT License
5
stars
0
forks
source link
RuntimeError: expand(torch.cuda.FloatTensor{[1, 64, 64, 4, 4]}, size=[64, 64, 64]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (5) #4
大佬,我在运行huston2013_T_HL_L.sh的时候,可以运行一次,在运行第二次的时候开始计算cls_loss了,然后就有了如下报错:
Traceback (most recent call last): File "huston2013_transfer.py", line 101, in <module> deeppix_main(args=args) File "huston2013_transfer.py", line 97, in deeppix_main args=args) File "../lib/model_develop.py", line 2680, in train_knowledge_distill_jda kd_loss = criterionKD(feature_student, feature_teacher.detach(), x_whole_student, x_whole_teacher.detach()) File "/opt/conda/envs/MSHNet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "../loss/kd/jda.py", line 52, in forward D1 = self.mmd_loss(feature_student, feature_teacher) File "/opt/conda/envs/MSHNet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "../loss/kd/jda.py", line 23, in forward total0 = total.unsqueeze(0).expand(int(total.size(0)), int(total.size(0)), int(total.size(1))) RuntimeError: expand(torch.cuda.FloatTensor{[1, 64, 64, 4, 4]}, size=[64, 64, 64]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (5)
貌似是说张量的尺寸不对,有什么办法解决吗?还是说我哪里出了错。
我看你原来引入的老师模型是‘fusion_hsi_lidar.pth’但是上一个训练训练出的是fusion_11__hsi_lidar_version_0.pth,我修改了引入,不知道这个引入是否正确?
大佬,我在运行huston2013_T_HL_L.sh的时候,可以运行一次,在运行第二次的时候开始计算cls_loss了,然后就有了如下报错:
Traceback (most recent call last): File "huston2013_transfer.py", line 101, in <module> deeppix_main(args=args) File "huston2013_transfer.py", line 97, in deeppix_main args=args) File "../lib/model_develop.py", line 2680, in train_knowledge_distill_jda kd_loss = criterionKD(feature_student, feature_teacher.detach(), x_whole_student, x_whole_teacher.detach()) File "/opt/conda/envs/MSHNet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "../loss/kd/jda.py", line 52, in forward D1 = self.mmd_loss(feature_student, feature_teacher) File "/opt/conda/envs/MSHNet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "../loss/kd/jda.py", line 23, in forward total0 = total.unsqueeze(0).expand(int(total.size(0)), int(total.size(0)), int(total.size(1))) RuntimeError: expand(torch.cuda.FloatTensor{[1, 64, 64, 4, 4]}, size=[64, 64, 64]): the number of sizes provided (3) must be greater or equal to the number of dimensions in the tensor (5)
貌似是说张量的尺寸不对,有什么办法解决吗?还是说我哪里出了错。 我看你原来引入的老师模型是‘fusion_hsi_lidar.pth’但是上一个训练训练出的是fusion_11__hsi_lidar_version_0.pth,我修改了引入,不知道这个引入是否正确?