From f222a42789b38b38c855473add85abb5425f3ebf Mon Sep 17 00:00:00 2001 From: ZeYi Lin <944270057@qq.com> Date: Sat, 7 Sep 2024 03:45:19 +0800 Subject: [PATCH] fix: argparse --- README.md | 2 +- inference.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 848c9826..8344bb67 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ python inference.py -i demo/images/test.jpg -o ./idphoto.png --height 413 --widt ## 2. 人像抠图 ```python -python inference.py -i -t human_matting demo/images/test.jpg -o ./idphoto_matting.png --matting_model hivision_modnet +python inference.py -t human_matting -i demo/images/test.jpg -o ./idphoto_matting.png --matting_model hivision_modnet ``` ## 3. 透明图增加底色 diff --git a/inference.py b/inference.py index 89f52ad3..c3fd5a70 100644 --- a/inference.py +++ b/inference.py @@ -30,12 +30,13 @@ parser.add_argument( "-t", + "--type", help="请求 API 的种类", choices=INFERENCE_TYPE, default="idphoto", ) -parser.add_argument("-i", help="输入图像路径", required=True) -parser.add_argument("-o", help="保存图像路径", required=True) +parser.add_argument("-i", "--input_image_dir", help="输入图像路径", required=True) +parser.add_argument("-o", "--output_image_dir", help="保存图像路径", required=True) parser.add_argument("--height", help="证件照尺寸-高", default=413) parser.add_argument("--width", help="证件照尺寸-宽", default=295) parser.add_argument("-c", "--color", help="证件照背景色", default="638cce")