فهرست منبع

feat: 确保输出目录存在并保存旋转后的图像

zhch158_admin 3 هفته پیش
والد
کامیت
fc69271078
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      zhch/unified_pytorch_models/orientation_classifier_v2.py

+ 2 - 1
zhch/unified_pytorch_models/orientation_classifier_v2.py

@@ -270,5 +270,6 @@ if __name__ == "__main__":
     print(result)
     print(result)
     
     
     if result.needs_rotation:
     if result.needs_rotation:
+        output_image_path.parent.mkdir(exist_ok=True)
         rotated_img = classifier.rotate_image(img, result.rotation_angle)
         rotated_img = classifier.rotate_image(img, result.rotation_angle)
-        cv2.imwrite(output_image_path, rotated_img)
+        cv2.imwrite(output_image_path.as_posix(), rotated_img)