Skip to content

Commit 485a5c8

Browse files
committed
small fix
1 parent 2a74874 commit 485a5c8

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

tools/infer/text/predict_cls.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, args):
3838
self.visualize_output = args.visualize_output
3939
# self.batch_mode = args.cls_batch_mode and (self.batch_num > 1)
4040
_logger.info(
41-
"recognize in {} mode {}".format(
41+
"classify text direction in {} mode {}".format(
4242
"batch" if self.batch_mode else "serial",
4343
"batch_size: " + str(self.batch_num) if self.batch_mode else "",
4444
)
@@ -99,7 +99,7 @@ def __call__(self, img_or_path_list: list):
9999
assert isinstance(
100100
img_or_path_list, list
101101
), "Input for text direction classification must be list of images or image paths."
102-
_logger.info("num images for cls: ", len(img_or_path_list))
102+
_logger.info(f"num images for cls: {len(img_or_path_list)}")
103103
if self.batch_mode:
104104
cls_res_all, all_rotated_imgs = self.run_batchwise(img_or_path_list)
105105
else:
@@ -263,4 +263,4 @@ def save_cls_res(cls_res_all, img_paths, include_score=False, save_path="./cls_r
263263
save_cls_res(cls_res_all, img_paths, include_score=True, save_path=save_fp)
264264
# print('All cls res: ', cls_res_all)
265265
print("Done! Text direction classification results saved in ", save_dir)
266-
print("Time cost: ", t, "FPS: ", len(img_paths) / t)
266+
print("CLS time: ", t, "FPS: ", len(img_paths) / t)

tools/infer/text/predict_system.py

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def __call__(self, img_or_path: Union[str, np.ndarray], do_visualize=True):
9797
cls_start = time()
9898
_, crops = self.direction_classify(crops)
9999
time_profile["cls"] = time() - cls_start
100+
_logger.info(f"\nCls time: {time_profile['cls']}")
100101

101102
# recognize cropped images
102103
rs = time()

tools/infer/text/preprocess.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,19 @@ def __init__(self, task="det", algo="DB", **kwargs):
117117
f"batch mode = {batch_mode}."
118118
)
119119

120-
_logger.info(
121-
f"Pick optimal preprocess hyper-params for {task} algo {algo}:\n",
122-
"\n".join(
123-
[
124-
f"{k}:\t{str(v)}"
125-
for k, v in dict(
126-
target_height=target_height,
127-
target_width=target_width,
128-
padding=padding,
129-
keep_ratio=keep_ratio,
130-
norm_before_pad=norm_before_pad,
131-
).items()
132-
]
133-
),
120+
hparam = "\n".join(
121+
[
122+
f"{k}:\t{str(v)}"
123+
for k, v in dict(
124+
target_height=target_height,
125+
target_width=target_width,
126+
padding=padding,
127+
keep_ratio=keep_ratio,
128+
norm_before_pad=norm_before_pad,
129+
).items()
130+
]
134131
)
132+
_logger.info(f"Pick optimal preprocess hyper-params for {task} algo {algo}:\n{hparam}")
135133

136134
pipeline = [
137135
{"DecodeImage": {"img_mode": "RGB", "keep_ori": True, "to_float32": False}},

0 commit comments

Comments
 (0)