Skip to content

Commit 010802d

Browse files
committed
add test case for predict_cls and det+cls+rec predict
1 parent fc87614 commit 010802d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/st/test_online_infer.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def _gen_text_image(texts=TEXTS_2, boxes=BOXES_2, save_fp="gen_img.jpg"):
4242

4343
det_img_fp = _gen_text_image(save_fp="gen_det_input.jpg")
4444
rec_img_fp = _gen_text_image([TEXTS_2[0]], [BOXES_2[0]], "gen_rec_input.jpg")
45+
cls_img_fp = rec_img_fp
4546

4647

4748
def test_det_infer():
@@ -55,6 +56,17 @@ def test_det_infer():
5556
assert ret == 0, "Det inference fails"
5657

5758

59+
def test_cls_infer():
60+
algo = "MV3"
61+
cmd = (
62+
f"python tools/infer/text/predict_cls.py --image_dir {cls_img_fp} --cls_algorithm {algo} "
63+
f"--draw_img_save_dir ./infer_test"
64+
)
65+
print(f"Running command: \n{cmd}")
66+
ret = subprocess.call(cmd.split(), stdout=sys.stdout, stderr=sys.stderr)
67+
assert ret == 0, "Cls inference fails"
68+
69+
5870
def test_rec_infer():
5971
algo = "CRNN"
6072
cmd = (
@@ -68,10 +80,12 @@ def test_rec_infer():
6880

6981
def test_system_infer():
7082
det_algo = "DB"
83+
cls_algo = "MV3"
7184
rec_algo = "CRNN_CH"
7285
cmd = (
7386
f"python tools/infer/text/predict_system.py --image_dir {det_img_fp} --det_algorithm {det_algo} "
74-
f"--rec_algorithm {rec_algo} --draw_img_save_dir ./infer_test --visualize_output True"
87+
f"--cls_algorithm {cls_algo} --rec_algorithm {rec_algo} "
88+
f"--draw_img_save_dir ./infer_test --visualize_output True"
7589
)
7690
print(f"Running command: \n{cmd}")
7791
ret = subprocess.call(cmd.split(), stdout=sys.stdout, stderr=sys.stderr)

0 commit comments

Comments
 (0)