コード例 #1
0
def _get_args(args=None):
    import sys
    import os
    sys.path.append(os.path.join(CUR_DIR, '..'))
    from utils import util

    parser, arg = util.get_args_parser('dataset')

    arg('--data-directory', type=str, help='data are loading from here')

    arg('--count', type=int, default=10, help='samples count to show')

    arg('--phase',
        type=str,
        default='train',
        metavar='train|valid',
        help='dataset of which phase to show')

    arg('--path',
        '-p',
        type=str,
        nargs='+',
        default=None,
        help='path of image to show')

    return parser.parse_args(args)
コード例 #2
0
def _get_args(args=None):
    import sys
    import os
    sys.path.append(os.path.join(CUR_DIR, '..'))
    from utils import util

    parser, arg = util.get_args_parser('Classes_make_anno')

    arg('--data-directory', type=str, help='data are loading from here'),

    return parser.parse_args(args)
コード例 #3
0
    def get_args_parser(self, actions=actions, default_action='train', args=None):
        from utils.util import get_args_parser

        parser, arg = get_args_parser('logloader')
        actions_str = '|'.join(actions.keys())

        arg('--save-directory', type=str, default='out', help='save directory')

        arg('--execid', type=str, default=None, help='sub directory')

        arg('--action', '-a', metavar=actions_str,
            type=str, default=default_action, help='actions')

        parse_args = parser.__getattribute__('parse_args')

        def _parse_args(*args, **kwargs):
            args = parse_args(*args, **kwargs)
            args.root_log_file = 'log.log'
            args.sub_log_file = 'log.log'
            return args

        parser.__setattr__('parse_args', _parse_args)

        return parser, arg
コード例 #4
0
    def get_args_parser(self, description, args=None):
        from utils.util import get_args_parser

        parser, arg = get_args_parser(description)

        arg('--phase',
            type=str,
            default='train',
            metavar='|'.join(self.get_phases()),
            help='phase to run')

        arg('--batch-size',
            type=int,
            default=64,
            metavar='N',
            help='input batch size for training (default: 64)')

        arg('--test-batch-size',
            type=int,
            default=64,
            metavar='N',
            help='input batch size for testing (default: 64)')

        arg('--epochs',
            type=int,
            default=100,
            metavar='N',
            help='number of epochs to train (default: 100)')

        arg('--lr',
            type=float,
            default=0.01,
            metavar='LR',
            help='learning rate (default: 0.01)')

        arg('--momentum',
            type=float,
            default=0.5,
            metavar='M',
            help='SGD momentum (default: 0.5)')

        arg('--no-cuda',
            action='store_true',
            default=False,
            help='disables CUDA training')

        arg('--seed',
            type=int,
            default=1,
            metavar='Seed',
            help='random seed (default: 1)')

        arg('--log-interval',
            type=int,
            default=5,
            metavar='N',
            help='how many batches to wait before logging training status')

        arg('--save-model',
            action='store_true',
            default=True,
            help='save the current Model')

        arg('--model', type=str, default='Net', help='model name')

        arg('--save-directory',
            type=str,
            default='out',
            help='learnt models and logs are saving here')

        arg('--data-directory', type=str, help='data are loading from here')

        arg('--model-file', type=str, help='model are loading from here')

        arg('--predict-indices',
            type=str,
            default='all',
            help='sample indices to predict')

        arg('--no-cache-image',
            action='store_true',
            default=False,
            help='should cache image in memory')

        arg('--retry',
            action='store_true',
            default=True,
            help='loss为nan时是否自动需要调整参数重试')

        return parser, arg