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)?
If it would help here some code from Vivek Maskara's solution to this issue which can also be found in his article about implementing YOLO v1 in scratch.
question from:
https://stackoverflow.com/questions/65936033/assigning-a-label-to-its-corresponding-grid-cell 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…