사냥꾼의 IT 노트

Pytorch를 이용한 YOLO v3 논문 구현 #6 - 최종 실행 본문

YOLO

Pytorch를 이용한 YOLO v3 논문 구현 #6 - 최종 실행

가면 쓴 사냥꾼 2022. 9. 27. 06:32

※본 포스팅은 아래 블로그를 참조해 번역하고 공부한 것입니다.

https://blog.paperspace.com/how-to-implement-a-yolo-object-detector-in-pytorch/

 

Tutorial on implementing YOLO v3 from scratch in PyTorch

Tutorial on building YOLO v3 detector from scratch detailing how to create the network architecture from a configuration file, load the weights and designing input/output pipelines.

blog.paperspace.com

YOLO v3를 구현하기 위한 모듈 및 라이브러리의 버전은 다음과 같습니다.

Requirements

  • Windows 10
  • python 3.10.6
  • pytorch 1.12.1
  • opencv 4.6.0
  • cuda 11.3.1 및 cudnn
  • six 1.16.0

Installation

 

GitHub - ayooshkathuria/YOLO_v3_tutorial_from_scratch: Accompanying code for Paperspace tutorial series "How to Implement YOLO v

Accompanying code for Paperspace tutorial series "How to Implement YOLO v3 Object Detector from Scratch" - GitHub - ayooshkathuria/YOLO_v3_tutorial_from_scratch: Accompanying code for Pap...

github.com

 

YOLO: Real-Time Object Detection

YOLO: Real-Time Object Detection You only look once (YOLO) is a state-of-the-art, real-time object detection system. On a Pascal Titan X it processes images at 30 FPS and has a mAP of 57.9% on COCO test-dev. Comparison to Other Detectors YOLOv3 is extremel

pjreddie.com


Execution

  • 본인이 설정한 가상환경 터미널을 열어줍니다. 저는 anaconda prompt를 사용했습니다.

  • 가상환경에 설치된 라이브러리와 모듈 버전을 확인합니다.

  • 깃허브에서 다운로드한 파일들을 확인합니다. 가중치 파일도 같은 폴더에 넣어줍니다.

  • 이미지 확인: 코드 입력으로 객체 검출을 시행할 수 있습니다.
python detect.py --images imgs/woman-car.png --det det/

정상 실행됐을 경우의 프롬프트 화면입니다. 

  • predicted in 2.168 seconds: 예측하는데 2.168초 걸림
  • Objects Detected peson car: coco datasets의 클래스 중 하나인 peson과 car 객체가 검출 됨
  • Task: 각 로직 실행에 걸린 시간 표시

det 디렉토리 밑에 output 이미지가 det_을 붙인채로 저장된 걸 확인할 수 있습니다.

  • 비디오 확인: 코드 입력으로 객체 검출을 시행할 수 있습니다.
python video.py --video video/test.mp4

https://www.youtube.com/watch?v=zHTK7GJ6D8A 

비디오 객체 검출을 녹화해 유튜브에 올렸습니다. 객체가 잘 검출되는 걸 확인할 수 있습니다.