Real-time Object Detection with YOLO v5, Hands-on-Lab
1.
YOLO v5를 이용한실시간 객체 탐지
Hands-on-Lab
동의과학대학교
김 종 현 교수
jhkim@dit.ac.kr
2022.7.
2.
• 이미지 전체를단 한번만 본다 : You Only Look Once
- YOLO 이전의 모델 중 대표적인 R-CNN 처럼 이미지를 여러장으로 분할해 해석
하지 않는다.
- YOLO는 이미지 전체를 말 그대로 한 번만 본다.
• 통합된 모델을 사용 : one-stage-detection
- 다른 객체 탐지 모델들은 다양한 전처리 모델과 인공 신경망을 결합하여 사용한
다.
- YOLO는 단 하나의 인공 신경망을 사용하여 처리한다.
• 실시간 객체 탐지 모델
- 기존 모델보다 빠른 성능으로 실시간 객체 탐지가 가능하다.
- 작은 객체에 정확도가 낮다.
3.
Quick Start Examples
•오픈 소스 저장소
• https://github.com/ultralytics/yolov5
• 설치
% git clone https://github.com/ultralytics/yolov5 # clone
% cd yolov5
% pip install -r requirements.txt # install
4.
Pre-trained 모델 추론
importtorch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - y
olov5x6, custom
# Images
img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL,
OpenCV, numpy, list
# Inference
results = model(img)
# Results
results.show() # or .print(), .save(), .crop(), .pandas(), etc.
커스텀 데이터 학습: Custom Data Training
• https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
• Open in Colab
• https://colab.research.google.com/github/roboflow-ai/yolov5-
custom-training-tutorial/blob/main/yolov5-custom-training.ipynb
모델 사용하기
• yolov5를clone 한 local PC 디렉토리에 모델(best.pt) 저장 및
이동
• git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 pip
install -r requirements.txt # install
• detection 실행
%