Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Chinese translation of config_generation.md #576

Merged
merged 7 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 配置文件 - 生成

与 [MMDetection](https://github.com/open-mmlab/mmdetection) 一样,我们将模块化和继承设计融入我们的配置系统,方便进行各种实验
与 [MMDetection](https://github.com/open-mmlab/mmdetection) 一样,我们将模块化和继承设计融入我们的配置系统,以方便进行各种实验

## 示例 - pix2pix

Expand All @@ -16,7 +16,7 @@ model = dict(
in_channels=3, # 生成器的输入通道数
out_channels=3, # 生成器的输出通道数
num_down=8, # # 生成器中下采样的次数
base_channels=64, # 生成器中下采样的数量# 生成器最后卷积层的通道数
base_channels=64, # 生成器最后卷积层的通道数
norm_cfg=dict(type='BN'), # 归一化层的配置
use_dropout=True, # 是否在生成器中使用 dropout
init_cfg=dict(type='normal', gain=0.02)), # 初始化配置
Expand All @@ -30,18 +30,18 @@ model = dict(
gan_loss=dict(
type='GANLoss', # GAN 损失的名称
gan_type='vanilla', # GAN 损失的类型
real_label_val=1.0, # GAN 损失的真实标签值
fake_label_val=0.0, # GAN loss 的假标签值
loss_weight=1.0), # GAN 损失的权重
real_label_val=1.0, # GAN 损失函数中真实标签的值
fake_label_val=0.0, # GAN 损失函数中伪造标签的值
loss_weight=1.0), # GAN 损失函数的权重
pixel_loss=dict(type='L1Loss', loss_weight=100.0, reduction='mean'))
# 模型训练和测试设置
train_cfg = dict(
direction='b2a') # pix2pix 的图像到图像的翻译方向 (模型训练的方法,和测试方向一致)。 模型默认: a2b
direction='b2a') # pix2pix 的图像到图像的翻译方向 (模型的方向,和测试方向一致)。模型默认: a2b
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

模型测试的方向
translation 是否需要翻译成其他词语, e.g. 转化,迁移

test_cfg = dict(
direction='b2a', # pix2pix 的图像到图像的翻译方向 (模型训练的方法,和测试方向一致)。 模型默认: a2b
direction='b2a', # pix2pix 的图像到图像的翻译方向 (模型测试的方向,和训练方向一致)。模型默认: a2b
show_input=True) # 保存 pix2pix 的测试图像时是否显示输入的真实图像

# dataset settings
# 数据设置
train_dataset_type = 'GenerationPairedDataset' # 训练数据集的类型
val_dataset_type = 'GenerationPairedDataset' # 验证/测试数据集类型
img_norm_cfg = dict(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) # 输入图像归一化配置
Expand Down Expand Up @@ -73,7 +73,7 @@ train_pipeline = [
to_rgb=True, # 是否将图像通道从 BGR 转换为 RGB
**img_norm_cfg), # 图像归一化配置(`img_norm_cfg` 的定义见上文)
dict(
type='ImageToTensor', # 图像到 Tensor
type='ImageToTensor', # 将图像转化为 Tensor
keys=['img_a', 'img_b']), # 要从图像转换为 Tensor 的图像的关键词
dict(
type='Collect', # 决定数据中哪些键应该传递给合成器
Expand All @@ -100,7 +100,7 @@ test_pipeline = [
to_rgb=True, # 是否将图像通道从 BGR 转换为 RGB
**img_norm_cfg), # 图像归一化配置(`img_norm_cfg` 的定义见上文)
dict(
type='ImageToTensor', # 图像到 Tensor
type='ImageToTensor', # 将图像转化为 Tensor
keys=['img_a', 'img_b']), # 要从图像转换为 Tensor 的图像的关键词
dict(
type='Collect', # 决定数据中哪些键应该传递给合成器
Expand Down Expand Up @@ -131,31 +131,31 @@ data = dict(
test_mode=True))

# 优化器
optimizers = dict( # 用于构建优化器的配置,支持 PyTorch 中所有参数与 PyTorch 中相同的优化器
optimizers = dict( # 用于构建优化器的配置,支持 PyTorch 中所有优化器,且参数与 PyTorch 中对应优化器相同
generator=dict(type='Adam', lr=2e-4, betas=(0.5, 0.999)),
discriminator=dict(type='Adam', lr=2e-4, betas=(0.5, 0.999)))

# 学习策略
lr_config = dict(policy='Fixed', by_epoch=False) # 用于注册 LrUpdater Hook 的学习率调度程序配置
lr_config = dict(policy='Fixed', by_epoch=False) # 用于注册 LrUpdater 钩子的学习率调度程序配置

# 检查点保存
checkpoint_config = dict(interval=4000, save_optimizer=True, by_epoch=False) # 配置检查点 Hook,实现参考 https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/checkpoint.py
evaluation = dict( # 构建验证 Hook 的配置
checkpoint_config = dict(interval=4000, save_optimizer=True, by_epoch=False) # 配置检查点钩子,实现参考 https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/checkpoint.py
evaluation = dict( # 构建验证钩子的配置
interval=4000, # 验证区间
save_image=True) # 是否保存图片
log_config = dict( # 配置注册记录器 Hook
log_config = dict( # 配置注册记录器钩子
interval=100, # 打印日志的时间间隔
hooks=[
dict(type='TextLoggerHook', by_epoch=False), # 用于记录训练过程的记录器
# dict(type='TensorboardLoggerHook') # 还支持 Tensorboard 记录器
])
visual_config = None # 构建可视化 Hook 的配置
visual_config = None # 构建可视化钩子的配置

# 运行设置
total_iters = 80000 # 训练模型的总迭代次数
cudnn_benchmark = True # 设置 cudnn_benchmark
dist_params = dict(backend='nccl') # 设置分布式训练的参数,端口也可以设置
log_level = 'INFO' #日志级别
log_level = 'INFO' # 日志级别
load_from = None # 从给定路径加载模型作为预训练模型。 这不会恢复训练
resume_from = None # 从给定路径恢复检查点,当检查点被保存时,训练将从该 epoch 恢复
workflow = [('train', 1)] # runner 的工作流程。 [('train', 1)] 表示只有一个工作流程,名为 'train' 的工作流程执行一次。 训练当前生成模型时保持不变
Expand Down
File renamed without changes.