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):