| 31 | |
| 32 | |
| 33 | def get_parser(): |
| 34 | parser = argparse.ArgumentParser(description="Detectron2 demo for builtin models") |
| 35 | parser.add_argument( |
| 36 | "--config-file", |
| 37 | default="configs/quick_schedules/mask_rcnn_R_50_FPN_inference_acc_test.yaml", |
| 38 | metavar="FILE", |
| 39 | help="path to config file", |
| 40 | ) |
| 41 | parser.add_argument("--webcam", action="store_true", help="Take inputs from webcam.") |
| 42 | parser.add_argument("--video-input", help="Path to video file.") |
| 43 | parser.add_argument( |
| 44 | "--input", |
| 45 | nargs="+", |
| 46 | help="A list of space separated input images; " |
| 47 | "or a single glob pattern such as 'directory/*.jpg'", |
| 48 | ) |
| 49 | parser.add_argument( |
| 50 | "--output", |
| 51 | help="A file or directory to save output visualizations. " |
| 52 | "If not given, will show output in an OpenCV window.", |
| 53 | ) |
| 54 | |
| 55 | parser.add_argument( |
| 56 | "--confidence-threshold", |
| 57 | type=float, |
| 58 | default=0.5, |
| 59 | help="Minimum score for instance predictions to be shown", |
| 60 | ) |
| 61 | parser.add_argument( |
| 62 | "--opts", |
| 63 | help="Modify config options using the command-line 'KEY VALUE' pairs", |
| 64 | default=[], |
| 65 | nargs=argparse.REMAINDER, |
| 66 | ) |
| 67 | return parser |
| 68 | |
| 69 | |
| 70 | if __name__ == "__main__": |