From b9ac638b382ba258be1f6e806c23667d6897ee16 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Sat, 12 Oct 2024 13:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/image_util.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/util/image_util.py b/util/image_util.py index 48cf32d..2fb5d0b 100644 --- a/util/image_util.py +++ b/util/image_util.py @@ -5,7 +5,6 @@ import os import cv2 import numpy import requests -from paddleclas import PaddleClas from tenacity import retry, stop_after_attempt, wait_random from log import PROJECT_ROOT @@ -67,23 +66,23 @@ def split(img_path, ratio=1.414, overlap=0.05, x_compensation=3): return split_result -def parse_rotation_angles(image): - """ - 判断图片旋转角度,逆时针旋转该角度后为正。可能值['0', '90', '180', '270'] - :param image: 图片NumPy数组或文件路径 - :return: 最有可能的两个角度 - """ - angles = ['0', '90'] - model = PaddleClas(model_name='text_image_orientation') - clas_result = model.predict(input_data=image) - try: - clas_result = next(clas_result)[0] - if clas_result['scores'][0] < 0.5: - return angles - angles = clas_result['label_names'] - except Exception as e: - logging.error('获取图片旋转角度失败', exc_info=e) - return angles +# def parse_rotation_angles(image): +# """ +# 判断图片旋转角度,逆时针旋转该角度后为正。可能值['0', '90', '180', '270'] +# :param image: 图片NumPy数组或文件路径 +# :return: 最有可能的两个角度 +# """ +# angles = ['0', '90'] +# model = PaddleClas(model_name='text_image_orientation') +# clas_result = model.predict(input_data=image) +# try: +# clas_result = next(clas_result)[0] +# if clas_result['scores'][0] < 0.5: +# return angles +# angles = clas_result['label_names'] +# except Exception as e: +# logging.error('获取图片旋转角度失败', exc_info=e) +# return angles def rotate(img_path, angle):