Fix the problem of abnormal key points in YOLOFacePose

Problem Description

Keypoint regression fails with two contours?

insert image description here

Analysis one:

From: 300W to yolo format problem
For example: coco2yolo
0 xywh (px,py, flag) (px,py, flag) (px,py, flag)
and 300W2yolo:
0 xywh (px,py) (px,py) ( px, py)
still need to manually add flags, all set to 2. But in the actual data processing, the flags have been cleared, and there is no problem in data processing.

Analysis 2: Refer to the problem of flying points in yolo

https://github.com/WongKinYiu/yolov7/pull/501
https://github.com/TexasInstruments/edgeai-yolov5/issues/10

insert image description here
According to the treatment method, the flying point problem was successfully solved!

Question 2: how to improve accuracy

Attempt 1: Customize the bias weight for each point

When calculating OKS, we customized the deviation of each point, but according to this training, there is no obvious performance improvement. As follows:
Our falloff:
[0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.18, 0.116, 0.1 16, 0.116, 0.116, 0.116
, 0.116,0.116, 0.116,0.116, 0.116, 0.103,
0.103, 0.103, 0.103, 0.072, 0.072, 0.072, 0.072, 0.072, 0.085, 0.085,
0.085, 0.08 5, 0.085, 0.085, 0.085, 0.085,
0.085, 0.085, 0.085, 0.085,
0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.103, 0.11, 0.101, 0.101, 0.101, 0.1 1, 0.101, 0.101,
0.101
]

尝试二:Try: using deconvolution to instead upsample

insert deconv into the yolo.cfg framework

  	[ [ -1, 1, Conv, [ 768, 1, 1 ] ],
    [ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
  #将以上两个模块合并成反卷即模块
  	[ [ -1, 1, DeConv, [ 768, 1, 1 ] ],

   # [ [ -1, 20 ], 1, Concat, [ 1 ] ],  # cat head P4
    [ [ -1, 18 ], 1, Concat, [ 1 ] ],  # cat head P4
   # 原来将第20层连接到一起,现在由于减少来2层故对应修改层数

define the deconv module

Add the following module Deconv in common.py, and also need to add the corresponding DeConv module in yolo.py

class DeConv(nn.Module):
    # Standard convolution
    #(k, p, outp) = (4,1,0) (3,1,1) (2,0,0)
    def __init__(self, c1, c2, k=3, s=2, p=1, g=1, act=True):  # ch_in, ch_out, kernel, stride, padding, groups
        super(DeConv, self).__init__()
        self.deconv = nn.ConvTranspose2d(c1, c2, k, s, 
            padding= p,
            output_padding=p,
            groups=g, bias=False)
        self.bn = nn.BatchNorm2d(c2)
        if act != "ReLU":
            self.act = nn.SiLU() if act is True else (act if isinstance(act, nn.Module) else nn.Identity())
        else:
            self.act = nn.ReLU(inplace=True)

    def forward(self, x):
        return self.act(self.bn(self.deconv(x)))

    def fuseforward(self, x):
        return self.act(self.deconv(x))

Will continue to update our improvement process...


Guess you like

Origin blog.csdn.net/wqthaha/article/details/126650391