Skip to content

Commit

Permalink
Fixed error and added INFO logs
Browse files Browse the repository at this point in the history
Fixed error and added INFO logs
  • Loading branch information
Nesac128 committed Dec 30, 2018
1 parent a4864f5 commit c791466
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tensorimage/train/trainer.py
Expand Up @@ -97,6 +97,9 @@ def __init__(self,
self.sess = tf.Session(config=self.config)

def build_dataset(self):
print("""
\033[1mTraining operation name: """, self.training_name, """\033[0;0m
""")
log.info("Building dataset...", self)
self.csv_reader.read_training_dataset(self.data_len, self.n_columns)
self.X = self.csv_reader.X
Expand Down Expand Up @@ -182,7 +185,7 @@ def train(self):
break
avr_training_accuracy = training_accuracy_ / batch_iters
avr_testing_accuracy = testing_accuracy_ / batch_iters
if epoch % int(self.n_epochs/50) == 0:
if epoch % np.ceil(self.n_epochs/50) == 0:
log.info("\033[1mEpoch = %s Training accuracy = %s Testing accuracy = %s Training cost = %s Testing cost = %s",
self, epoch, float("%0.5f" % avr_training_accuracy), float("%0.5f" % avr_testing_accuracy),
float("%0.3f" % training_cost), float("%0.3f" % testing_cost))
Expand All @@ -206,10 +209,13 @@ def _write_metadata(self):
self.training_metadata_writer.write()

def store_model(self):
log.info("Stored model in path: {}".format(base_trained_models_store_path + self.model_folder_name + '/' +
self.training_name+"\n\n"), self)
saver = tf.train.Saver()
saver.save(self.sess, base_trained_models_store_path + self.model_folder_name
+ '/' + self.training_name)


@staticmethod
def _one_hot_encode(dlabels):
n_labels = len(dlabels)
Expand Down

0 comments on commit c791466

Please sign in to comment.