Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

python - 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)?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...