(self, checkpoint_dir)
| 404 | self.saver.save(self.sess, os.path.join(checkpoint_dir, self.model_name+'.model'), global_step=step) |
| 405 | |
| 406 | def load(self, checkpoint_dir): |
| 407 | import re |
| 408 | print(" [*] Reading checkpoints...") |
| 409 | checkpoint_dir = os.path.join(checkpoint_dir, self.model_dir) |
| 410 | |
| 411 | ckpt = tf.train.get_checkpoint_state(checkpoint_dir) |
| 412 | if ckpt and ckpt.model_checkpoint_path: |
| 413 | ckpt_name = os.path.basename(ckpt.model_checkpoint_path) |
| 414 | self.saver.restore(self.sess, os.path.join(checkpoint_dir, ckpt_name)) |
| 415 | counter = int(next(re.finditer("(\d+)(?!.*\d)",ckpt_name)).group(0)) |
| 416 | print(" [*] Success to read {}".format(ckpt_name)) |
| 417 | return True, counter |
| 418 | else: |
| 419 | print(" [*] Failed to find a checkpoint") |
| 420 | return False, 0 |
| 421 | |
| 422 | def visualize_results(self, epoch): |
| 423 | tot_num_samples = min(self.sample_num, self.batch_size) |
no outgoing calls