feat(configs): 新增 resnet50 的自监督聚类配置
仿照 film_simclr_resnet18.yaml,只改骨架与 batch_size,其余超参保持一致以便对比。 batch_size 取 256 而非照抄 resnet18 的 1024:实测 resnet50 在 Apple MPS 上 batch 1024 直接 OOM(需 18.7 GiB),batch 128 时 604 MB。每 epoch 耗时与 batch 基本无关(约 155 秒,算力受限),所以调小 batch 不花额外时间,只是负样本变少。 配置注释里记下了实测数据与降级路径(显存不够继续调到 128 / 64), 并说明 resnet50 的 layer2+3 是 1536 维(resnet18 为 384 维)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f8a52c9382
commit
5f31ed0a92
@@ -422,13 +422,26 @@ view_transforms: # 生成两个视图的随机增强
|
||||
|
||||
#### 换一个骨架
|
||||
|
||||
**仓库自带 resnet18 的现成配置**,直接用:
|
||||
**仓库自带 resnet18 / resnet50 的现成配置**,直接用:
|
||||
|
||||
```bash
|
||||
uv run python scripts/cluster_unlabeled.py --config configs/cluster/film_simclr_resnet18.yaml \
|
||||
--work-dir runs/simclr_r18 --set simclr.epochs=40
|
||||
|
||||
uv run python scripts/cluster_unlabeled.py --config configs/cluster/film_simclr_resnet50.yaml \
|
||||
--work-dir runs/simclr_r50 --set simclr.epochs=40
|
||||
```
|
||||
|
||||
两者在 Apple MPS 上的实测开销(14,579 张,128×128 双视图):
|
||||
|
||||
| 骨架 | 参数量 | layer2+3 维度 | 每 epoch | batch 上限 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| resnet18 | 11.2M | 384 | 约 93 秒 | 1024 可用 |
|
||||
| resnet50 | 23.5M | 1536 | 约 155 秒 | **1024 会 OOM**(需 18.7 GiB),配置里用 256 |
|
||||
|
||||
resnet50 每 epoch 的耗时与 batch 基本无关(算力受限),所以显存不够时往下调 batch 不花额外时间,
|
||||
只是 NT-Xent 的负样本变少。
|
||||
|
||||
注意默认的 `method: pretrained` 用的**也是 resnet18**(ImageNet 权重,不训练,约 51 秒出结果);
|
||||
上面这个配置是在 `data/film` 上自监督训练它。两者实测对比(14,579 张,k=4):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user