feat(detect): 把弱监督框数据集链接到 data/ 并接上 YOLO 训练
第五步产出的框标签按类别分目录,便于人工核对;检测训练要的是 train/val 划分——类别写在标签第一列,不靠目录名。补上两个入口: - scripts/prepare_yolo_dataset.py:拍平类别目录、按类别分层切分、硬链接到 data/。分层是必需的,black 只有 53 张,随机切容易让小类在验证集里挂零。 无框的图默认保留(检测训练里是压低误检的负样本);拍平后的同名冲突直接 报错而不是静默覆盖。 - detect.py + configs/detect/film.yaml:包一层 ultralytics,沿用本仓库的 配置继承、设备解析与 SwanLab 可视化。 选 YOLOv8 而不是 v11/v12:CLAUDE.md 限定只用 convolution 模型,YOLO11 骨架 里有 C2PSA、YOLO12 以注意力为主,只有 v8 的 C2f + SPPF 是纯卷积。 mosaic/mixup 关掉——每张图只有一个弱监督框,拼接后小目标被缩得更小,对 blackdot/whitedot 这类只占千分之几面积的类别是净伤害。 ultralytics 的 project 必须传绝对路径,相对路径会被它再拼到全局 settings 的 runs_dir 上,产出会跑到 runs/detect/runs/detect/<name> 去。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
86c86b105c
commit
8dc2fe6a2e
@@ -139,7 +139,13 @@ def test_every_shipped_config_builds_its_components(config_path):
|
||||
|
||||
# 分类配置
|
||||
model_cfg = cfg.get("model")
|
||||
if model_cfg:
|
||||
if model_cfg and "weights" in model_cfg:
|
||||
# 检测配置:model 是 ultralytics 的权重名(yolov8s.pt),不走本仓库的注册表。
|
||||
# 只校验它是纯卷积的那一档——CLAUDE.md 限定只用 convolution 模型,
|
||||
# YOLO11 的 C2PSA 与 YOLO12 都带注意力。
|
||||
assert "yolo11" not in model_cfg["weights"]
|
||||
assert "yolo12" not in model_cfg["weights"]
|
||||
elif model_cfg:
|
||||
import torch
|
||||
|
||||
from models import build_model
|
||||
|
||||
Reference in New Issue
Block a user