CSRNet-pytorch icon indicating copy to clipboard operation
CSRNet-pytorch copied to clipboard

训练时,验证集的效果非常差是怎么回事

Open sxxtaotao opened this issue 5 years ago • 4 comments

当我训练的时候,验证集的效果非常差,一直在300-400左右浮动,请问这是什么原因,我也没有改别的,只是把python3中不兼容python2的给改掉了,改动最大的是model.py中 if not load_weights: mod = models.vgg16(pretrained = True) self._initialize_weights()
#读取参数 pretrained_dict=mod.state_dict() self.frontend_dict=self.frontend.state_dict() #将pretrained_dict里不属于frontend_dict的键剔除掉 pretrained_dict={k:v for k, v in pretrained_dict.items() if k in self.frontend_dict} #更新现有的frontend_dict self.frontend_dict.update(pretrained_dict) #加载我们真正需要的state_dict self.frontend.load_state_dict(self.frontend_dict)

因为python3中不支持这样的索引,不知道改的对不对,验证集效果一直很差

sxxtaotao avatar Jun 02 '19 13:06 sxxtaotao

我猜你验证集的代码不对,记得最后一个cell中有一行注释,取消掉就好了

neverland0621 avatar Jun 09 '19 08:06 neverland0621

我的预测值为nan

Garyzdz avatar Aug 05 '19 01:08 Garyzdz

我猜你验证集的代码不对,记得最后一个cell中有一行注释,取消掉就好了

你说的挺对的,我开始也是验证集精度很差,验证集part_B 的MAE是1900多,取消掉最后一个cell中的注释img = transform(Image.open(img_paths[i]).convert('RGB')).cuda()后,我的验证集精度为8.998,感谢

zhengmiao1 avatar Sep 16 '19 00:09 zhengmiao1

我猜你验证集的代码不对,记得最后一个cell中有一行注释,取消掉就好了

你说的挺对的,我开始也是验证集精度很差,验证集part_B 的MAE是1900多,取消掉最后一个cell中的注释img = transform(Image.open(img_paths[i]).convert('RGB')).cuda()后,我的验证集精度为8.998,感谢

If you do this, then you negate all normalization process before this line.

Cli98 avatar Jan 13 '20 16:01 Cli98