Open jingting9 opened 3 years ago
I think adding 0.5 is adding half a pixel in the stage output, which when you multiply for stride
afterwards is ending right in the middle of the anchors grid if you see it in the original input image space.
Actually I have an additional question here: shouldn't the anchors be equally spaced? I would have proceed as follows: anchors equally spaced on a grid, check the iou with the true box, if higher than threshold then set the corresponding label.
While the approach seems different, it seems only one output here will receive the label per route (or stage), specifically the pixel xind, yind in the stage i
xind, yind = np.floor(bbox_xywh_scaled[i, 0:2]).astype(
np.int32
)
label[i][yind, xind, iou_mask, :] = 0
label[i][yind, xind, iou_mask, 0:4] = bbox_xywh
label[i][yind, xind, iou_mask, 4:5] = 1.0
label[i][yind, xind, iou_mask, 5:] = smooth_onehot
mask is an array long as the number of stages, 3 for yolo, 2 for tiniy yolo. So that can set at max 3 or 2 labels, respectively.
This is not what I would expected, I would expect to check all anchors in all positions and set their label if the iou is higher than a certain threshold. Am I missing something here?
Hi, in dataset.py Line 332-334,set anchors' xy coord like this: anchors_xywh[:, 0:2] = ( np.floor(bbox_xywh_scaled[i, 0:2]).astype(np.int32) + 0.5 )
why not set anchors' xy directly by "anchors_xywh[:, 0:2] = bbox_xywh_scaled[i, 0:2]"?