Shortcuts

备注

您正在阅读 MMClassification 0.x 版本的文档。MMClassification 0.x 会在 2022 年末被切换为次要分支。建议您升级到 MMClassification 1.0 版本,体验更多新特性和新功能。请查阅 MMClassification 1.0 的安装教程迁移教程以及更新日志

mmcls.core.PreciseBNHook

class mmcls.core.PreciseBNHook(num_samples: int = 8192, interval: int = 1)[源代码]

Precise BN hook.

Recompute and update the batch norm stats to make them more precise. During training both BN stats and the weight are changing after every iteration, so the running average can not precisely reflect the actual stats of the current model.

With this hook, the BN stats are recomputed with fixed weights, to make the running average more precise. Specifically, it computes the true average of per-batch mean/variance instead of the running average. See Sec. 3 of the paper Rethinking Batch in BatchNorm <https://arxiv.org/abs/2105.07576> for details.

This hook will update BN stats, so it should be executed before CheckpointHook and EMAHook, generally set its priority to “ABOVE_NORMAL”.

参数
  • num_samples (int) – The number of samples to update the bn stats. Defaults to 8192.

  • interval (int) – Perform precise bn interval. Defaults to 1.

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.