abeardear / pytorch-YOLO-v1

an experiment for yolo-v1, including training and testing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question : Yolo v1 confidence and probability class map

Shiro-LK opened this issue · comments

Hello,

I am trying to understand in details Yolo V1 but I have some questions about it regarding the confidence and class probability. In fact, the confidence is equal to : ground truth label * IOU(pred, truth). To find the ground truth label, we just need to get an array of size 7x7 and put the cell to 1 if the center of an object is inside the cell in the dataset. But, to compute the IOU I have some doubt. Do you compute the IOU only when the center of the prediction box and the center of the object (truth) is INSIDE the same cell ?
I have also a question regarding P class|object, if there is no object in a cell ou multiple object which label do you return during the training step ?

I thank you for the help !

commented

Hi, sorry for late reply.
In yolo v1, each cell has two pred box, I think the center of two pred box will always fall in the cell. We should compute IOU for the two box and ground truth box which INSIDE the same cell, then, choose the bigger IOU, and the pred box with bigger IOU is responsiable for the target.
If there is no object in a cell, CLASS LOSS will not be computed. So wen there is no object in a cell, we don't need return any label.
By the way, in my implementation, i did something wrong. I don't compute IOU between pred box and target box during training, i just set it to one. I fix this later, the performance on validation is a little better, but not so good, so i haven't upload it yet.

I see, thanks for the answer !

@xiongzihua HI
现在的code来看,您在训练时,是计算了IOU between pred box and target box的.
体现在yoloLoss.py中:
contain_loss=F.mse_loss(box_pred_response[:,4],box_target_response_iou[:,4],size_average=False)
此时的标签不是简单的1,而是具体计算的iou值box_target_response_iou[:,4]

不知道自己的理解对吗??