Yan Linxuan
Yan Linxuan

Reputation: 38

How to label training data for YOLO

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

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)

Upvotes: 2

Views: 2108

Answers (1)

Gokulakannan
Gokulakannan

Reputation: 128

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 as below.

enter image description here

Upvotes: 2

Related Questions