Kevin Hu commited on
Commit
957cf28
·
1 Parent(s): 551c783

Fix t_recognizer issue. (#4387)

Browse files

### What problem does this PR solve?

#4230

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. deepdoc/vision/t_recognizer.py +3 -3
deepdoc/vision/t_recognizer.py CHANGED
@@ -23,7 +23,7 @@ sys.path.insert(
23
  '../../')))
24
 
25
  from deepdoc.vision.seeit import draw_box
26
- from deepdoc.vision import LayoutRecognizer, TableStructureRecognizer, OCR, init_in_out
27
  import argparse
28
  import re
29
  import numpy as np
@@ -33,12 +33,12 @@ def main(args):
33
  images, outputs = init_in_out(args)
34
  if args.mode.lower() == "layout":
35
  detr = LayoutRecognizer("layout")
 
36
  if args.mode.lower() == "tsr":
37
  labels = TableStructureRecognizer.labels
38
  detr = TableStructureRecognizer()
39
  ocr = OCR()
40
-
41
- layouts = detr(images, thr=float(args.threshold))
42
  for i, lyt in enumerate(layouts):
43
  if args.mode.lower() == "tsr":
44
  #lyt = [t for t in lyt if t["type"] == "table column"]
 
23
  '../../')))
24
 
25
  from deepdoc.vision.seeit import draw_box
26
+ from deepdoc.vision import LayoutRecognizer, TableStructureRecognizer, OCR, init_in_out, Recognizer
27
  import argparse
28
  import re
29
  import numpy as np
 
33
  images, outputs = init_in_out(args)
34
  if args.mode.lower() == "layout":
35
  detr = LayoutRecognizer("layout")
36
+ layouts = super(Recognizer, detr)(images, thr=float(args.threshold))
37
  if args.mode.lower() == "tsr":
38
  labels = TableStructureRecognizer.labels
39
  detr = TableStructureRecognizer()
40
  ocr = OCR()
41
+ layouts = detr(images, thr=float(args.threshold))
 
42
  for i, lyt in enumerate(layouts):
43
  if args.mode.lower() == "tsr":
44
  #lyt = [t for t in lyt if t["type"] == "table column"]