help="overwrite the default image size, squre image.") # dataset default settings DataConf = collections.namedtuple( 'DataConf', ['num_train', 'num_test', 'num_cats', 'folder', 'image_size']) DATA_CONF = { 'mnist': DataConf(2000, 500, 5, '', 20), 'cifar-10': DataConf(50000, 10000, 10, '', 24), 'cifar-100': DataConf(5000, 10000, 100, '', 24), } # if following dataset flags are None, use default settings. data_conf = DATA_CONF[FLAGS.get('dataset')] FLAGS.overwrite_none(num_train_examples=data_conf.num_train, num_test_examples=data_conf.num_test, num_cats=data_conf.num_cats, dataset_fld=data_conf.folder, image_size=data_conf.image_size) ######################################### # global variables ######################################### # CATEGORIES = FLAGS.categories.split(',') # Constants used for dealing with the files, matches convert_to_records. TFR_SUFFIX = '.TFR' ######################################### # functions #########################################
logger.set_logger(stream=True) logger.info(CUR_TIME) logger.newline() logger.error("newline beneath~") logger.newline(2) logger.info("haha") # ================================ # test FLAGS # ================================ FLAGS.add("--aa", type=float, default=11., help="doc for dd") logger.info("aa: {}".format(FLAGS.get('aa'))) # for flag that should be overwrite later, don't set default FLAGS.add("--bb", type=int, default=None, help="doc for dd") if FLAGS.get('aa') == 11: FLAGS.overwrite_none(bb=15) FLAGS.add("--cc", type=bool, default=False, help="doc for dd") FLAGS.add("--dd", type=str, default="dddddd", help="doc for dd") # for flag that should be overwrite later, don't set default FLAGS.add("--ff", type=str, help="doc for dd") FLAGS.add("--gg", type=str, help="doc for dd") FLAGS.add("--hh", type=str, default="hhhhh", help="doc for dd") # overwrite or set new default values FLAGS.overwrite_defaults(dd="replaced dd", ee="an extra flag", ff="ff") FLAGS.overwrite_none(hh="this won't show", gg="gggg", ii="illigal") FLAGS.add("--jj", type=str, default="hhhhh", help="doc for dd") # parse FLAGS at the start of main() FLAGS.parse_and_log() logger.info(FLAGS.gg)