@@ -154,9 +154,9 @@ examples/tempoGAN/tempoGAN.py:78:94
154154
155155本问题采用无监督学习的方式,虽然不是以监督学习方式进行训练,但此处仍然可以采用监督约束 ` SupervisedConstraint ` ,在定义约束之前,需要给监督约束指定文件路径等数据读取配置,因为 tempoGAN 属于自监督学习,数据集中没有标签数据,而是使用一部分输入数据作为 ` label ` ,因此需要设置约束的 ` output_expr ` 。
156156
157- ``` py linenums="122 "
157+ ``` py linenums="123 "
158158-- 8 < --
159- examples/ tempoGAN/ tempoGAN.py:122 : 125
159+ examples/ tempoGAN/ tempoGAN.py:123 : 126
160160-- 8 < --
161161```
162162
@@ -166,7 +166,7 @@ examples/tempoGAN/tempoGAN.py:122:125
166166
167167``` py linenums="98"
168168-- 8 < --
169- examples/ tempoGAN/ tempoGAN.py:98 :127
169+ examples/ tempoGAN/ tempoGAN.py:98 :129
170170-- 8 < --
171171```
172172
@@ -177,7 +177,9 @@ examples/tempoGAN/tempoGAN.py:98:127
1771773 . ` label ` : Array 类型的标签数据;
1781784 . ` transforms ` : 所有数据 transform 方法,此处 ` FunctionalTransform ` 为PaddleScience 预留的自定义数据 transform 类,该类支持编写代码时自定义输入数据的 transform,具体代码请参考 [ 自定义 loss 和 data transform] ( #38 ) ;
179179
180- ` batch_size ` 字段表示 batch的大小;
180+ ` auto_collation ` 字段表示允许 BatchSampler 自动排序;
181+
182+ ` batch_size ` 字段表示 batch 的大小;
181183
182184` sampler ` 字段表示采样方法,其中各个字段表示:
183185
@@ -193,27 +195,27 @@ examples/tempoGAN/tempoGAN.py:98:127
193195
194196在约束构建完毕之后,以我们刚才的命名为关键字,封装到一个字典中,方便后续访问,由于本问题设置了` use_spatialdisc ` 和 ` use_tempodisc ` ,导致 Generator 的部分约束不一定存在,因此先封装一定存在的约束到字典中,当其余约束存在时,在向字典中添加约束元素。
195197
196- ``` py linenums="129 "
198+ ``` py linenums="130 "
197199-- 8 < --
198- examples/ tempoGAN/ tempoGAN.py:129 : 160
200+ examples/ tempoGAN/ tempoGAN.py:130 : 162
199201-- 8 < --
200202```
201203
202204#### 3.6.2 Discriminator 的约束
203205
204- ``` py linenums="164 "
206+ ``` py linenums="166 "
205207-- 8 < --
206- examples/ tempoGAN/ tempoGAN.py:164 : 201
208+ examples/ tempoGAN/ tempoGAN.py:166 : 204
207209-- 8 < --
208210```
209211
210212各个参数含义与[ Generator 的约束] ( #361 ) 相同。
211213
212214#### 3.6.3 Discriminator_tempo 的约束
213215
214- ``` py linenums="205 "
216+ ``` py linenums="208 "
215217-- 8 < --
216- examples/ tempoGAN/ tempoGAN.py:205 : 244
218+ examples/ tempoGAN/ tempoGAN.py:208 : 248
217219-- 8 < --
218220```
219221
@@ -279,9 +281,9 @@ examples/tempoGAN/functions.py:430:488
279281
280282完成上述设置之后,首先需要将上述实例化的对象按顺序传递给 ` ppsci.solver.Solver ` ,然后启动训练。
281283
282- ``` py linenums="247 "
284+ ``` py linenums="251 "
283285-- 8 < --
284- examples/ tempoGAN/ tempoGAN.py:247 : 258
286+ examples/ tempoGAN/ tempoGAN.py:251 : 262
285287-- 8 < --
286288```
287289
@@ -293,15 +295,15 @@ examples/tempoGAN/tempoGAN.py:247:258
293295
294296训练中仅在特定 ` Epoch ` 保存特定图片的目标结果和模型输出结果,训练结束后针对最后一个 ` Epoch ` 的输出结果进行一次评估,以便直观评价模型优化效果。不使用 PaddleScience 中内置的评估器,也不在训练过程中进行评估:
295297
296- ``` py linenums="287 "
298+ ``` py linenums="291 "
297299-- 8 < --
298- examples/ tempoGAN/ tempoGAN.py:287 : 293
300+ examples/ tempoGAN/ tempoGAN.py:291 : 297
299301-- 8 < --
300302```
301303
302- ``` py linenums="307 "
304+ ``` py linenums="311 "
303305-- 8 < --
304- examples/ tempoGAN/ tempoGAN.py:307 : 323
306+ examples/ tempoGAN/ tempoGAN.py:311 : 327
305307-- 8 < --
306308```
307309
@@ -311,17 +313,17 @@ examples/tempoGAN/tempoGAN.py:307:323
311313
312314本问题的评估指标为,将模型输出的超分结果与实际高分辨率图片做对比,使用三个指标 MSE(Mean-Square Error) 、PSNR(Peak Signal-to-Noise Ratio) 、SSIM(Structural SIMilarity) 来评价图片相似度。因此没有使用 PaddleScience 中的内置评估器,也没有 ` Solver.eval() ` 过程。
313315
314- ``` py linenums="326 "
316+ ``` py linenums="330 "
315317-- 8 < --
316- examples/ tempoGAN/ tempoGAN.py:326 : 406
318+ examples/ tempoGAN/ tempoGAN.py:330 : 410
317319-- 8 < --
318320```
319321
320322另外,其中:
321323
322- ``` py linenums="396 "
324+ ``` py linenums="400 "
323325-- 8 < --
324- examples/ tempoGAN/ tempoGAN.py:396 : 403
326+ examples/ tempoGAN/ tempoGAN.py:400 : 407
325327-- 8 < --
326328```
327329
0 commit comments