()
| 179 | |
| 180 | |
| 181 | def main(): |
| 182 | # docs_tag: begin_parse_args |
| 183 | parser = get_default_arg_parser( |
| 184 | "Profiler for all ops of CV-CUDA.", |
| 185 | input_path=os.path.join(current_dir, "assets", "brooklyn.jpg"), |
| 186 | supports_video=False, |
| 187 | batch_size=32, |
| 188 | ) |
| 189 | parser.add_argument( |
| 190 | "-n", |
| 191 | "--num_iters", |
| 192 | default=10, |
| 193 | type=int, |
| 194 | help="The number of iterations to run the benchmarks for.", |
| 195 | ) |
| 196 | parser.add_argument( |
| 197 | "--visualize", |
| 198 | action="store_true", |
| 199 | default=False, |
| 200 | help="Flag specifying whether outputs from the operators should be visualized" |
| 201 | " on written on disk or not.", |
| 202 | ) |
| 203 | parser.add_argument( |
| 204 | "ops", |
| 205 | nargs="*", |
| 206 | help="Optional list of one or more operator names which you want to benchmark. " |
| 207 | "When supplied, the benchmarking will be restricted to only the operators that starts " |
| 208 | "with these names.", |
| 209 | ) |
| 210 | args = parse_validate_default_args(parser) |
| 211 | |
| 212 | logging.basicConfig( |
| 213 | format="[%(name)s:%(lineno)d] %(asctime)s %(levelname)-6s %(message)s", |
| 214 | level=getattr(logging, args.log_level.upper()), |
| 215 | datefmt="%Y-%m-%d %H:%M:%S", |
| 216 | ) |
| 217 | |
| 218 | cvcuda_perf = CvCudaPerf("run_bench", default_args=args) |
| 219 | run_bench( |
| 220 | args.input_path, |
| 221 | args.output_dir, |
| 222 | args.batch_size, |
| 223 | args.target_img_height, |
| 224 | args.target_img_width, |
| 225 | args.device_id, |
| 226 | args.num_iters, |
| 227 | args.visualize, |
| 228 | args.ops, |
| 229 | cvcuda_perf, |
| 230 | ) |
| 231 | |
| 232 | |
| 233 | if __name__ == "__main__": |
no test coverage detected