!21730 add pix2pix results dir

Merge pull request !21730 from TuDouNi/master
This commit is contained in:
i-robot 2021-08-16 08:11:33 +00:00 committed by Gitee
commit 9eb0fafaa1
2 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@
Evaluate Pix2Pix Model.
"""
import os
from mindspore import Tensor, nn
from mindspore.train.serialization import load_checkpoint
from mindspore.train.serialization import load_param_into_net
@ -63,6 +64,9 @@ if __name__ == '__main__':
param_G = load_checkpoint(ckpt_url)
load_param_into_net(netG, param_G)
if not os.path.isdir(args.predict_dir):
os.makedirs(args.predict_dir)
data_loader_val = ds_val.create_dict_iterator(output_numpy=True, num_epochs=args.epoch_num)
print("=======Starting evaluating Loop=======")
for i, data in enumerate(data_loader_val):

View File

@ -59,6 +59,13 @@ if __name__ == '__main__':
train_net = TrainOneStepCell(loss_netD=d_loss_net, loss_netG=g_loss_net, optimizerD=d_opt, optimizerG=g_opt, sens=1)
train_net.set_train()
if not os.path.isdir(args.train_fakeimg_dir):
os.makedirs(args.train_fakeimg_dir)
if not os.path.isdir(args.loss_show_dir):
os.makedirs(args.loss_show_dir)
if not os.path.isdir(args.ckpt_dir):
os.makedirs(args.ckpt_dir)
# Training loop
G_losses = []
D_losses = []