季夏。。。 发表于 2022-12-3 11:26:24

关于通道数的修改

feat_img = net.FeatCNN(img.to(torch.float32).to(device=torch.device("cuda" if torch.cuda.is_available() else "cpu")))
            feat_arr = net.FeatRNN(arr.to(torch.float32).to(device=torch.device("cuda" if torch.cuda.is_available() else "cpu")))
            feat = torch.cat((feat_img, feat_arr), axis=1)

运行到这一部分的时候就显示:RuntimeError: Given groups=1, weight of size , expected input to have 5 channels, but got 3 channels instead
不知道是什么原因,有没有大佬知道能帮忙看看的

suchocolate 发表于 2022-12-3 11:31:10

没研究神经网络,从报错上看,给的通道数不够,期望5个,只提供了3个。
最好把报错代码发全

ZhKQYu 发表于 2022-12-3 17:11:44

贴一个训练的代码看看,应该是训练的时候,图片的通道数整错了
页: [1]
查看完整版本: 关于通道数的修改