+parser = argparse.ArgumentParser(
+ description = "Convolutional networks for the SVRT. Written by Francois Fleuret, (C) Idiap research institute.",
+ formatter_class = argparse.ArgumentDefaultsHelpFormatter
+)
+
+parser.add_argument('--nb_train_samples',
+ type = int, default = 100000)
+
+parser.add_argument('--nb_test_samples',
+ type = int, default = 10000)
+
+parser.add_argument('--nb_epochs',
+ type = int, default = 50)
+
+parser.add_argument('--batch_size',
+ type = int, default = 100)
+
+parser.add_argument('--log_file',
+ type = str, default = 'default.log')
+
+parser.add_argument('--compress_vignettes',
+ action='store_true', default = True,
+ help = 'Use lossless compression to reduce the memory footprint')
+
+parser.add_argument('--deep_model',
+ action='store_true', default = True,
+ help = 'Use Afroze\'s Alexnet-like deep model')
+
+parser.add_argument('--test_loaded_models',
+ action='store_true', default = False,
+ help = 'Should we compute the test errors of loaded models')
+
+args = parser.parse_args()
+
+######################################################################
+
+log_file = open(args.log_file, 'w')
+pred_log_t = None
+
+print(Fore.RED + 'Logging into ' + args.log_file + Style.RESET_ALL)
+
+# Log and prints the string, with a time stamp. Does not log the
+# remark
+def log_string(s, remark = ''):
+ global pred_log_t
+
+ t = time.time()
+
+ if pred_log_t is None:
+ elapsed = 'start'
+ else:
+ elapsed = '+{:.02f}s'.format(t - pred_log_t)
+
+ pred_log_t = t
+
+ log_file.write('[' + time.ctime() + '] ' + elapsed + ' ' + s + '\n')
+ log_file.flush()
+
+ print(Fore.BLUE + '[' + time.ctime() + '] ' + Fore.GREEN + elapsed + Style.RESET_ALL + ' ' + s + Fore.CYAN + remark + Style.RESET_ALL)