yolo-training

GitHub

针对YOLO26模型训练问题的诊断与优化技能,涵盖mAP提升、过拟合分析、超参数调优及各类任务(检测、分割等)的训练指导。

plugins/ultralytics-dev/skills/yolo-training/SKILL.md fcakyon/claude-codex-settings

Trigger Scenarios

improve my mAP why is my model overfitting my training is diverging tune hyperparameters how do I pick learning rate

Install

npx skills add fcakyon/claude-codex-settings --skill yolo-training -g -y
More Options

Non-standard path

npx skills add https://github.com/fcakyon/claude-codex-settings/tree/main/plugins/ultralytics-dev/skills/yolo-training -g -y

Use without installing

npx skills use fcakyon/claude-codex-settings@yolo-training

指定 Agent (Claude Code)

npx skills add fcakyon/claude-codex-settings --skill yolo-training -a claude-code -g -y

安装 repo 全部 skill

npx skills add fcakyon/claude-codex-settings --all -g -y

预览 repo 内 skill

npx skills add fcakyon/claude-codex-settings --list

SKILL.md

Frontmatter
{
    "name": "yolo-training",
    "description": "This skill should be used when user asks to \"improve my mAP\", \"why is my model overfitting\", \"my training is diverging\", \"read my results.csv\", \"interpret my training curves\", \"my AP50 is good but AP50-95 is bad\", \"my recall is low\", \"how do I pick learning rate\", \"which augmentations should I use\", \"should I use a bigger model\", \"tune hyperparameters\", or asks how to train YOLO26 for detection, instance or semantic segmentation, pose, OBB, classification, or depth."
}

YOLO26 training

Read the run before changing anything. The results.csv and confusion matrix usually name the problem already.

Order of operations

Ordered by cost to try, cheapest first, not by size of the potential win.

  1. Epochs and schedule. Undertrained looks like every other problem, and it costs nothing but time to rule out.
  2. Augmentation. The knob for the generalization gap, at no extra compute per epoch.
  3. Loss weights and LR. Cheap, and the curves usually say which one is wrong.
  4. Model size. Scale up when train loss is still falling at the end of the schedule and the train and val curves sit close together. That is underfitting, and it is the only case a bigger model reliably fixes.
  5. Resolution. Compute scales with the square of imgsz, so 640 to 1280 is roughly 4x the training budget, and pretrained weights transfer worse the further you move from the size they were fit at. Justify it with the object sizes in your data, not as a default first move.
  6. Data, label quality and class balance. The highest ceiling and the slowest to move. The package ships no dataset-analysis tooling, so any audit here is your own script plus looking at images. Worth it once the cheap knobs are spent.

Diagnostic loop

import pandas as pd

df = pd.read_csv("runs/detect/train/results.csv")
df.columns = df.columns.str.strip()
print(df.tail(10)[["epoch", "train/box_loss", "val/box_loss", "metrics/mAP50(B)", "metrics/mAP50-95(B)"]])
print("best epoch:", df["metrics/mAP50-95(B)"].idxmax(), "of", len(df))

Then read, in this order:

Read Question it answers
best epoch vs total epochs undertrained, overtrained, or right
train loss vs val loss trend which side of the generalization gap
mAP50 vs mAP50-95 classification and recall vs localization
P vs R at the operating point over-suppression vs over-firing
per-class AP spread one broken class or a general weakness
confusion matrix background row and column false positives vs missed detections

references/diagnostics.md maps each pattern to a cause and a knob, and lists what to rule out before turning that knob. Read it before recommending a change. references/task-notes.md covers detect, segment, semantic, pose, obb, classify, and depth specifics.

Defaults that will surprise you

These produce "I changed X and nothing happened". All six are current defaults.

  1. optimizer=auto ignores lr0 and momentum. It is the default. It picks MuSGD at lr 0.01 when ceil(len(dataset) / max(batch, nbs)) * epochs exceeds 10000, otherwise AdamW at 0.002 * 5 / (4 + nc), and forces warmup_bias_lr=0. Crossing that iteration count silently changes optimizer between two runs you meant to compare. Setting lr0 while leaving optimizer=auto does nothing. Set optimizer=AdamW or optimizer=SGD explicitly first.
  2. nbs=64 normalizes the loss, so batch does not scale LR the way you assume. Below 64 the trainer accumulates gradients to an effective 64. Dropping batch 64 to 16 changes almost nothing about the effective step.
  3. close_mosaic=10 turns off mosaic for the last 10 epochs. The late jump in mAP is that switch, not convergence. On a 20-epoch run it is half the schedule, and on a 10-epoch run mosaic never runs at all.
  4. Fitness for detect is mAP50-95 alone, weights [0, 0, 0, 1]. best.pt and patience ignore precision, recall, and mAP50 completely. Segment and pose sum both heads, classify uses (top1 + top5) / 2, semantic uses mIoU. A run whose precision is climbing while mAP50-95 is flat will still early-stop.
  5. max_det=300 truncates validation on dense scenes. Above roughly 300 objects per image your recall ceiling is an artifact.
  6. YOLO26 end2end models decode without NMS, so iou does nothing on them. agnostic_nms still applies, the predictor passes it into the head, so only the IoU threshold is dead.

Starting recipe

Fine-tuning a pretrained checkpoint on a normal custom dataset:

yolo train model=yolo26s.pt data=my-data.yaml epochs=200 imgsz=640 batch=16 \
  optimizer=AdamW lr0=0.001 lrf=0.01 cos_lr=True warmup_epochs=3 \
  patience=50 close_mosaic=20

Deviate on evidence from the charts, one axis at a time. It differs from the shipped defaults because epochs=100 is short for a small dataset, patience=100 never fires inside 100 epochs, and close_mosaic=10 is too short a clean tail once epochs rise.

Change one thing per run and keep seed fixed. Run-to-run noise on a small dataset is often 0.5 to 1.0 mAP, so a 0.3 mAP "improvement" from a single run is not a result. Confirm anything under about 1 point across three seeds.

Version History

  • c4b9424 Current 2026-08-20 04:54

Same Skill Collection

plugins/adhd-output-style/skills/adhd-output-style/SKILL.md
plugins/anthropic-office-skills/skills/pdf/SKILL.md
plugins/azure-tools/skills/azure-usage/SKILL.md
plugins/azure-tools/skills/setup/SKILL.md
plugins/cloudflare-skills/skills/cloudflare-deploy/SKILL.md
plugins/codex-advisor/skills/codex-advisor/SKILL.md
plugins/dokploy-skills/skills/dokploy-deploy/SKILL.md
plugins/fable-advisor/skills/fable-advisor/SKILL.md
plugins/frontend-design-skills/skills/anthropic-frontend-design/SKILL.md
plugins/frontend-design-skills/skills/openai-frontend-design/SKILL.md
plugins/gcloud-tools/skills/gcloud-usage/SKILL.md
plugins/gcloud-tools/skills/setup/SKILL.md
plugins/github-dev/skills/clean-gone-branches/SKILL.md
plugins/github-dev/skills/commit-staged/SKILL.md
plugins/github-dev/skills/create-pr/SKILL.md
plugins/github-dev/skills/resolve-pr-comments/SKILL.md
plugins/github-dev/skills/review-pr/SKILL.md
plugins/github-dev/skills/setup/SKILL.md
plugins/github-dev/skills/update-pr-summary/SKILL.md
plugins/hetzner-skills/skills/hetzner-deploy/SKILL.md
plugins/humanize/skills/humanize/SKILL.md
plugins/livekit-skills/skills/livekit-skills/SKILL.md
plugins/mongodb-skills/skills/mongodb-atlas-stream-processing/SKILL.md
plugins/mongodb-skills/skills/mongodb-mcp-setup/SKILL.md
plugins/mongodb-skills/skills/mongodb-query-optimizer/SKILL.md
plugins/openai-office-skills/skills/doc/SKILL.md
plugins/openai-office-skills/skills/pdf/SKILL.md
plugins/openai-office-skills/skills/slides/SKILL.md
plugins/openai-office-skills/skills/spreadsheet/SKILL.md
plugins/openobserve-skills/skills/openobserve-api/SKILL.md
plugins/overleaf-skills/skills/review-overleaf/SKILL.md
plugins/overleaf-skills/skills/setup/SKILL.md
plugins/paper-search-tools/skills/paper-search-usage/SKILL.md
plugins/paper-search-tools/skills/setup/SKILL.md
plugins/polar-skills/skills/polar-billing/SKILL.md
plugins/polar-skills/skills/polar-local-environment/SKILL.md
plugins/python-skills/skills/python-guidelines/SKILL.md
plugins/react-skills/skills/composition-patterns/SKILL.md
plugins/react-skills/skills/react-best-practices/SKILL.md
plugins/react-skills/skills/react-native-skills/SKILL.md
plugins/react-skills/skills/web-design-guidelines/SKILL.md
plugins/simplify/skills/simplify/SKILL.md
plugins/supabase-skills/skills/supabase-cli/SKILL.md
plugins/supabase-skills/skills/supabase-js/SKILL.md
plugins/tavily-tools/skills/setup/SKILL.md
plugins/tavily-tools/skills/tavily-usage/SKILL.md
plugins/ultralytics-branding/skills/ultralytics-branding/SKILL.md
plugins/ultralytics-dev/skills/ultralytics-platform/SKILL.md
plugins/web-performance-skills/skills/web-performance-optimization/SKILL.md

Metadata

Files
0
Version
c4b9424
Hash
583bc50d
Indexed
2026-08-20 04:54

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 12:29
浙ICP备14020137号-1 $Гость$