# How to calculate the class probability of a grid cell in YOLO object detection algorithm?

I am going through the YOLO paper by Redmon, Divvala, Girshick & Farhadi (2015), "You Only Look Once: Unified, Real-Time Object Detection" (arXiV page here )

On the fourth page it mentions the loss function. It's a combined regression loss function.

What I don't understand in how to get the classification error or to find the probability of the class on each grid cell by optimizing it's regression loss.

Here's the YOLO loss function mentioned in it: • Please give a full reference (title, authors, year) in your question and quote the essential parts. The link would probably be better as the arXiV page as it's more likely to be stable in the longer term (and findable if it moves). If at all possible, you should quote enough information/context form the paper that someone might still be able to attempt an answer if they couldn't read the paper, or as near as you can reasonably get with some short quotes/explanation. While editing, please fix the spelling error in the title. (You should also ask a question.) – Glen_b -Reinstate Monica Apr 27 '17 at 10:50
• Thanks for the edit; it's a good start. However it's not really sufficient since there's not enough context in the question itself. – Glen_b -Reinstate Monica Apr 27 '17 at 12:05
• could you please publish this. I really want to know this. – Shamane Siriwardhana Apr 28 '17 at 4:03
• You didn't need me to do it personally; as soon as you edited it went into the review queue. The problem was likely that you hadn't done enough yet for people to vote to reopen and you needed to edit more. I have made some of the changes I asked for. Ideally the image of the page should be replaced with MathJax markup but this will do for the moment – Glen_b -Reinstate Monica Apr 28 '17 at 5:28

Classification loss is included in the formula above. In particular, the term: $$\sum_{i=0}^{S^2} \mathbb{1}_i^{obj}\sum_{c \in classes}(p_i(c) - \hat{p}_i(c))^2$$ corresponds to this description in the paper:
Each grid cell also predicts $C$ conditional class probabilities $Pr(Class_i|Object)$... We only predict one set of class probabilities per grid cell, regardless of the number of boxes $B$.
$Pr(Class_i)$ is equivalent to $p_i(c)$ in the loss. Notice that this description matches the fact that the term above does not sum over $B$, the number of bboxes per grid cell.