技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
yolov5【数据与研究】Use this skill for clone-run Ultralytics YOLOv5 workflows: detection, segmentation, classification, export, benchmarks, datasets, weights, and Flask REST serving.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a user asks about Ultralytics YOLOv5 repository workflows: object detection, instance segmentation, image classification, PyTorch Hub loading, dataset YAMLs, pretrained weights, model export, benchmarks, or the bundled Flask REST API example.
YOLOv5 is primarily a clone-run repository, not a normal import-first library. Public workflows use the repository's Python entrypoint names, shared models/ and utils/ modules, YAML configs, and checkpoint files. Prefer the bundled references and helper scripts here before reopening repository docs or examples.
references/repo-provenance.md before deciding whether this skill matches a checkout or needs refresh.references/environment.md for install, clone-run imports, Python/PyTorch requirements, CUDA, and optional extras.references/datasets-and-weights.md before planning training, validation, downloads, named datasets, or checkpoint use.references/model-overview.md when choosing between detection, segmentation, classification, P6, Hub, or exported runtime formats.references/troubleshooting.md for install/import, optional dependency, data/config, download, device, output, export, and service failures.scripts/check_yolov5_env.py --json for a safe active-environment inspection. It imports modules and checks optional dependencies without downloading models, training, exporting, opening media, or starting a server.sub-skills/detection/SKILL.md for detect.py, train.py, val.py, PyTorch Hub loading, COCO-style datasets, bounding boxes, detection checkpoints, and detection-specific failures.sub-skills/segmentation/SKILL.md for segment/predict.py, segment/train.py, segment/val.py, *-seg.pt checkpoints, mask labels, mask output options, and segmentation validation.sub-skills/classification/SKILL.md for classify/predict.py, classify/train.py, classify/val.py, YOLOv5-cls or torchvision classifier models, and ImageFolder/ImageNet-style datasets.sub-skills/export/SKILL.md for export.py, benchmarks.py, TorchScript, ONNX, OpenVINO, TensorRT, CoreML, TensorFlow/TFLite/TF.js, Paddle, Edge TPU, dynamic shapes, half precision, and backend prerequisite checks.sub-skills/serving/SKILL.md for the YOLOv5 Flask REST API pattern, upload validation, API-key behavior, client requests, and safe smoke checks.references/datasets-and-weights.md → sub-skills/detection/ → sub-skills/export/ only after a checkpoint exists.references/datasets-and-weights.md → sub-skills/segmentation/ → sub-skills/export/ if deployment format conversion is needed.sub-skills/classification/ → references/datasets-and-weights.md for ImageFolder/named datasets → sub-skills/export/ for deployment formats.sub-skills/serving/ first; route to sub-skills/detection/ only for model behavior and to sub-skills/export/ only when the user wants non-PyTorch deployment artifacts.sub-skills/export/.yolov5s.pt, yolov5s-seg.pt, or yolov5s-cls.pt may trigger downloads. Prefer explicit local paths for offline or deterministic work.python - <<'PY'
import torch
import models.common, models.yolo, utils.general
print('torch', torch.__version__)
print('cuda_available', torch.cuda.is_available())
print('yolov5 modules importable')
PY
If imports fail, read references/environment.md and references/troubleshooting.md before changing dependencies.
scripts/check_yolov5_env.py: safe environment, import, backend, and optional-dependency checker.sub-skills/detection/scripts/plan_detection_command.py: prints detection train/val/predict command previews with risk warnings.sub-skills/segmentation/scripts/plan_segmentation_command.py: prints segmentation train/val/predict command previews with mask/data warnings.sub-skills/classification/scripts/plan_classification_command.py: prints classification train/val/predict command previews with ImageFolder/model warnings.sub-skills/export/scripts/check_export_prereqs.py: checks optional dependencies for export formats without exporting.sub-skills/serving/scripts/rest_api_smoke.py: uses a Flask test client and dummy model to verify REST API request validation without downloading weights or starting a server.Do not run downloads, training, validation, prediction on streams, export conversion, benchmarks, notebooks, or long-lived servers until the task has explicit inputs, output locations, runtime budget, and backend expectations. Run original repo tests/examples only as verification after classifying them as safe for the current environment.