์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

YOLOv5 ๋น ๋ฅธ ์‹œ์ž‘ ๐Ÿš€

Embark on your journey into the dynamic realm of real-time object detection with YOLOv5! This guide is crafted to serve as a comprehensive starting point for AI enthusiasts and professionals aiming to master YOLOv5. From initial setup to advanced training techniques, we've got you covered. By the end of this guide, you'll have the knowledge to implement YOLOv5 into your projects confidently. Let's ignite the engines and soar into YOLOv5!

์„ค์น˜

๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ๋ณต์ œํ•˜๊ณ  ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜์—ฌ ์ถœ์‹œ๋ฅผ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ•„์š”ํ•œ ๋ชจ๋“  ์š”๊ตฌ ์‚ฌํ•ญ์ด ์„ค์น˜๋ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. Python>=3.8.0 ๋ฐ PyTorch>=1.8 ์ด ์ค€๋น„๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

git clone https://github.com/ultralytics/yolov5  # clone repository
cd yolov5
pip install -r requirements.txt  # install dependencies

Inference with PyTorch Hub

์ตœ์‹  YOLOv5 ๋ฆด๋ฆฌ์Šค์—์„œ ๋ชจ๋ธ์„ ์›ํ™œํ•˜๊ฒŒ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” YOLOv5 PyTorch ํ—ˆ๋ธŒ ์ถ”๋ก ์˜ ๊ฐ„ํŽธํ•จ์„ ๊ฒฝํ—˜ํ•ด ๋ณด์„ธ์š”.

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.

detect.py๋ฅผ ์‚ฌ์šฉํ•œ ์ถ”๋ก 

ํ•˜๋„ค์Šค detect.py ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ์†Œ์Šค์— ๋Œ€ํ•œ ๋‹ค์–‘ํ•œ ์ถ”๋ก ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ž๋™์œผ๋กœ ๋‹ค์Œ์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ๋ชจ๋ธ ์ตœ์‹  YOLOv5 ๋ฆด๋ฆฌ์Šค ๋ฅผ ํด๋ฆญํ•˜๊ณ  ๊ฒฐ๊ณผ๋ฅผ ์‰ฝ๊ฒŒ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

python detect.py --weights yolov5s.pt --source 0                               # webcam
                                               image.jpg                       # image
                                               video.mp4                       # video
                                               screen                          # screenshot
                                               path/                           # directory
                                               list.txt                        # list of images
                                               list.streams                    # list of streams
                                               'path/*.jpg'                    # glob
                                               'https://youtu.be/LNwODJXcvt4'  # YouTube
                                               'rtsp://example.com/media.mp4'  # RTSP, RTMP, HTTP stream

๊ต์œก

๋ณต์ œ YOLOv5 COCO ๋ฒค์น˜๋งˆํฌ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์•„๋ž˜ ์ง€์นจ์„ ์ฐธ์กฐํ•˜์„ธ์š”. ํ•„์š”ํ•œ ๋ชจ๋ธ ๊ทธ๋ฆฌ๊ณ  ๋ฐ์ดํ„ฐ ์„ธํŠธ ์—์„œ ์ง์ ‘ ๊ฐ€์ ธ์˜จ ๊ฒƒ์ž…๋‹ˆ๋‹ค. YOLOv5 ๋ฆด๋ฆฌ์Šค. V100 GPU ์—์„œ YOLOv5n/s/m/l/x๋ฅผ ๊ต์œกํ•˜๋Š” ๋ฐ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ๊ฐ๊ฐ 1/2/4/6/8์ผ์ด ์†Œ์š”๋ฉ๋‹ˆ๋‹ค. ๋ฉ€ํ‹ฐGPU ์„ค์ •์ด ๋” ๋น ๋ฅด๊ฒŒ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค). ๊ฐ€๋Šฅํ•œ ์ตœ๊ณ  ์ˆ˜์ค€์˜ --batch-size ๋˜๋Š” --batch-size -1 ์— ๋Œ€ํ•œ YOLOv5 ์ž๋™ ๋ฐฐ์น˜ feature. The following batch sizes are ideal for V100-16GB GPUs.

python train.py --data coco.yaml --epochs 300 --weights '' --cfg yolov5n.yaml  --batch-size 128
                                                                 yolov5s                    64
                                                                 yolov5m                    40
                                                                 yolov5l                    24
                                                                 yolov5x                    16

YOLO ๊ต์œก ๊ณก์„ 

To conclude, YOLOv5 is not only a state-of-the-art tool for object detection but also a testament to the power of machine learning in transforming the way we interact with the world through visual understanding. As you progress through this guide and begin applying YOLOv5 to your projects, remember that you are at the forefront of a technological revolution, capable of achieving remarkable feats. Should you need further insights or support from fellow visionaries, you're invited to our GitHub repository home to a thriving community of developers and researchers. Keep exploring, keep innovating, and enjoy the marvels of YOLOv5. Happy detecting! ๐ŸŒ ๐Ÿ”


๐Ÿ“… Created 11 months ago โœ๏ธ Updated 18 days ago

๋Œ“๊ธ€