Boostcamp AI tech 3기

2. object detection and metrics

mcdn 2023. 1. 31. 17:40
반응형

https://www.boostcourse.org/ai341/lecture/1466824?isDesc=false 

2. Object Detection

2.1. Computer Vision

  • Classification : 사진이 주어졌을 때 무엇인지 예측하는 태스크
  • Object Detection : 이미지 속에서 객체를 식별해내는 태스크. 객체가 어디에 있는 지 찾고, 해당 객체가 무엇인지 식별하는 것
  • Semantic Segmentation : 객체의 영역을 구분하는 태스크, 같은 클래스를 갖는 객체끼리는 구분이 없음
  • Instance Segmentation : 객체의 영역을 구분하는 태스크, 같은 클래스의 객체 역시 구분함

 

2.2. Real World

Semantic Segmentation + Object Detection -> Instance SegmentationReal World에서의 Object Detection 예시

 

kaggle 유명한 데이터셋/대회

https://www.kaggle.com/c/global-wheat-detection

 

Global Wheat Detection | Kaggle

 

www.kaggle.com

 

Real word에서 Object Detection 예시

  • 테슬라 AI 데이에서 테슬라의 자율주행 자동차
  • 사진 속에서 텍스트를 뽑아내는 OCR 태스크
  • 흉부 엑스레이 사진에서 병의 위치를 찾는 태스크
  • CCTV에서 사람을 검출해내는 태스크

 

 

2.3. Object Detection history 

강의에서 모두 다룰 예정 

R-CNN

Fast R-CNN 

Faster R-CNN

YOLO v1 

SSD 

YOLO v2 

FPN 

RetinaNet 

YOLO v3 

PANet 

EfficientDet 

Swin-T

 

2.4. Evaluation 

성능 : mAP , 속도 : FPS, Flops

 

mAP (mean average precision) : 각 클래스당 AP의 평균

  • mAP를 계산하기 위해 필요한 개념
    • Confusion matrix: 
    • Precision: 모델의 예측관점에서 정의한 메트릭, 모델이 Positive 라고 예측한 모든 케이스 중에 옳게 예측한 경우를 precision으로 정의
    • Recall: 정답 관점의 메트릭입니다. 실제 정답 관점에 봤을 때 옳게 예측된 케이스와 틀리게 예측된 케이스가 있을 때 전체 정답중 옳게 예측된 정답의 비율을 의미
    • PR curve: Recall 값에 따른 Precision 값의 변화를 그래프로 그려놓은 것
    • IOU (Intersection Over union): Ground Truth 박스와 Predict 박스 두개의 전체 영역 분에 겹치는 영역을 의미
  • FPS (Frames Per Second): 초당 처리 가능한 프레임 숫자, 크면 클수록 빠른 모델
  • FLOPs (Floating Point Operations): 모델의 연산량을 측정할 수 있는 평가지표

 

A. Confusion Matrix 

 

B. Precision 

the proportion of true positive predictions (correctly predicted positive instances) out of all positive predictions.

정밀도는 모든 양성 예측 중 참 양성 예측(올바르게 예측한 양성 인스턴스)의 비율을 측정합니다.

 

 

C. Recall 

the proportion of true positive predictions out of all positive instances in the datase

재현율은 데이터셋의 모든 양성 에측 중 참(올바른) 양성 예측의 비율을 측정합니다.

 

 

D. PR Curve 

A PR curve is a graph that shows the trade-off between precision and recall. change of precision with recall value.

The x-axis represents recall, y-axis represents precision,

and the curve is a plot of precision as a function of recall for different threshold values.

The curve helps in evaluating the overall performance of the classifier, especially when the class distribution is imbalanced.

 

PR 곡선은 정밀도와 재현율 간의 trade-off를 보여주는 그래프입니다.

x축은 재현율을 나타내고, y축은 정밀도를 나타내고,

곡선은 재현율에 따른 정밀도의 다른 기준값에 대한 그래프입니다.

 

곡선은 특히 클래스 분포가 불균형일 때 분류기의 전체 성능을 평가하는데 도움이 됩니다.

 

 

E. IOU (Intersection Over union): Ground Truth 박스와 Predict 박스 두개의 전체 영역 분에 겹치는 영역을 의미

IOU measures the overlap between the predicted bounding box and the ground truth bounding box in terms of their intersection and union.

IOU is defined as the ratio of the area of intersection to the area of union, and is expressed as a value between 0 and 1. A higher IOU value indicates a more accurate object detection.

 

IOU = (the area of intersection) / (the area of union for two predicted and ground truth bounding box)

 

IOU (교집합/연집합 비율): 

IOU는 object detection 모델이 예측한 경계 상자와 실제 경계 상자 간의 겹침을 교집합과 연집합을 통해 측정합니다.

IOU는 교집합의 면적 대비 연집합의 면적의 비율로 정의되며 0에서 1 사이의 값으로 표현됩니다.

높은 IOU 값은 더 정확한 물체 검출을 나타냅니다.

 

 

 

F. FPS, FLOPs

 

FPS (Frame Per Second) :

초당 프레임이 생성되는 횟수, 높을수록 빠르다는 것을 의미한다.

 

FLOPs (Floating Point Operations) :

Model이 얼마나 빠르게 동작하는 지 측정하는 metric연산량 횟수 (곱하기, 더하기, 빼기 등)

아래의 그림을 보면 한 셀당 곱하기, 더하기 연산을 통해 총 얼마나 연산을 하는지 횟수를 알아볼 수 있다.

 

 

2.5. Library

  • MMDetection : Pytorch 기반의 Object Detection을 위한 오픈 소스
  • Detectron2 : Detectron 2 는 페이스북 AI 리서치의 라이브러리로 pytorch 기반의 Object detection 과 segmentation 의 알고리즘을 제공
  • YOLOv5 : coco 데이터셋으로 사전 학습된 모델로 수천 시간의 연구와 개발에 걸쳐 발전된 Object Detection 모델
  • EfficientDet : EfficientNet을 응용해 만든 Object Detection 모델

 

 

 

 

반응형