コンテンツへスキップ

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.0PyTorch>=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 リリース.V100GPU 、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 29 days ago

コメント