I am having a question on how to label training data for YOLO algorithm.

Let's say that each label Y, we need to specify [Pc, bx, by, bh, bw], where Pc is the indicator for presence(1=present, 0=not present), (bx, by) is relative position of the center of the object-of-interest, and (bh, bw) is the relative dimension of the bounding box containing the object.

Using picture below as an example, the cell (1,2), which contains a black car, should have a label Y = [1, 0.4, 0.3, 0.9, 0.5]. And for any cells without cars, they should have a label [0, ?, ?, ?, ?] [Coursera Deep Learning Specialization Materials]1 enter image description here

But if we have a finer grid like this, where the dimension of each cells is smaller than the ground truth bounding box. enter image description here

Let's say that the ground truth bounding box for the car is the red box, and the ground truth center point is the red dot, which is in cell 2.

For cell 2 it will have label Y = [1, 0.9, 0.1, 2, 2], is this correct? And for cell 1, 3, 4 what kind of label will they have? Do they have Pc=1 or Pc =0? And if Pc=1, how will the bx and by be? (As i remember that bx, by should have value between 0 and 1. But in cell 1,3,4, there is no center point of the object-of-interest)


in effect the midpoint it's contained in cell 2. Cells 1,3,4 will shown a Pc=0 according to the Y.O.L.O. algorithm which only takes in count the cell that contains the midpoint and calculates the bounding box, as you mentioned, with by bx, by, bh, bw. With the proposition of Y = [1, 0.9, 0.1, 2, 2], I would think that if you take the point (0,0) as the left-upper corner, Y would be more likely to be Y = [1,0.2,0.57,0.21,0.15], being calculated with a grid of 19 x 19. greetings.

Representation of the bx and by values

  • $\begingroup$ Thank you for answering my question. Still I have queries. But What bx, by, bh, bw values should I give for cell 1,3,4 as we are giving Pc as 0? Are you sure that we have to take only the cell contains mid points? Also can you explain the calculations being done for Y = [1,0.2,0.57,0.21,0.15]? Thank you for the help. $\endgroup$ – Gokulakannan Jul 13 '18 at 4:38
  • $\begingroup$ In fact, Y.O.L.O. algorithm doesn't compute any calculations in cells with Pc=0, then the values over these cells (1,3,4) are irrelevant for the algorithm, that's why the representation is [0, ?, ?, ?, ?] . Calculations over bx, by, bh, and bw are computed with a simple rule of three. I attached an image in the answer to represent it. $\endgroup$ – Bitzel Jul 13 '18 at 5:09
  • $\begingroup$ Sorry. I did'nt see any image in the answer. $\endgroup$ – Gokulakannan Jul 13 '18 at 5:11
  • $\begingroup$ done, I just uploaded it. :) $\endgroup$ – Bitzel Jul 13 '18 at 5:12
  • $\begingroup$ Thank you for the answer. what about bh and bw? $\endgroup$ – Gokulakannan Jul 13 '18 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.