yolov5-face icon indicating copy to clipboard operation
yolov5-face copied to clipboard

关于face_datasets.py 308行数据预处理

Open liu0623 opened this issue 2 years ago • 1 comments

请问经过letterbox后,关键点的标签为什么不用这种方式更新 #labels[:, 5] = ratio[0] * w * x[:, 5] + pad[0] 而是采用了下面这种方式 labels[:, 5] = np.array(x[:, 5] > 0, dtype=np.int32) * (ratio[0] * w * x[:, 5] + pad[0]) + (np.array(x[:, 5] > 0, dtype=np.int32) - 1) 可以解释一下原理吗???

liu0623 avatar Dec 14 '21 09:12 liu0623

当x[:, 5]也就是坐标为0时,表示是未标注关键点,这一点你可以参考一下coco人体关键点标注的格式,这样的话labels[:, 5]就是0-1=-1,于是在计算loss时,label=-1的点loss会被屏蔽掉,可以在utils/loss.py第97行,weight[torch.where(t==-1)]=0看到这个设置。

XiongZhongxia avatar Dec 23 '21 03:12 XiongZhongxia