This commit is contained in:
chenxuanhong
2022-01-19 16:30:55 +08:00
parent 736d45ec00
commit e698d99173
9 changed files with 980 additions and 33 deletions
+12 -3
View File
@@ -5,7 +5,7 @@
# Created Date: Sunday January 9th 2022
# Author: Chen Xuanhong
# Email: chenxuanhongzju@outlook.com
# Last Modified: Monday, 17th January 2022 1:12:08 pm
# Last Modified: Monday, 17th January 2022 5:31:43 pm
# Modified By: Chen Xuanhong
# Copyright (c) 2022 Shanghai Jiao Tong University
#############################################################
@@ -180,8 +180,9 @@ class Trainer(TrainerBase):
def train(self):
ckpt_dir = self.config["project_checkpoints"]
log_frep = self.config["log_step"]
log_freq = self.config["log_step"]
model_freq = self.config["model_save_step"]
sample_freq = self.config["sample_step"]
total_step = self.config["total_step"]
random_seed = self.config["dataset_params"]["random_seed"]
@@ -268,7 +269,7 @@ class Trainer(TrainerBase):
self.g_optimizer.step()
# Print out log info
if (step + 1) % log_frep == 0:
if (step + 1) % log_freq == 0:
elapsed = time.time() - start_time
elapsed = str(datetime.timedelta(seconds=elapsed))
@@ -295,6 +296,14 @@ class Trainer(TrainerBase):
self.logger.log({"D_loss": loss_D.item()}, step = step)
self.logger.log({"D_fake": loss_Dgen.item()}, step = step)
self.logger.log({"D_real": loss_Dreal.item()}, step = step)
if (step + 1) % sample_freq == 0:
self.__evaluation__(
step = step,
**{
"src1": src_image1,
"src2": src_image2
})