Is it a bug for the origin code in darknet for computing IOU in the loss layer? #36
Open
Description
Hi, @yeahkun
Thanks for your nice work. I compared the code with the origin darknet. All pieces of code were understood expect the IOU computing in the loss layer.
In fact, the difference was in the computing for the x, y of the Box (center of the objection).
Ind darknet, the x, y were computed (by divided by l.side) in "detection_layer.c".
`
box truth = float_to_box(net.truth + truth_index + 1 + l.classes, 1);
truth.x /= l.side;
truth.y /= l.side;
for(j = 0; j < l.n; ++j){
int box_index = index + locations*(l.classes + l.n) + (i*l.n + j) * l.coords;
box out = float_to_box(l.output + box_index, 1);
out.x /= l.side;
out.y /= l.side;
if (l.sqrt){
out.w = out.w*out.w;
out.h = out.h*out.h;
}
float iou = box_iou(out, truth);
`
While in caffe-yolo, the x, y were computed:
`
if (constriant_) {
true_box[0] = true_box[0] * side_ - Dtype(j % side_);
true_box[1] = true_box[1] * side_ - Dtype(j / side_);
}
`
The difference lays in whether to take a Dtype(j % side_)
item for translate the cell relative position to the image relative position. I think your code is correct. But I am not sure.
Metadata
Assignees
Labels
No labels