未验证 提交 24f72797 编写于 作者: L lvmengsi 提交者: GitHub

Fix py3 in cyclegan and save image (#2499)

* fix py3
上级 6590b710
......@@ -96,11 +96,11 @@ class GTrainer():
learning_rate=fluid.layers.piecewise_decay(
boundaries=[99 * step_per_epoch] + [
x * step_per_epoch
for x in xrange(100, cfg.epoch - 1)
for x in range(100, cfg.epoch - 1)
],
values=[lr] + [
lr * (1.0 - (x - 99.0) / 101.0)
for x in xrange(100, cfg.epoch)
for x in range(100, cfg.epoch)
]),
beta1=0.5,
beta2=0.999,
......@@ -136,11 +136,11 @@ class DATrainer():
learning_rate=fluid.layers.piecewise_decay(
boundaries=[99 * step_per_epoch] + [
x * step_per_epoch
for x in xrange(100, cfg.epoch - 1)
for x in range(100, cfg.epoch - 1)
],
values=[lr] + [
lr * (1.0 - (x - 99.0) / 101.0)
for x in xrange(100, cfg.epoch)
for x in range(100, cfg.epoch)
]),
beta1=0.5,
beta2=0.999,
......@@ -175,11 +175,11 @@ class DBTrainer():
learning_rate=fluid.layers.piecewise_decay(
boundaries=[99 * step_per_epoch] + [
x * step_per_epoch
for x in xrange(100, cfg.epoch - 1)
for x in range(100, cfg.epoch - 1)
],
values=[lr] + [
lr * (1.0 - (x - 99.0) / 101.0)
for x in xrange(100, cfg.epoch)
for x in range(100, cfg.epoch)
]),
beta1=0.5,
beta2=0.999,
......
......@@ -149,7 +149,8 @@ def save_test_image(epoch,
for j in range(len(label_org)):
label_trg_tmp[j][i] = 1.0 - label_trg_tmp[j][i]
label_trg_ = map(lambda x: ((x * 2) - 1) * 0.5, label_trg_tmp)
label_trg_ = list(
map(lambda x: ((x * 2) - 1) * 0.5, label_trg_tmp))
for j in range(len(label_org)):
label_trg_[j][i] = label_trg_[j][i] * 2.0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册