Ver Fonte

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

zhch158_admin há 2 semanas atrás
pai
commit
fc69271078

+ 2 - 1
zhch/unified_pytorch_models/orientation_classifier_v2.py

@@ -270,5 +270,6 @@ if __name__ == "__main__":
     print(result)
     
     if result.needs_rotation:
+        output_image_path.parent.mkdir(exist_ok=True)
         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)