소스 검색

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

zhch158_admin 2 주 전
부모
커밋
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)
     
     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)