Precision-Recall Curve, mAP

HyungSeop Lee·2024년 2월 12일
0
post-thumbnail

Confusion Matrix(TP, TN, FP, FN)

  • Confusion Matrix :


IoU (Intersection over Union)


Precision & Recall

  • Precision :
    model prediction이 Positive인 것 중에서 Ground Truth도 Positive인 비율.
    (사람을 10명 detection했는데, 그 중 4명을 옳게 detection했다면 precision은 0.4)
    • TP + FP : model prediction이 Positive.
    • TP : model prediction이 Positive. Ground Truth도 Positive.
  • Recall :
    Ground Truth가 Positive인 것 중에서 model prediction도 Positive인 비율.
    (사람을 10명 옳게 detection해야 하는데, 5개만 옳다고 detection했다면 recall = 0.5)
    • TP + FN : Ground Truth가 Positive인 경우.
    • TP : model prediction이 Positive. Ground Truth도 Positive.


Confidence Score

  • Confidence Score는 Object detection마다 차이가 있지만,
    보편적으로 찾은 bounding box 안에 object가 있을 확률을 의미.

  • 단순하게 물체가 있을 확률로 계산되기도 하고,
    물체가 있을 확률 IoU로 계산되기도 하고,
    정확히 어떤 물체의 Class일 확률
    IoU가 되고도 함.


PR Curve

  • PR Curve :
    object detection algorithm 성능을 평가하는 방법 중 하나로,
    confidence score에 대한 threshold값의 변화에 따라 precision과 recall값들도 달라지는데,
    이것을 그래프로 나타낸 것이 PR curve이다.
    (confidence score threshold가 0.4라면, confidence score로 0.4 미만을 갖는 detection은 무시된다.)
    (출처 : https://ctkim.tistory.com/entry/mAPMean-Average-Precision-%EC%A0%95%EB%A6%AC)

  • 아래 예제에서 15개의 번호판이 존재하는 image에서 총 10개의 image가 detection되었다고 가정하고,

    1. confidence score threshold가 0.9인 매우 높은 threshold를 갖는 상황이라고 가정하면,
      단 한 개만 detection되었다고 판단할 것이다.
      이때,
      Precision = 1 / 1 = 1
      Recall = 1 / (15) = 0.067
    2. confidence score threshold가 0.1인 매우 낮은 threshold를 갖는 상황이라고 가정하면,
      10개 중에 7개가 제대로 detection(TP)되었고, 3개는 잘못 detection(FP)되었으니
      이때,
      Precision = 7 / (7 + 3) = 0.7
      Recall = 7 / (15) = 0.47
    • 위와 같은 confidence score threshold에 따른 precision, recall 값을 graph로 나타낸 것이 바로 PR Curve이다.

Average Precision (AP)

  • Average Precision (AP) :
    PR Curve는 두 algorithm의 성능을 정량적으로 비교하기 힘들다는 한계가 있다.
    그래서 PR Curve 아래 쪽의 면적을 계산하여 비교한다.
    보통 계산하기 전에 PR Curve를 단조적으로 감소하는 graph로 변경해준다.
    이를 Average Precision이라고 한다.
    Average precision이 높을수록 algorithm의 성능이 좋다는 의미이다.

mean Average Precision(mAP)

  • mean Average Precision(mAP) :
    object의 class가 여러 개인 경우, 각 class 당 AP를 구한 다음에 그것의 평균을 계산한 것.
profile
model compression

0개의 댓글