PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.69k stars 2.87k forks source link

error: the following arguments are required: --det_model_dir, --keypoint_model_dir #4915

Closed cena001plus closed 2 years ago

cena001plus commented 2 years ago

Hello, I have run through the detection plus keypoint detection through the command line. When I want to call the main() in det_keypoint_unite_infer.py separately by passing parameters, I get an error and keep saying that the pedestrian detection and keypoint detection models are not found? In fact, I have already set the default model path in det_keypoint_unite_utils.py, what is the problem here?

Parameter cannot be parsed

The error message is as follows usage: inference_demo_image.py [-h] --det_model_dir DET_MODEL_DIR --keypoint_model_dir KEYPOINT_MODEL_DIR [--image_file IMAGE_FILE] [--image_dir IMAGE_DIR] [--keypoint_batch_size KEYPOINT_BATCH_SIZE] [--video_file VIDEO_FILE] [--camera_id CAMERA_ID] [--det_threshold DET_THRESHOLD] [--keypoint_threshold KEYPOINT_THRESHOLD] [--output_dir OUTPUT_DIR] [--run_mode RUN_MODE] [--device DEVICE] [--run_benchmark RUN_BENCHMARK] [--enable_mkldnn ENABLE_MKLDNN] [--cpu_threads CPU_THREADS] [--trt_min_shape TRT_MIN_SHAPE] [--trt_max_shape TRT_MAX_SHAPE] [--trt_opt_shape TRT_OPT_SHAPE] [--trt_calib_mode TRT_CALIB_MODE] [--use_dark USE_DARK] [--save_res SAVE_RES] inference_demo_image.py: error: the following arguments are required: --det_model_dir, --keypoint_model_dir

Parameter default value setting `def argsparser(): parser = argparse.ArgumentParser(description=doc) parser.add_argument( "--det_model_dir", type=str,

default=None,

    default="/home/PaddleDetection/output_inference/download/picodet_s_192_pedestrian",
    help=("Directory include:'model.pdiparams', 'model.pdmodel', "
          "'infer_cfg.yml', created by tools/export_model.py."),
    required=True)
parser.add_argument(
    "--keypoint_model_dir",
    type=str,
    # default=None,
    default="/home/PaddleDetection/output_inference/download/tinypose_128x96",
    help=("Directory include:'model.pdiparams', 'model.pdmodel', "
          "'infer_cfg.yml', created by tools/export_model.py."),
    required=True)`
zoooo0820 commented 2 years ago

@cena001plus It looks like you want to specify the model path directly in the code file. This error is thrown by argsparse, you should change the terms required of det_model_dir and keypoint_model_dir to False (at https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.3/deploy/python/det_keypoint_unite_utils.py#L27 ).

cena001plus commented 2 years ago

you are right