chenyuntc / pytorch-book

PyTorch tutorials and fun projects including neural talk, neural style, poem writing, anime generation (《深度学习框架PyTorch:入门与实战》)
MIT License
11.99k stars 3.73k forks source link

resnet34最后的全连接层问题 #230

Open superhero-7 opened 3 years ago

superhero-7 commented 3 years ago

在resnet34中最后用于分类的全连接实现是这样的: self.fc = nn.Linear(512, num_classes) 想问一下这里的输入特征维数512应该是算出来的吧,受输入图片大小影响吧?

timmmGZ commented 3 years ago

在resnet34中最后用于分类的全连接实现是这样的: self.fc = nn.Linear(512, num_classes) 想问一下这里的输入特征维数512应该是算出来的吧,受输入图片大小影响吧?

正解,所以输入图片时要resize

TanSongBai commented 1 year ago

thank you! I also find this problem and solve it by your idea.