Answers.Body: <p>Recall is the fraction of the relevant documents that are successfully retrieved.
  <span class="math-container">\begin{aligned}{\text{Recall}}&amp;={\frac {tp}{tp+fn}}\,\end{aligned}</span></p>
  <p>Labels for a Class is equal to total examples which are actually belonging to the class: P = FN + TP</p>
  <p>Hence <code>(FN + TP)* Recall = TP</code></p>
  <p>Precision is the fraction of retrieved documents that are relevant to the query:
  <span class="math-container">\begin{aligned}{\text{Precision}}&amp;={\frac {tp}{tp+fp}}\end{aligned}</span></p>
  <p>Using simple maths you will easily get <code>FP = (TP / Precision) - TP</code></p>
  <p>In your calculation your might have use Images instead of Labels:</p>
  <pre><code>TP = Recall * Labels = 19.98 ≈ 20
  FP = (TP / Precision) - TP = 14
  </code></pre>
  <p>Reference: <a href="https://en.wikipedia.org/wiki/Precision_and_recall" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Precision_and_recall</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-13T17:10:29.050Z
Answers.Text: Thanks, this is what I was looking for! You are right, I used "images" instead of labels.
Answers.UserDisplayName: sneeze_shiny
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-13T17:04:53.753Z
Answers.LastActivityDate: 2022-01-13T17:04:53.753Z
Answers.UserDisplayName: prashant0598
Body: <p>I am running some evaluation metrics using the YOLOv5 object detection algorithm, and wish to calculate my true positives and false positives. For instance, the evaluation metric outputs are as follows:</p>
  <pre><code>   Class          Images    Labels     Prec     Recall     mAP@.5     mAP@.5:.95: 
       all          100         36      0.444      0.702      0.481      0.223
   Class 1          50          29      0.588      0.689      0.668      0.333
   Class 2          50           7      0.301      0.714      0.293      0.113
  </code></pre>
  <p><a href="https://github.com/ultralytics/yolov5/issues/5713" rel="nofollow noreferrer">Looking at this source</a>, I found that you could calculate the true positives and false positives with the following equations:</p>
  <pre><code>#Computed for Class 1
  
  TP = Recall * Labels = 34.45 ≈ 34
  FP = (TP / Precision) - TP = 23.82 ≈ 24
  </code></pre>
  <p>I am new to evaluation metrics, so at first glance, I'm thinking that the false positive number is fairly high. Is this the correct formula to compute the true positives and false positives? I'm just looking for some verification and some explanation as to why this works, if it does.</p>
  
Tags: <deep-learning><object-detection><precision><recall>
Title: Equations for computing true positives and false positives when using object detection algorithms?
UserDisplayName: sneeze_shiny
ThreadText: # Equations for computing true positives and false positives when using object detection algorithms?
  
  (Asked by: username_0 on 2022-01-10)
  
  I am running some evaluation metrics using the YOLOv5 object detection algorithm, and wish to calculate my true positives and false positives. For instance, the evaluation metric outputs are as follows:
  
  ```
     Class          Images    Labels     Prec     Recall     mAP@.5     mAP@.5:.95: 
       all          100         36      0.444      0.702      0.481      0.223
   Class 1          50          29      0.588      0.689      0.668      0.333
   Class 2          50           7      0.301      0.714      0.293      0.113
  
  ```
  
  [Looking at this source](https://github.com/ultralytics/yolov5/issues/5713), I found that you could calculate the true positives and false positives with the following equations:
  
  ```
  #Computed for Class 1
  
  TP = Recall * Labels = 34.45 ≈ 34
  FP = (TP / Precision) - TP = 23.82 ≈ 24
  
  ```
  
  I am new to evaluation metrics, so at first glance, I'm thinking that the false positive number is fairly high. Is this the correct formula to compute the true positives and false positives? I'm just looking for some verification and some explanation as to why this works, if it does.
  
  **Tags:** deep-learning, object-detection, precision, recall
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-13. Score: 1 | Accepted answer
  
  Recall is the fraction of the relevant documents that are successfully retrieved.
  \begin{aligned}{\text{Recall}}&={\frac {tp}{tp+fn}}\,\end{aligned}
  
  Labels for a Class is equal to total examples which are actually belonging to the class: P = FN + TP
  
  Hence `(FN + TP)* Recall = TP`
  
  Precision is the fraction of retrieved documents that are relevant to the query:
  \begin{aligned}{\text{Precision}}&={\frac {tp}{tp+fp}}\end{aligned}
  
  Using simple maths you will easily get `FP = (TP / Precision) - TP`
  
  In your calculation your might have use Images instead of Labels:
  
  ```
  TP = Recall * Labels = 19.98 ≈ 20
  FP = (TP / Precision) - TP = 14
  
  ```
  
  Reference: <https://en.wikipedia.org/wiki/Precision_and_recall>
  
  > **Comments:**
  > **username_0**: Thanks, this is what I was looking for! You are right, I used "images" instead of labels.  
  
  ---
  
  