0
$\begingroup$

Let's say I build training data for classic YOLOv2 from paper: https://arxiv.org/pdf/1612.08242.pdf let me know if I understand output format correctly.

Example Bounding box from picture:

  • bounding box: {class: 2, confidence: 1, x: 0.698, y: 0.667, h: 0.145, w: 0.084, grid_cell: (9, 8)}

Data settings:

  • grid size: 13x13
  • classes: 4
  • anchor boxes: 5. My bounding box is closest to: {'w': 0.0559, 'h': 0.0954}.

x, y, w and h are normalized in regards to whole image.

Th paper says that:

Instead of predicting offsets we follow the approach of YOLO and predict location coordinates relative to the location of the grid cell. This bounds the ground truth to fall between 0 and 1.

and:
enter image description here

Moreover to go from x, y, w, h to t(x), t(y), t(w) and t(h) I need revert this equations:
enter image description here
t(x) = x - cx = 0.698 - 9/13 = 0.0056
t(y) = y - cy = 0.667 - 8/13 = 0.0516
t(w) = ln(bw / pw) = ln(0.084 / 0.0559) = 0.4072
t(h) = ln(bh / ph) = ln(0.145 / 0.0954) = 0.4186

Fianlly does it mean that my target array looks like:
total output shape OUTPUT = 13 x 13 x 5[anchors] * (5[bbox_details] + 4[classes])
this bounding box will be assigned in OUTPUT[9, 8, 9:18] = BBOX_ARRAY

BBOX_ARRAY = [1, 0.0056, 0.0516, 0.4072, 0.4186] + [0, 0, 1, 0]

$\endgroup$
1
  • $\begingroup$ btw. I know that ultralytics/darknet simplifies the whole process but in this example I'm building the entire architecture from scratch for learning purpose. $\endgroup$ Feb 21 at 13:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.