YOLOv5 ์ค์น
1. ๊นํ ํด๋ก
git clone <https://github.com/ultralytics/yolov5> # clone
cd yolov5
pip install -r requirements.txt # ํ์ํ ํจํค์ง ์ค์น
2. Object Detection
- clone ํ์ง ์์ ๊ฒฝ์ฐ
PyTorch Hub์์ ์ง์ ์คํ
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - yolov5x6, custom
# Images
img = '<https://ultralytics.com/images/zidane.jpg>' # or file, Path, PIL, OpenCV, numpy, list
# Inference
results = model(img)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
- clone ํ ๊ฒฝ์ฐ
์คํ ๊ฒฐ๊ณผ๋ ./runs/detect์ ์ ์ฅ
python detect.py --source # OPTION
0 # ์ฐ๊ฒฐ๋ webcam์์ ์ค์๊ฐ์ผ๋ก detect
ํ์ผ์ด๋ฆ.jpg # image
ํ์ผ์ด๋ฆ.mp4 # video
screen # screenshot
๋๋ ํฐ๋ฆฌ์ด๋ฆ/ # directory
'path/*.jpg' # glob
'<https://youtu.be/Zgi9g1ksQHc>' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
- Training
YOLOv5 COCO ๊ฒฐ๊ณผ ์ฌํ
models, datasets๋ ์ต์ YOLOv5์์ ์๋์ผ๋ก ๋ค์ด
YOLOv5n/s/m/l/x์ ํ๋ จ ์๊ฐ์ V100 GPU์์ 1/2/4/6/8์ผ
python train.py --data coco.yaml --cfg yolov5n.yaml --weights '' --batch-size 128
yolov5s 64
yolov5m 40
yolov5l 24
yolov5x 16
custom dataset์ผ๋ก ํ์ต์ํค๋ ๋ฒ์ ์๋ ๊ธ์ ๋ ์์ธํ๊ฒ ๋์์๋ค
's t u d y . . ๐ง > AI ์ค ML ์ค DL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Transfer Learning] ์ ์ดํ์ต ๊ฐ๋ (1) | 2022.10.08 |
---|---|
[YOLOv5] ํ์ต๋ ๋ชจ๋ธ๋ก ์ด๋ฏธ์ง test ํ ํ ํ์ผ์ ์ ์ฅํ๊ธฐ (0) | 2022.10.08 |
[YOLOv5] Custom Dataset์ผ๋ก Pothole detection (0) | 2022.10.07 |
[CNN] Custom Dataset์ผ๋ก Pothole detection (1) | 2022.10.05 |
[YOLOv3] Object Detection๊ณผ Bounding Box (0) | 2022.10.02 |