<p>According to the <a href="https://arxiv.org/pdf/1506.02640.pdf" rel="nofollow noreferrer">paper (section 2)</a>, the <code>S x S x (B * 5 + C)</code> shaped output represents the <code>S x S</code> grid cells that YoloV1 splits the image into. The last layer can be implemented as a fully connected layer with an output length <code>S x S x (B * 5 + C)</code>, then you can simply reshape the output to a 3D shape.</p>
<p>The paper states that:</p>
<p>&quot;Our system divides the input image into an S × S grid.
If the center of an object falls into a grid cell, that grid cell
is responsible for detecting that object.&quot;</p>
<p>Meaning you have to assign each label to its corresponding grid cell in order to do backpropagation. For reference, a keras/tensorflow implementation of the loss calculation can be found <a href="https://github.com/FMsunyh/keras-yolo/blob/master/core/layers/_losses.py" rel="nofollow noreferrer">here</a> (by the github user FMsunyh).</p>
Yolo from scratch dataset and output
<p>Hi I coded a YOLO model from scratch and just came to realise that my dataset does not fit the models output. This is what I mean:
The model outputs a <code>S x S x (B * 5 + C)</code> matrix.
The shape of y[0] (the answer for the first image) is <code>(7,5)</code>.
How will I make the model use the labels of mine.
From what I knew and read the labels come in this format <code>x,y,w,h,objectiveness_score, class_scores</code> for the yolo algorithm so how come that the model will output a 3D matrix while the labels are a 2d matrix.</p>
<p>How will I solve the issue of mine by using numpy and keras?</p>