def __init__(self): classifier = Classifier() classifier.Build() # Trainer, Evaluator print("Reading Training set...") # self.setdata('something') self.trainer = Trainer(classifier) self.trainEvaluator = Evaluator("train", dataSettings.PATH_TO_TRAIN_SET_CATELOG, classifier) print("\t Done.\n") print("Reading Validation set...") self.validationEvaluator = Evaluator( "validation", dataSettings.PATH_TO_VAL_SET_CATELOG, classifier) print("\t Done.\n") print("Reading Test set...") self.testEvaluator = Evaluator("test", dataSettings.PATH_TO_TEST_SET_CATELOG, classifier) print("\t Done.\n") # Summary summaryOp = tf.summary.merge_all() self.trainer.SetMergedSummaryOp(summaryOp) self.trainEvaluator.SetMergedSummaryOp(summaryOp) self.validationEvaluator.SetMergedSummaryOp(summaryOp) self.bestThreshold = None self.testEvaluator.SetMergedSummaryOp(summaryOp) # Time self._startTrainEpochTime = time.time() self._trainCountInOneEpoch = 0 # Saver self.modelSaver = tf.train.Saver( max_to_keep=trainSettings.MAX_TRAINING_SAVE_MODEL) # Session self.session = tf.Session() init = tf.global_variables_initializer() self.session.run(init) self.trainer.SetGraph(self.session.graph) self.validationEvaluator.SetGraph(self.session.graph)
"{0:.2f}".format(duration_) + "(s)\n") else: print("\t loss:", floatPrecision.format(loss_), " frame accuracy:", floatPrecision.format(frameAccuracy_), " given frame threshold:", threshold_, " video accuracy:", floatPrecision.format(videoAccuracy_), " duration:", "{0:.2f}".format(duration_) + "(s)\n") if __name__ == '__main__': numberOfArguments = len(sys.argv) if (numberOfArguments == 2) or (numberOfArguments == 3): PATH_TO_DATA_SET_CATELOG = sys.argv[1] classifier = Classifier() classifier.Build() evaluator = Evaluator("evaluate", PATH_TO_DATA_SET_CATELOG, classifier) with tf.Session() as session: init = tf.global_variables_initializer() session.run(init) print("Load Model from: ", evalSettings.PATH_TO_MODEL_CHECKPOINTS) modelLoader = tf.train.Saver() modelLoader.restore(session, evalSettings.PATH_TO_MODEL_CHECKPOINTS) startEvaluateTime = time.time() if numberOfArguments == 2: print("Start evaluate: ", PATH_TO_DATA_SET_CATELOG, ", and find the best threshold...")