(args)
| 231 | |
| 232 | |
| 233 | def main(args): |
| 234 | tf_infer = TensorFlowInfer(args.saved_model, args.preprocessor, args.detection_type, args.iou_threshold) |
| 235 | trt_infer = TensorRTInfer(args.engine, args.preprocessor, args.detection_type, args.iou_threshold) |
| 236 | |
| 237 | trt_batcher = ImageBatcher(args.input, *trt_infer.input_spec(), max_num_images=args.num_images, preprocessor=args.preprocessor) |
| 238 | tf_infer.override_input_shape(0, [1, trt_batcher.height, trt_batcher.width, 3]) # Same size input in TF as TRT |
| 239 | tf_batcher = ImageBatcher(args.input, *tf_infer.input_spec(), max_num_images=args.num_images, preprocessor=args.preprocessor) |
| 240 | |
| 241 | tf_images, tf_detections = run(tf_batcher, tf_infer, "TensorFlow", args.nms_threshold) |
| 242 | trt_images, trt_detections = run(trt_batcher, trt_infer, "TensorRT", args.nms_threshold) |
| 243 | |
| 244 | compare_images(tf_images, tf_detections, trt_images, trt_detections, args.output, args.annotations, args.labels, args.detection_type) |
| 245 | |
| 246 | |
| 247 | if __name__ == "__main__": |
no test coverage detected