9
9
10
10
from pipeline .framework .module_base import ModuleBase
11
11
from pipeline .tasks import TaskType
12
- from .detection import DetPostProcess
12
+ from .detection import DetPostprocess
13
13
from tools .infer .text .utils import crop_text_region
14
14
from pipeline .data_process .utils .cv_utils import crop_box_from_image
15
15
16
16
class DetPostNode (ModuleBase ):
17
17
def __init__ (self , args , msg_queue , tqdm_info ):
18
18
super (DetPostNode , self ).__init__ (args , msg_queue , tqdm_info )
19
- self .det_postprocess = DetPostProcess (args )
19
+ self .det_postprocess = DetPostprocess (args )
20
20
self .task_type = self .args .task_type
21
21
self .is_concat = self .args .is_concat
22
22
@@ -51,17 +51,11 @@ def process(self, input_data):
51
51
return
52
52
53
53
pred = input_data .data ["det_infer_res" ]
54
- # print("pred:", len(pred))
55
54
pred = pred [0 ]
56
55
data_dict = {"shape_list" : input_data .data ["det_pre_res" ]["shape_list" ]}
57
56
boxes = self .det_postprocess (pred , data_dict )
58
57
59
-
60
-
61
58
boxes = boxes ['polys' ][0 ]
62
-
63
- # TODO ZHQ 对齐 tools/infer/text/postprocess.py?
64
- # print(boxes)
65
59
66
60
if self .is_concat :
67
61
boxes = sorted (boxes , key = lambda points : (points [0 ][1 ], points [0 ][0 ]))
@@ -72,10 +66,6 @@ def process(self, input_data):
72
66
73
67
input_data .infer_result = infer_res_list
74
68
75
- # ZHQ TODO
76
-
77
- # input_data.sub_image_total = len(infer_res_list)
78
- # input_data.sub_image_size = len(infer_res_list)
79
69
if self .task_type .value in (TaskType .DET .value , TaskType .DET_REC .value , TaskType .DET_CLS_REC .value ):
80
70
image = input_data .frame [0 ] # bs=1 for det
81
71
else :
@@ -88,9 +78,6 @@ def process(self, input_data):
88
78
sub_image_list = len (sub_image_list ) * [self .concat_crops (sub_image_list )]
89
79
input_data .sub_image_list = sub_image_list
90
80
91
- # if not (self.args.crop_save_dir or self.args.vis_det_save_dir or self.args.vis_pipeline_save_dir):
92
- # input_data.frame = None
93
-
94
81
if not infer_res_list :
95
82
input_data .skip = True
96
83
0 commit comments