From 4bde18a1b76bb06b6a6f9bd3843d5b82eafca4c1 Mon Sep 17 00:00:00 2001 From: Timo <37281330+Timo9Madrid7@users.noreply.github.com> Date: Fri, 26 Mar 2021 20:10:07 +0100 Subject: [PATCH] Fix the incompatibility of gif saving When cv2.imwirte() saves ".gif", it will cause _error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_'_. We add an if statement to check whether the saving file format is ".gif" so as to avoid the error. --- tools/infer/predict_system.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index de7ee9d3..ea622fac 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -176,6 +176,8 @@ def main(args): draw_img_save = "./inference_results/" if not os.path.exists(draw_img_save): os.makedirs(draw_img_save) + if flag: + image_file = image_file[:-3] + "png" cv2.imwrite( os.path.join(draw_img_save, os.path.basename(image_file)), draw_img[:, :, ::-1])