wawawaaw
안녕하세요
wawawaaw
전체 방문자
오늘
어제
  • 분류 전체보기 (33)
    • Programming (13)
      • Debugging (0)
      • Linux (5)
      • CUDA (5)
      • Git (1)
    • AI Research (14)
      • Tracking (2)
      • Object Detection (9)
      • Dataset (1)
      • GPU (2)
    • Paper Review (1)
    • 보안 (2)
    • Book Review (0)
    • Etc. (2)
      • 자격증 (1)

인기 글

최근 글

티스토리

반응형
hELLO · Designed By 정상우.
wawawaaw

안녕하세요

[Object Detection] 오픈소스로 detection 결과 mAP 측정하기
AI Research/Object Detection

[Object Detection] 오픈소스로 detection 결과 mAP 측정하기

2023. 1. 13. 16:39
반응형

⭐ 아래 깃허브 주소를 들어가면 object detection의 정확도(mean average precision)를 편리하게 계산해주는 오픈 소스가 나온다. labeling된 txt 파일이 있다면, map를 계산해준다. object 별로 precision과, true와 false prediction의 비율도 그래프로 보여준다. 본 포스팅에서는 detection 진행한 결과를 이 툴을 이용해서 정확도를 계산하는 방법을 다룬다. 

 

GitHub - Cartucho/mAP: mean Average Precision - This code evaluates the performance of your neural net for object recognition.

mean Average Precision - This code evaluates the performance of your neural net for object recognition. - GitHub - Cartucho/mAP: mean Average Precision - This code evaluates the performance of your...

github.com

map tool을 이용해서 그릴 수 있는 그래프 예

 

실행 방법 

1. Ground-truth 파일 생성하기 

아래와 같은 형식으로 txt 파일을 생성해준다. 

<class_name> <left> <top> <right> <bottom> [<difficult>]
  • 예시 : img1.txt (img1.jpg에 대한 ground truth 파일) 
tvmonitor 2 10 173 238
book 439 157 556 241
book 437 246 518 351 difficult
pottedplant 272 190 316 259

2. 생성한 Ground-truth 파일들을  input/ground-truth/ 아래의 경로에 두기 

 

3. Detection 진행한 결과 텍스트 파일을 생성한다. 

yolo등을 이용하여 object detection 진행하고, detection 한 결과 txt 파일을 아래와 같은 형식으로 생성한다.

<class_name> <confidence> <left> <top> <right> <bottom>
  • 예시 : img1.txt 
tvmonitor 0.471781 0 13 174 244
cup 0.414941 274 226 301 265
book 0.460851 429 219 528 247

4. detection 결과 파일을 input/detection-results/ 아래의 경로에 둔다. 

5. 코드 실행하기

  • 기본 실행 방법 
python main.py
  • 태그
    • -na : no animation , detection 매칭 결과를 보고 저장하고 싶지 않는 경우 사용
    • -np : no plot , 결과 그래프를 저장히지 않는 경우 사용
    • -q : quiet , 콘솔로 map 결과만을 보는 경우 사용
    • -i : ignore, 무시하고 싶은 class가 있는 경우 사용 
    • --set-class-iou : 특정 클래스에만 적용하고 싶은 iou 값이 있는 경우 사용 
  • 태그 활용 예 
python main.py -na -np 
python main.py -q 
python main.py -i person book 
python main.py --set-class-iou person 0.5

6. 결과 

/output 폴더 아래이 보면 결과 그래프를 확인할 수 있다. 

 

 

Classes 폴더를 보면 class 별로 생성된  Precision-Recall 그래프를 확인할 수 있다. 

-na 태그를 작성하지 않았다면 /images 아래에 detection 결과를 확인할 수 있다. 

반응형
저작자표시 (새창열림)

'AI Research > Object Detection' 카테고리의 다른 글

[Object Detection] Yolov5 dataloaders.py 코드 분석  (0) 2023.04.08
[Object Detection] Python image padding 하는 방법  (0) 2023.04.08
[Object Detection] mmdetection의 input image size 변경하는 방법 (Faster r-cnn)  (0) 2022.12.28
[Object Detection] YOLOv5로 multi stream, multi camera object detection하는 법/ 동시에 여러 video detection 진행하기  (3) 2022.08.08
[Object Detection] YOLOv5 이미지 사이즈 변경하는 법 (How to change YOLOv5 image resolution)  (0) 2022.08.08
    'AI Research/Object Detection' 카테고리의 다른 글
    • [Object Detection] Yolov5 dataloaders.py 코드 분석
    • [Object Detection] Python image padding 하는 방법
    • [Object Detection] mmdetection의 input image size 변경하는 방법 (Faster r-cnn)
    • [Object Detection] YOLOv5로 multi stream, multi camera object detection하는 법/ 동시에 여러 video detection 진행하기
    wawawaaw
    wawawaaw
    안녕하세요.

    티스토리툴바