Ultralytics YOLO is a state-of-the-art computer vision framework supporting multiple tasks including object detection, instance segmentation, image classification, pose estimation, and oriented bounding box detection. This skill provides comprehensive guidance for using YOLO effectively.
Latest Model: YOLO26 (released January 2026) features end-to-end NMS-free inference and optimized edge deployment. For stable production workloads, both YOLO26 and YOLO11 are recommended.
# Install/update Ultralytics
pip install -U ultralytics
# Verify installation and check environment
yolo checks
The yolo checks command validates Python version, PyTorch, CUDA, GPU availability, and all dependencies. For detailed environment troubleshooting, see Environment Check or use the provided environment check script: python scripts/check_environment.py.
from ultralytics import YOLO
# Load a model (YOLO automatically infers task from model)
model = YOLO("yolo26n.pt") # or your custom model path
# Predict on various sources
# By default, outputs are saved to workspace/yolo-vision folder
results = model("image.jpg") # image file → saved to yolo-vision/outputs/images/
results = model("video.mp4", stream=True) # video with streaming → saved to yolo-vision/outputs/videos/
results = model("https://example.com/image.jpg") # URL → saved to yolo-vision/outputs/images/
results = model(0, show=True) # webcam with display → saved to yolo-vision/outputs/videos/
# Custom output directory (optional)
results = model("image.jpg", project="/custom/path") # save to custom directory
# Basic syntax: yolo TASK MODE ARGS
# By default, outputs are saved to workspace/yolo-vision folder
yolo predict model=yolo26n.pt source="image.jpg" # → saved to yolo-vision/runs/detect/predict/
# Task-specific examples
yolo detect predict model=yolo26n.pt source="video.mp4" # → saved to yolo-vision/runs/detect/predict/
yolo segment predict model=yolo26n-seg.pt source="image.jpg" # → saved to yolo-vision/runs/segment/predict/
yolo pose predict model=yolo26n-pose.pt source="image.jpg" # → saved to yolo-vision/runs/pose/predict/
# Custom output directory (optional)
yolo predict model=yolo26n.pt source="image.jpg" project="/custom/path" # save to custom directory
For quick start, use these default models:
yolo26n.pt (nano), yolo26s.pt (small), yolo26m.pt (medium)yolo26n-seg.pt, yolo26s-seg.pt, yolo26m-seg.ptyolo26n-cls.pt, yolo26s-cls.pt, yolo26m-cls.ptyolo26n-pose.pt, yolo26s-pose.pt, yolo26m-pose.ptyolo26n-obb.pt, yolo26s-obb.pt, yolo26m-obb.ptFor complete model list and selection guidance: Model Names | Model Selection
YOLO supports five main computer vision tasks. Choose the right task for your application:
Detailed comparison: Task Types
Consider these factors when selecting a model:
Guidance: Model Selection
Common configuration parameters:
conf: Confidence threshold (default: 0.25)iou: IoU threshold for NMS (default: 0.7)imgsz: Input image size (default: 640)device: Device ID (0 for first GPU, cpu for CPU)save: Save results to diskshow: Display results in real-timeComplete examples: Configuration Samples
YOLO returns Results objects containing:
boxes: Bounding boxes, confidence scores, class labelsmasks: Segmentation masks (for segmentation tasks)keypoints: Pose keypoints (for pose estimation)probs: Classification probabilities (for classification)obb: Oriented bounding boxes (for OBB tasks)from ultralytics import YOLO # Load a model model = YOLO("yolo26n.pt") # Train on custom dataset results = model.train(data="dataset.yaml", epochs=100, imgsz=640)7w4.net小蔥技能站,你的AI助手技能庫。
Training guide: Training Basics | Dataset Preparation
Multiple installation methods available:
pip install -U ultralyticsconda install -c conda-forge ultralyticsDetailed instructions: Installation Guide
stream=True for videos/long sequences to reduce memory| Document | Description |
|---|---|
| Environment Check | Comprehensive environment validation and troubleshooting |
| Installation Guide | All installation methods (pip, Conda, Docker, source) |
| Task Types | Detailed comparison of YOLO tasks and use cases |
| Model Names | Complete YOLO26 model list with specifications |
| Model Selection | Strategy for choosing models based on requirements |
| Configuration Samples | Parameter configuration examples for various scenarios |
| Dataset Preparation | Guide for preparing custom datasets for training |
| Training Basics | Fundamentals of training YOLO models on custom data |
| Parameter Reference | Complete reference for all YOLO configuration parameters |
To save token usage and provide ready-to-use tools, the following Python scripts are available in the scripts/ directory:
| Script | Description | Usage Example |
|---|---|---|
| check_environment.py | Comprehensive environment diagnostics | python scripts/check_environment.py |
| config_templates.py | Ready-to-use configuration templates | from scripts.config_templates import get_production_config |
| dataset_tools.py | Dataset preparation and conversion tools | from scripts.dataset_tools import coco_to_yolo |
| training_helpers.py | Training, evaluation, and model management | from scripts.training_helpers import evaluate_model |
| quick_tests.py | Quick functionality tests | python scripts/quick_tests.py --test environment |
| model_utils.py | Model selection and validation utilities | from scripts.model_utils import select_model |
Benefits of using scripts:
Q: yolo command not found after installation?
A: Try python -m ultralytics yolo or check Python environment PATH.
Q: How to use specific GPU?
A: Set device=0 (first GPU) or device=cpu for CPU-only mode.
Q: Model downloads slowly?
A: Set ULTRALYTICS_HOME environment variable to control cache location.
Q: How to filter specific classes?
A: Use classes parameter: classes=[0, 2, 5] (class indices).
Q: Memory issues with long videos?
A: Use stream=True to process videos as generators.
Q: Real-time webcam support?
A: Yes, use source=0 (default camera) with show=True for live display.
yolo checks to diagnose environment issuesWhen processing images or videos with YOLO, if the user does not specify an output directory, all generated files will be saved to the workspace's yolo-vision folder.
The yolo-vision folder will be organized as follows:
yolo-vision/
├── inputs/ # Original input files (copied for reference)
├── outputs/ # Processed files with detection results
│ ├── images/ # Detected images
│ ├── videos/ # Detected videos
│ └── previews/ # Preview images
├── reports/ # Analysis reports and statistics
│ ├── json/ # JSON format reports
│ ├── markdown/ # Markdown format reports
│ └── csv/ # CSV format data
├── models/ # Downloaded YOLO models
│ ├── yolo26/ # YOLO26 models
│ ├── yolo11/ # YOLO11 models
│ └── custom/ # Custom trained models
└── logs/ # Processing logs and debug information
The skill will automatically:
yolo-vision folder if it doesn't exist# Without specifying output directory - uses default yolo-vision folder
results = model("image.jpg") # Output saved to yolo-vision/outputs/images/
# With custom output directory
results = model("image.jpg", save_dir="/custom/path") # Uses specified path
Users can still specify custom output directories when needed:
save_dir parameter in Python code--project flag in CLI commandsULTRALYTICS_PROJECT environment variableLicense Note: Ultralytics YOLO is available under AGPL-3.0 for open source use and Enterprise License for commercial applications. Review licensing at https://ultralytics.com/license.
這個 YOLO 視覺工具包質量較好,內容豐富實用。它完整覆蓋了目標檢測、影像分類、例項分割、姿態估計、物體跟蹤等多種視覺任務,配有詳細的中英文使用說明和豐富的程式碼示例。提供了安裝指南、模型選擇建議、環境檢查工具等實用功能,新手也能快速上手。美中不足的是,部分輔助文件和工具指令碼的內容深度還有提升空間。總體而言,這是一個值得信賴、功能全面的 YOLO 工具包。