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