ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.36k stars 16.25k forks source link

I want to know some names in this program. #674

Closed ZeKunZhang1998 closed 4 years ago

ZeKunZhang1998 commented 4 years ago

❔Question

if n: nt += n # cumulative targets ps = pi[b, a, gj, gi] # prediction subset corresponding to targets

Regression

        t_box = ps[:,:4]

        pxy = ps[:, :2].sigmoid() * 2. - 0.5
        pwh = (ps[:, 2:4].sigmoid() * 2) ** 2 * anchors[i]

        pbox = torch.cat((pxy, pwh), 1).to(device)  # predicted box
        #print(pbox)
        giou = bbox_iou(pbox.T, tbox[i], x1y1x2y2=False, CIoU=True)  # giou(prediction, target)
        #print(tbox[i])
        print(len(giou))
        lbox += (1.0 - giou).mean()  # giou loss

Additional context

Could you tell me the meaning of pi,ps,pbox?

glenn-jocher commented 4 years ago

@ZeKunZhang1998 the info you're looking for is in the comments in the code you pasted.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

wandaoyi commented 3 years ago

pi: there are 3 anchors in a coord, pi is a predict info under an anchor. ps: is a pre subset info pbox: pre_box info ---> [[center_x, center_y, width, height], ...]

wandaoyi commented 3 years ago

However, I want to know why: pxy = ps[:, :2].sigmoid() 2. - 0.5 pwh = (ps[:, 2:4].sigmoid() 2) * 2 anchors[i]

do 2. - 0.5 and 2) ** 2 these things. I wonder!