Tuesday, 2 February 2021

Assigning a label to its corresponding grid cell

I coded a YOLO model from scratch and have a numpy array which looks like this:

[
 [[1 0 1 0.4 0.3 0.2 0.1]
 [1 1 0 0.2 0.3 0.4 0.5]
 [0 0 0 0 0 0 0]]
 ...]

This is how it would look in a pandas object:

Obj_score c1 c2 x y h w 
1 0 1 0.4 0.3 0.2 0.1
1 1 0 0.2 0.3 0.4 0.5
0 0 0 0 0 0 0

In order to make my model work I have to convert the mentioned label tensor into a S*S*(B*5+C) tensor, where I have to put each label into its corresponding grid cell. How would I do that?

The model of mine makes 3 bounding box predictions (which is called B), 2 class predictions (which is called C), and it S = 7. How would I put my labels into its corresponding grid cell (by using numpy or keras)?



from Assigning a label to its corresponding grid cell

No comments:

Post a Comment