Skip to content

Commit

Permalink
[Doc] Translate docs (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yshuo-Li authored Nov 3, 2021
1 parent da5eaac commit 6ff9037
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Some intermediate variables are used in the configs files, like `train_pipeline`/`test_pipeline` in datasets.

For example, we would like to first define the `train_pipeline`/`test_pipeline` and pass them into `data`. Thus, `train_pipeline`/`test_pipeline` are intermediate variable.

```python
...
train_dataset_type = 'SRAnnotationDataset'
Expand Down
60 changes: 60 additions & 0 deletions docs_zh-CN/faq.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
## 常见问题解答

### 在配置中使用中间变量

配置文件中使用了一些中间变量,如数据集中的 `train_pipeline``test_pipeline`

例如,我们通常先定义 `train_pipeline``test_pipeline`,再将它们传递到 `data` 中。因此, `train_pipeline``test_pipeline` 是中间变量。

```python
...
train_dataset_type = 'SRAnnotationDataset'
val_dataset_type = 'SRFolderDataset'
train_pipeline = [
dict(
type='LoadImageFromFile',
io_backend='disk',
key='lq',
flag='unchanged'),
...
dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'gt_path']),
dict(type='ImageToTensor', keys=['lq', 'gt'])
]
test_pipeline = [
dict(
type='LoadImageFromFile',
io_backend='disk',
key='lq',
flag='unchanged'),
...
dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'lq_path']),
dict(type='ImageToTensor', keys=['lq', 'gt'])
]

data = dict(
# 训练
train_dataloader = dict(
samples_per_gpu=16,
workers_per_gpu=6,
drop_last=True),
train=dict(
type='RepeatDataset',
times=1000,
dataset=dict(
type=train_dataset_type,
lq_folder='data/DIV2K/DIV2K_train_LR_bicubic/X2_sub',
gt_folder='data/DIV2K/DIV2K_train_HR_sub',
ann_file='data/DIV2K/meta_info_DIV2K800sub_GT.txt',
pipeline=train_pipeline,
scale=scale)),
# 验证
val_dataloader = dict(samples_per_gpu=1, workers_per_gpu=1),
val=dict(
type=val_dataset_type,
lq_folder='data/val_set5/Set5_bicLRx2',
gt_folder='data/val_set5/Set5_mod12',
pipeline=test_pipeline,
scale=scale,
filename_tmpl='{}')

empty_cache = True # 在每次迭代后清空缓存。
```

0 comments on commit 6ff9037

Please sign in to comment.