YOLOv5 ํต์คํํธ ๐
Ultralytics YOLOv5์ ํจ๊ป ์ค์๊ฐ ๊ฐ์ฒด ํ์ง์ ์ญ๋์ ์ธ ์ธ๊ณ๋ก์ ์ฌ์ ์ ์์ํด ๋ณด์ญ์์ค! ์ด ๊ฐ์ด๋๋ YOLOv5๋ฅผ ๋ง์คํฐํ๋ ค๋ AI ์ ํธ๊ฐ ๋ฐ ์ ๋ฌธ๊ฐ๋ฅผ ์ํ ์ข ํฉ์ ์ธ ์์์ ์ญํ ์ ํ๋๋ก ์ ์๋์์ต๋๋ค. ์ด๊ธฐ ์ค์ ๋ถํฐ ๊ณ ๊ธ ํ์ต ๊ธฐ๋ฒ๊น์ง ๋ชจ๋ ๋ค๋ฃน๋๋ค. ์ด ๊ฐ์ด๋๋ฅผ ๋ง์น ๋์ฏค์ด๋ฉด ์ต์ ๋ฅ๋ฌ๋ ๊ธฐ๋ฒ์ ์ฌ์ฉํ์ฌ ์์ ์๊ฒ ํ๋ก์ ํธ์ YOLOv5๋ฅผ ๊ตฌํํ ์ ์๋ ์ง์์ ์ป๊ฒ ๋ ๊ฒ์ ๋๋ค. ์์ง์ ์ ํํ๊ณ YOLOv5์ ์ธ๊ณ๋ก ๋ ์์ค๋ฅผ ์ค๋น๋ฅผ ํ์ญ์์ค!
์ค์น
YOLOv5 ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ํด๋ก ํ๊ณ ํ๊ฒฝ์ ๊ตฌ์ฑํ์ฌ ์์ํ ์ค๋น๋ฅผ ํ์ญ์์ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ชจ๋ ํ์ ์๊ตฌ ์ฌํญ์ด ์ค์น๋ฉ๋๋ค. ์ด๋ฅ์ ์ํด Python>=3.8.0 ๋ฐ PyTorch>=1.8์ด ์ค๋น๋์๋์ง ํ์ธํ์ญ์์ค. ์ด๋ฌํ ๊ธฐ์ด ๋๊ตฌ๋ YOLOv5๋ฅผ ํจ๊ณผ์ ์ผ๋ก ์คํํ๋ ๋ฐ ๋งค์ฐ ์ค์ํฉ๋๋ค.
git clone https://github.com/ultralytics/yolov5 # clone repository
cd yolov5
pip install -r requirements.txt # install dependenciesPyTorch Hub๋ฅผ ์ฌ์ฉํ ์ถ๋ก
Experience the simplicity of YOLOv5 PyTorch Hub inference, where models are seamlessly downloaded from the latest YOLOv5 release. This method leverages the power of PyTorch for easy model loading and execution, making it straightforward to get predictions.
import torch
# Model loading
model = torch.hub.load("ultralytics/yolov5", "yolov5s") # Can be 'yolov5n' - 'yolov5x6', or 'custom'
# Inference on images
img = "https://ultralytics.com/images/zidane.jpg" # Can be a file, Path, PIL, OpenCV, numpy, or list of images
# Run inference
results = model(img)
# Display results
results.print() # Other options: .show(), .save(), .crop(), .pandas(), etc. Explore these in the Predict mode documentation.detect.py๋ฅผ ์ฌ์ฉํ ์ถ๋ก
Harness detect.py for versatile inference on various sources. It automatically fetches models from the latest YOLOv5 release and saves results with ease. This script is ideal for command-line usage and integrating YOLOv5 into larger systems, supporting inputs like images, videos, directories, webcams, and even live streams.
python detect.py --weights yolov5s.pt --source 0 # webcam
python detect.py --weights yolov5s.pt --source image.jpg # image
python detect.py --weights yolov5s.pt --source video.mp4 # video
python detect.py --weights yolov5s.pt --source screen # screenshot
python detect.py --weights yolov5s.pt --source path/ # directory
python detect.py --weights yolov5s.pt --source list.txt # list of images
python detect.py --weights yolov5s.pt --source list.streams # list of streams
python detect.py --weights yolov5s.pt --source 'path/*.jpg' # glob pattern
python detect.py --weights yolov5s.pt --source 'https://youtu.be/LNwODJXcvt4' # YouTube video
python detect.py --weights yolov5s.pt --source 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP streamํ์ต
Replicate the YOLOv5 COCO dataset benchmarks by following the training instructions below. The necessary models and datasets (like coco128.yaml or the full coco.yaml) are pulled directly from the latest YOLOv5 release. Training YOLOv5n/s/m/l/x on a V100 GPU should typically take 1/2/4/6/8 days respectively (note that Multi-GPU training setups work faster). Maximize performance by using the highest possible --batch-size or use --batch-size -1 for the YOLOv5 AutoBatch feature, which automatically finds the optimal batch size. The following batch sizes are ideal for V100-16GB GPUs. Refer to our configuration guide for details on model configuration files (*.yaml).
# Train YOLOv5n on COCO128 for 3 epochs
python train.py --data coco128.yaml --epochs 3 --weights yolov5n.pt --batch-size 128
# Train YOLOv5s on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5s.yaml --batch-size 64
# Train YOLOv5m on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5m.yaml --batch-size 40
# Train YOLOv5l on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5l.yaml --batch-size 24
# Train YOLOv5x on COCO for 300 epochs
python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5x.yaml --batch-size 16
๊ฒฐ๋ก ์ ์ผ๋ก YOLOv5๋ ์ต์ฒจ๋จ ๊ฐ์ฒด ํ์ง ๋๊ตฌ์ผ ๋ฟ๋ง ์๋๋ผ, ์๊ฐ์ ์ดํด๋ฅผ ํตํด ์ฐ๋ฆฌ๊ฐ ์ธ์์ ์ํธ ์์ฉํ๋ ๋ฐฉ์์ ๋ณํ์ํค๋ ๋จธ์ ๋ฌ๋์ ํ์ ์ฆ๋ช ํ๋ ๊ฒฐ๊ณผ๋ฌผ์ ๋๋ค. ์ด ๊ฐ์ด๋๋ฅผ ์งํํ๋ฉฐ ํ๋ก์ ํธ์ YOLOv5๋ฅผ ์ ์ฉํ๊ธฐ ์์ํ ๋, ๊ทํ๊ฐ ์ปดํจํฐ ๋น์ ๋ถ์ผ์์ ๋๋ผ์ด ์ฑ๊ณผ๋ฅผ ๋ฌ์ฑํ ์ ์๋ ๊ธฐ์ ํ๋ช ์ ์ต์ ์ ์ ์๋ค๋ ์ ์ ๊ธฐ์ตํ์ญ์์ค. ๋ ๋ง์ ํต์ฐฐ๋ ฅ์ด๋ ๋๋ฃ ์ ๊ตฌ์๋ค์ ์ง์์ด ํ์ํ์๋ค๋ฉด ๊ฐ๋ฐ์์ ์ฐ๊ตฌ์๋ค์ ํ๋ฐํ ์ปค๋ฎค๋ํฐ๊ฐ ์๋ ์ ํฌ GitHub ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ด๋ํฉ๋๋ค. ๋ฐ์ดํฐ์ ๊ด๋ฆฌ ๋ฐ ์ฝ๋ ์๋ ๋ชจ๋ธ ํ์ต์ ์ํ Ultralytics Platform๊ณผ ๊ฐ์ ์ถ๊ฐ ๋ฆฌ์์ค๋ฅผ ์ดํด๋ณด๊ฑฐ๋, ์ค์ ์ฌ๋ก์ ์๊ฐ์ ์ป์ผ๋ ค๋ฉด ์๋ฃจ์ ํ์ด์ง๋ฅผ ํ์ธํ์ญ์์ค. ๊ณ์ ํ๊ตฌํ๊ณ ํ์ ํ๋ฉฐ YOLOv5์ ๊ฒฝ์ด๋ก์์ ์ฆ๊ธฐ์ญ์์ค. ์ฆ๊ฑฐ์ด ํ์ง ๋์๊ธธ ๋ฐ๋๋๋ค! ๐ ๐