OpenCVDNN 으로 YOLO inference 구현 시 유의 사항
- opencv yolo inference 코드는 기존 opencv inference 코드와 다름
- 3개의 output feature map 에서 직접 object detection 정보 추출
Pretrained inference model loading 방법
- weight model file 과 config file은 darknet 사이트에서 download 가능
- cv2.dnn.readNetFromDarknet(config file, weight model file)으로 pretrained inference model loading
- readNetFromDarket(config file, weight model file)에서 config file 인자가 weight model file 인자보다 먼저 위치함
82번 layer, 92번 layer, 106번 layer 등
사용자가 직접 3개의 다른 scale별 구성된 output layer에서 object detect 결과를 추출해야함
사용자가 직접, NMS로 최종 결과 필터링 해야 함
Bounding box 정보 추출 시 직접 85개의 구성에서 추출
- coco 데이터 세트로 pretrained model에서 bbox 정보추출하기
* bounding box 정보를 4개 좌표, 1개 object score, 그리고 80개 class score로 구성된 85개의 정보구성
* class id와 class score는 80개 vector에서 가장 높은 값을 가지는 위치 인덱스와 그값임
추출 좌표의 변환
bx = d(tx)+cx
by = d(ty)+cy
bw = pwe^tw
bh = phe^th
* OpenCV yolo 로 추출한 좌표는 detected object의 center와 width, height 값이므로, 좌상단, 우하단 좌표로 변경 필요.
OpenCV yolo inference 구현 절차
'Computer_Science > Computer Vision Guide' 카테고리의 다른 글
7-10. GPU를 활용한 Object Detection 모델을 활용한 training 수행 시 유의사항 (0) | 2021.10.27 |
---|---|
7-8. OpenCV DNN based yolo v3 inference (0) | 2021.10.27 |
7-6~7. YOLO V3 (0) | 2021.10.25 |
7-4~5. YOLO V2 (0) | 2021.10.25 |
7-2~3. yolo v1 (0) | 2021.10.24 |