删除无效方法
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user