feat(detect): 把 Label Studio 的 YOLO 导出装配成带 train/val 划分的数据集
scripts/build_yolo_dataset.py:导出(zip 或目录)+ 复核材料里的 images/ -> data/ 下 可训练的数据集。Label Studio 的 YOLO 导出只有标签,本地存储的图片不会打包进去 (get_local_path 对 local-files 直接返回磁盘路径,YOLO_WITH_IMAGES 也一样), 所以图片从准备复核材料的目录按文件名取,硬链接过去。 - 类别顺序照抄导出的 classes.txt:转换器把标签收进 set 再排序编号,与 labeling config 的顺序无关,标签里的 class_id 是按它写的。 - 按类别分层切分,分层用"框最多的那个类别"——人工复核后一张图可能有多个类别的框。 - 标签逐行校验:字段数、类别下标、坐标范围。坏标签训练时不会崩,只会悄悄拉低指标。 - 空标签默认保留为负样本;标签找不到图直接报错,图多于标签则告警。 顺带把 link_or_copy 提到 utils/fs.py 共用(此前 generate_boxes 与 prepare_label_studio 各有一份)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
65bc6b2045
commit
998e6601d4
+3
-1
@@ -1,4 +1,4 @@
|
||||
"""通用工具:配置、注册表、日志、随机种子、设备检查。"""
|
||||
"""通用工具:配置、注册表、日志、随机种子、设备检查、文件落盘。"""
|
||||
|
||||
from utils.config import Config, load_config
|
||||
from utils.device import (
|
||||
@@ -10,6 +10,7 @@ from utils.device import (
|
||||
resolve_amp,
|
||||
resolve_device,
|
||||
)
|
||||
from utils.fs import link_or_copy
|
||||
from utils.logging import get_logger, setup_logging
|
||||
from utils.registry import Registry
|
||||
from utils.seed import seed_everything
|
||||
@@ -28,4 +29,5 @@ __all__ = [
|
||||
"setup_logging",
|
||||
"Registry",
|
||||
"seed_everything",
|
||||
"link_or_copy",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user