Exemplo n.º 1
0
def log_init(args, model_cls):
    """
        Set the log root according to the args.log_dir and 
        log run info
    """
    logger.set_log_root(log_root=args.log_dir)
    logger.auto_set_dir(action='k')
    logger.info("Arguments: {}".format(args))
    logger.info("Model class is {}".format(model_cls))
    logger.info("TF version: {}".format(tf.__version__))
Exemplo n.º 2
0
    parser_add_fcdense_arguments(parser)
    args = parser.parse_args()
    model_cls = None
    if args.densenet_version == 'atv2':
        model_cls = AnytimeFCDenseNetV2
    elif args.densenet_version == 'atv1':
        model_cls = AnytimeFCDenseNet(AnytimeLogDenseNetV1)
    elif args.densenet_version == 'loglog':
        model_cls = AnytimeFCDenseNet(AnytimeLogLogDenseNet)
    elif args.densenet_version == 'c2f':
        model_cls = AnytimeFCNCoarseToFine
        side = 360
    elif args.densenet_version == 'dense':
        model_cls = FCDensenet 

    logger.set_log_root(log_root=args.log_dir)
    logger.auto_set_dir(action='k')
    fs.set_dataset_path(args.data_dir)

    ## 
    # Store a philly_operation.txt in root log dir
    # every run will check it if the script is run on philly
    # philly_operation.txt  should contain the same step that is current running
    # if it does not exit, the default is written there (train)
    if args.is_philly:
        philly_operation_fn = os.path.join(args.log_dir, 'philly_operation.txt')
        if not os.path.exists(philly_operation_fn):
            with open(philly_operation_fn, 'wt') as fout:
                fout.write(args.operation)
        else:
            with open(philly_operation_fn, 'rt') as fin: