diff options
| author | junyanz <junyanz@berkeley.edu> | 2017-06-12 19:23:18 -0700 |
|---|---|---|
| committer | junyanz <junyanz@berkeley.edu> | 2017-06-12 19:23:18 -0700 |
| commit | 3b72a659c38141e502b74bee65ca08d51dc3eabf (patch) | |
| tree | e457326f7821e04d0c13291634ee3ee631645eb8 /util | |
| parent | 437648f669439652e3801ad4cb8572ef24eacd38 (diff) | |
save training losses to the file (log_file.txt)
Diffstat (limited to 'util')
| -rw-r--r-- | util/visualizer.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/util/visualizer.py b/util/visualizer.py index 46348be..a718cfc 100644 --- a/util/visualizer.py +++ b/util/visualizer.py @@ -21,7 +21,10 @@ class Visualizer(): self.img_dir = os.path.join(self.web_dir, 'images') print('create web directory %s...' % self.web_dir) util.mkdirs([self.web_dir, self.img_dir]) - + self.log_name = os.path.join(opt.checkpoints_dir, opt.name, 'loss_log.txt') + with open(self.log_name, "a") as log_file: + now = time.strftime("%c") + log_file.write('================ Training Loss (%s) ================\n' % now) # |visuals|: dictionary of images to display or save def display_current_results(self, visuals, epoch): @@ -76,6 +79,8 @@ class Visualizer(): message += '%s: %.3f ' % (k, v) print(message) + with open(self.log_name, "a") as log_file: + log_file.write('%s\n' % message) # save image to the disk def save_images(self, webpage, visuals, image_path): |
