Skip to content

Commit

Permalink
remove dependency (#1536)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

#702 
### Type of change
- [x] Refactoring
  • Loading branch information
KevinHuSh authored Jul 16, 2024
1 parent 6a5e1d5 commit 99adeab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 1 addition & 9 deletions deepdoc/vision/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import onnxruntime as ort

from .postprocess import build_post_process
from rag.settings import cron_logger


def transform(data, ops=None):
Expand Down Expand Up @@ -566,9 +565,6 @@ def detect(self, img):
end = time.time()
time_dict['all'] = end - start
return None, None, time_dict
else:
cron_logger.debug("dt_boxes num : {}, elapsed : {}".format(
len(dt_boxes), elapse))

return zip(self.sorted_boxes(dt_boxes), [
("", 0) for _ in range(len(dt_boxes))])
Expand Down Expand Up @@ -597,9 +593,7 @@ def __call__(self, img, cls=True):
end = time.time()
time_dict['all'] = end - start
return None, None, time_dict
else:
cron_logger.debug("dt_boxes num : {}, elapsed : {}".format(
len(dt_boxes), elapse))

img_crop_list = []

dt_boxes = self.sorted_boxes(dt_boxes)
Expand All @@ -612,8 +606,6 @@ def __call__(self, img, cls=True):
rec_res, elapse = self.text_recognizer(img_crop_list)

time_dict['rec'] = elapse
cron_logger.debug("rec_res num : {}, elapsed : {}".format(
len(rec_res), elapse))

filter_boxes, filter_rec_res = [], []
for box, rec_result in zip(dt_boxes, rec_res):
Expand Down
2 changes: 0 additions & 2 deletions deepdoc/vision/recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from api.utils.file_utils import get_project_base_directory
from .operators import *
from rag.settings import cron_logger


class Recognizer(object):
Expand Down Expand Up @@ -340,7 +339,6 @@ def postprocess(self, boxes, inputs, thr):
if score < thr:
continue
if clsid >= len(self.label_list):
cron_logger.warning(f"bad category id")
continue
bb.append({
"type": self.label_list[clsid].lower(),
Expand Down

0 comments on commit 99adeab

Please sign in to comment.