options.py 2.4 KB
Newer Older
Q
qingqing01 已提交
1
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
L
lijianshe02 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

L
LielinJiang 已提交
15 16
import argparse

L
lijianshe02 已提交
17

L
LielinJiang 已提交
18 19
def parse_args():
    parser = argparse.ArgumentParser(description='Segmentron')
L
lijianshe02 已提交
20 21
    parser.add_argument('--config-file',
                        metavar="FILE",
L
LielinJiang 已提交
22 23
                        help='config file path')
    # cuda setting
L
lijianshe02 已提交
24 25 26
    parser.add_argument('--no-cuda',
                        action='store_true',
                        default=False,
L
LielinJiang 已提交
27 28
                        help='disables CUDA training')
    # checkpoint and log
L
lijianshe02 已提交
29 30 31
    parser.add_argument('--resume',
                        type=str,
                        default=None,
L
LielinJiang 已提交
32
                        help='put the path to resuming file if needed')
L
lijianshe02 已提交
33 34 35
    parser.add_argument('--load',
                        type=str,
                        default=None,
L
LielinJiang 已提交
36 37
                        help='put the path to resuming file if needed')
    # for evaluation
L
lijianshe02 已提交
38 39 40
    parser.add_argument('--val-interval',
                        type=int,
                        default=1,
L
LielinJiang 已提交
41
                        help='run validation every interval')
L
lijianshe02 已提交
42 43 44
    parser.add_argument('--evaluate-only',
                        action='store_true',
                        default=False,
L
LielinJiang 已提交
45 46
                        help='skip validation during training')
    # config options
L
lijianshe02 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    parser.add_argument('opts',
                        help='See config for all options',
                        default=None,
                        nargs=argparse.REMAINDER)

    #for inference
    parser.add_argument("--source_path",
                        default="",
                        metavar="FILE",
                        help="path to source image")
    parser.add_argument("--reference_dir",
                        default="",
                        help="path to reference images")
    parser.add_argument("--model_path", default="", help="model for loading")

L
LielinJiang 已提交
62 63
    args = parser.parse_args()

L
lijianshe02 已提交
64
    return args