@@ -154,9 +154,9 @@ examples/tempoGAN/tempoGAN.py:78:94
154154
155155本问题采用无监督学习的方式,虽然不是以监督学习方式进行训练,但此处仍然可以采用监督约束 ` SupervisedConstraint ` ,在定义约束之前,需要给监督约束指定文件路径等数据读取配置,因为 tempoGAN 属于自监督学习,数据集中没有标签数据,而是使用一部分输入数据作为 ` label ` ,因此需要设置约束的 ` output_expr ` 。
156156
157- ``` py linenums="123 "
157+ ``` py linenums="122 "
158158-- 8 < --
159- examples/ tempoGAN/ tempoGAN.py:123 : 126
159+ examples/ tempoGAN/ tempoGAN.py:122 : 125
160160-- 8 < --
161161```
162162
@@ -166,7 +166,7 @@ examples/tempoGAN/tempoGAN.py:123:126
166166
167167``` py linenums="98"
168168-- 8 < --
169- examples/ tempoGAN/ tempoGAN.py:98 :129
169+ examples/ tempoGAN/ tempoGAN.py:98 :127
170170-- 8 < --
171171```
172172
@@ -177,9 +177,7 @@ examples/tempoGAN/tempoGAN.py:98:129
1771773 . ` label ` : Array 类型的标签数据;
1781784 . ` transforms ` : 所有数据 transform 方法,此处 ` FunctionalTransform ` 为PaddleScience 预留的自定义数据 transform 类,该类支持编写代码时自定义输入数据的 transform,具体代码请参考 [ 自定义 loss 和 data transform] ( #38 ) ;
179179
180- ` auto_collation ` 字段表示允许 BatchSampler 自动排序;
181-
182- ` batch_size ` 字段表示 batch 的大小;
180+ ` batch_size ` 字段表示 batch的大小;
183181
184182` sampler ` 字段表示采样方法,其中各个字段表示:
185183
@@ -195,27 +193,27 @@ examples/tempoGAN/tempoGAN.py:98:129
195193
196194在约束构建完毕之后,以我们刚才的命名为关键字,封装到一个字典中,方便后续访问,由于本问题设置了` use_spatialdisc ` 和 ` use_tempodisc ` ,导致 Generator 的部分约束不一定存在,因此先封装一定存在的约束到字典中,当其余约束存在时,在向字典中添加约束元素。
197195
198- ``` py linenums="130 "
196+ ``` py linenums="129 "
199197-- 8 < --
200- examples/ tempoGAN/ tempoGAN.py:130 : 162
198+ examples/ tempoGAN/ tempoGAN.py:129 : 160
201199-- 8 < --
202200```
203201
204202#### 3.6.2 Discriminator 的约束
205203
206- ``` py linenums="166 "
204+ ``` py linenums="164 "
207205-- 8 < --
208- examples/ tempoGAN/ tempoGAN.py:166 : 204
206+ examples/ tempoGAN/ tempoGAN.py:164 : 201
209207-- 8 < --
210208```
211209
212210各个参数含义与[ Generator 的约束] ( #361 ) 相同。
213211
214212#### 3.6.3 Discriminator_tempo 的约束
215213
216- ``` py linenums="208 "
214+ ``` py linenums="205 "
217215-- 8 < --
218- examples/ tempoGAN/ tempoGAN.py:208 : 248
216+ examples/ tempoGAN/ tempoGAN.py:205 : 244
219217-- 8 < --
220218```
221219
@@ -281,9 +279,9 @@ examples/tempoGAN/functions.py:430:488
281279
282280完成上述设置之后,首先需要将上述实例化的对象按顺序传递给 ` ppsci.solver.Solver ` ,然后启动训练。
283281
284- ``` py linenums="251 "
282+ ``` py linenums="247 "
285283-- 8 < --
286- examples/ tempoGAN/ tempoGAN.py:251 : 262
284+ examples/ tempoGAN/ tempoGAN.py:247 : 258
287285-- 8 < --
288286```
289287
@@ -295,15 +293,15 @@ examples/tempoGAN/tempoGAN.py:251:262
295293
296294训练中仅在特定 ` Epoch ` 保存特定图片的目标结果和模型输出结果,训练结束后针对最后一个 ` Epoch ` 的输出结果进行一次评估,以便直观评价模型优化效果。不使用 PaddleScience 中内置的评估器,也不在训练过程中进行评估:
297295
298- ``` py linenums="291 "
296+ ``` py linenums="287 "
299297-- 8 < --
300- examples/ tempoGAN/ tempoGAN.py:291 : 297
298+ examples/ tempoGAN/ tempoGAN.py:287 : 293
301299-- 8 < --
302300```
303301
304- ``` py linenums="311 "
302+ ``` py linenums="307 "
305303-- 8 < --
306- examples/ tempoGAN/ tempoGAN.py:311 : 327
304+ examples/ tempoGAN/ tempoGAN.py:307 : 323
307305-- 8 < --
308306```
309307
@@ -313,17 +311,17 @@ examples/tempoGAN/tempoGAN.py:311:327
313311
314312本问题的评估指标为,将模型输出的超分结果与实际高分辨率图片做对比,使用三个指标 MSE(Mean-Square Error) 、PSNR(Peak Signal-to-Noise Ratio) 、SSIM(Structural SIMilarity) 来评价图片相似度。因此没有使用 PaddleScience 中的内置评估器,也没有 ` Solver.eval() ` 过程。
315313
316- ``` py linenums="330 "
314+ ``` py linenums="326 "
317315-- 8 < --
318- examples/ tempoGAN/ tempoGAN.py:330 : 410
316+ examples/ tempoGAN/ tempoGAN.py:326 : 406
319317-- 8 < --
320318```
321319
322320另外,其中:
323321
324- ``` py linenums="400 "
322+ ``` py linenums="396 "
325323-- 8 < --
326- examples/ tempoGAN/ tempoGAN.py:400 : 407
324+ examples/ tempoGAN/ tempoGAN.py:396 : 403
327325-- 8 < --
328326```
329327
0 commit comments