Files
ModelTrainEval/configs/dataset/film_defect.yaml
T
Shaun ZhouandClaude Opus 5 5d395b7c25 chore: 数据迁到 data/raw/ 后同步所有路径引用
原始数据从 data/<数据集> 移到了 data/raw/<数据集>。

- 聚类配置的 dataset.root:film / pearlescent 均改为 data/raw/ 下
- 检测配置的 img_dir 与 label_dir 注释同步
- README、data/README、算法文档、流程图(含重新渲染的 PNG)与各脚本
  docstring 里的路径示例一并更新
- data/README 补充目录约定:原始数据只读放 data/raw/,
  export_clusters.py 的派生数据集放在 data/ 下与 raw/ 平级
- 顺手把 unlabeled 数据集加进 datasets/__init__.py:此前它没在包初始化时注册,
  build_dataset({"name": "unlabeled"}) 只有在别处先 import 过该模块时才可用

迁移后重跑全量聚类,结果与迁移前逐项一致(轮廓 0.3255、稳定性 0.9641、
簇大小 [4507, 3795, 4849, 1428])。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 11:19:42 +08:00

52 lines
1.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 薄膜缺陷数据集(YOLO 风格标注:labels/*.txt,每行 `class_id cx cy w h`,归一化坐标)。
# 类别顺序即标注里的 class_id,改动顺序等于改变标签含义,必须重新训练。
# 也可以写成 data.yaml 的路径,从其中的 names 读类别:classes: data/raw/film/data.yaml
classes: [scratch, bubble, particle, crease, stain]
# 图像级标签形式;模型的分类头、分类损失、分类指标都跟随它。
# multilabel(多类):一张图可同时含多种缺陷,多热标签 + BCE,全 0 表示 OK 片;
# multiclass(单类):一张图只归一个类别,互斥 softmax + CE,
# 分类头多一维表示"无缺陷"(下标 = len(classes)),
# 一图出现多种缺陷时取框数最多的类别。
# 无论取哪种,定位分支始终按 classes 逐类输出 heatmap。
label_mode: multilabel
image_size: [512, 512]
gray: false
data:
train:
dataset:
name: film_defect
img_dir: data/raw/film/images/train
label_dir: null # 缺省按 YOLO 约定取 data/raw/film/labels/train
gray: false
max_objects: 64
transforms:
- {name: Resize, size: [512, 512]}
- {name: RandomHorizontalFlip, p: 0.5}
- {name: RandomVerticalFlip, p: 0.5}
- {name: ColorJitter, brightness: 0.2, contrast: 0.2}
- {name: ToTensor}
- {name: Normalize, mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225]}
loader:
batch_size: 16
shuffle: true
num_workers: 8
drop_last: true
val:
dataset:
name: film_defect
img_dir: data/raw/film/images/val
label_dir: null
gray: false
transforms:
- {name: Resize, size: [512, 512]}
- {name: ToTensor}
- {name: Normalize, mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225]}
loader:
batch_size: 16
shuffle: false
num_workers: 4