Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Object Confidence Loss

\small \sum^{i = s^2}_{i = 0} \sum^{j = B}_{j = 0 } 1^{obj}_{ij}(C_i


-\hat{C_{i}})^2 +\lambda_{noobj}\sum^{i = s^2}_{i = 0} \sum^{j = B}_{j = 0
} 1^{noobj}_{ij}{obj}_{ij}(C_i -\hat{C_{i}})^2∑i=0i=s2∑j=0j=B1ijobj(Ci−Ci^)2+λnoobj
∑i=0i=s2∑j=0j=B1ijnoobjobjij(Ci−Ci^)2

 The above loss is with respect to object confidence error. Here C is the actual
object confidence score, which is equal to one and \hat{C}C^ is the intersection
over union between predicted and ground truth box.
 1_{noobj}1noobj is one when there is no object in the cell and zero otherwise.
 The parameter \lambdaλ that you have seen in the dimension loss and in this
formula is used to differentially weigh the parts of loss function.

Keras
 Keras API is built on top of TensorFlow.
 It is more user friendly and easier to use when compared to TensorFlow.
 For now, we will use only a few APIs of keras for Object detection.
 You will learn more on keras in transfer learning.

YOLO Pretrained Model


 In the upcoming hands-on, you will be using yolo-v2 pre-trained model for object
detection.
 The model weights has been downloaded for you from the darknet website.
Model Details
 The yolo-v2 model has been trained over images of shape (m, 608, 608, 3),
where m is the number of samples.
 The model predicts 5 anchor boxes for each of 19 x 19 grid cells and can classify
over 80 different classes.
 Each of the anchor boxes has five parameters i.e. b_xbx, b_yby, b_hbh, b_w$
and p_cpc.
 Thus the final dimension of output of an entire image is (19 x 19 x 5 x 85) .

Output Tensors
 For the sake of computation, we rearrange the yolo out dimension as:
o box_confidence: tensor of shape (19 \times 19, 5, 1)
(19×19,5,1) containing p_cpc (confidence probability that there's some
object) for each of the 5 boxes predicted in each of the 19x19 cells.
o boxes: tensor of shape (19\times 19, 5, 4)(19×19,5,4) containing (b_x,
b_y, b_h, b_w)(bx,by,bh,bw) for each of the 5 boxes per cell.
o box_class_probs: tensor of shape (19 \times 19, 5, 80)
(19×19,5,80) containing the detection probabilities (c_1, c_2, ...
c_{80})(c1,c2,...c80) for each of the 80 classes for each of the 5 boxes
per cell.


4  of 10

Probability Score
 Now in each grid cell for each of the five predicted anchor box we compute the
probability score that the box contains a certain class.
 This is computed by multiplying the confidence score p_cpc of an anchor box
with its corresponding class probabilities.
 This score is computed for each anchor box in entire 19 x 19 grid cells.

box_scores = box_confidence * box_class_p

You might also like