MCPcopy
hub / github.com/PaddlePaddle/PaddleOCR / __init__

Method __init__

ppstructure/table/predict_structure.py:72–117  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

70
71class TableStructurer(object):
72 def __init__(self, args):
73 self.args = args
74 self.use_onnx = args.use_onnx
75 pre_process_list = build_pre_process_list(args)
76 if args.table_algorithm not in ["TableMaster"]:
77 postprocess_params = {
78 "name": "TableLabelDecode",
79 "character_dict_path": args.table_char_dict_path,
80 "merge_no_span_structure": args.merge_no_span_structure,
81 }
82 else:
83 postprocess_params = {
84 "name": "TableMasterLabelDecode",
85 "character_dict_path": args.table_char_dict_path,
86 "box_shape": "pad",
87 "merge_no_span_structure": args.merge_no_span_structure,
88 }
89
90 self.preprocess_op = create_operators(pre_process_list)
91 self.postprocess_op = build_post_process(postprocess_params)
92 (
93 self.predictor,
94 self.input_tensor,
95 self.output_tensors,
96 self.config,
97 ) = utility.create_predictor(args, "table", logger)
98
99 if args.benchmark:
100 import auto_log
101
102 pid = os.getpid()
103 gpu_id = utility.get_infer_gpuid()
104 self.autolog = auto_log.AutoLogger(
105 model_name="table",
106 model_precision=args.precision,
107 batch_size=1,
108 data_shape="dynamic",
109 save_path=None, # args.save_log_path,
110 inference_config=self.config,
111 pids=pid,
112 process_name=None,
113 gpu_ids=gpu_id if args.use_gpu else None,
114 time_keys=["preprocess_time", "inference_time", "postprocess_time"],
115 warmup=0,
116 logger=logger,
117 )
118
119 def __call__(self, img):
120 starttime = time.time()

Callers

nothing calls this directly

Calls 3

create_operatorsFunction · 0.90
build_post_processFunction · 0.90
build_pre_process_listFunction · 0.85

Tested by

no test coverage detected