download.py 1.3 KB
Newer Older
W
WuHaobo 已提交
1 2
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
littletomatodonkey's avatar
littletomatodonkey 已提交
3 4 5
# 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
W
WuHaobo 已提交
6 7 8
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
littletomatodonkey's avatar
littletomatodonkey 已提交
9 10 11 12 13
# 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.
W
WuHaobo 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27

import argparse

from ppcls import model_zoo


def parse_args():
    def str2bool(v):
        return v.lower() in ("true", "t", "1")

    parser = argparse.ArgumentParser()
    parser.add_argument('-a', '--architecture', type=str, default='ResNet50')
    parser.add_argument('-p', '--path', type=str, default='./pretrained/')
    parser.add_argument('-d', '--decompress', type=str2bool, default=True)
littletomatodonkey's avatar
littletomatodonkey 已提交
28
    parser.add_argument('-l', '--list', type=str2bool, default=False)
W
WuHaobo 已提交
29 30 31 32 33 34 35

    args = parser.parse_args()
    return args


def main():
    args = parse_args()
littletomatodonkey's avatar
littletomatodonkey 已提交
36 37 38 39
    if args.list:
        model_zoo.list_models()
    else:
        model_zoo.get(args.architecture, args.path, args.decompress)
W
WuHaobo 已提交
40 41 42 43


if __name__ == '__main__':
    main()