Skip to content

Commit 987cc84

Browse files
DingHsunWayne Huang
andauthored
解決recognition的train test分割程式執行後的文檔每行間多出一行空格 (#11280)
使用gen_ocr_train_val_test.py分割recognition data後產生的train.txt、val.txt和test.txt每行label間多出一行空格,導致訓練時出現異常,移除換行\n後便可正常運行。 Co-authored-by: Wayne Huang <[email protected]>
1 parent 54837db commit 987cc84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gen_ocr_train_val_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ def splitTrainVal(root, abs_train_root_path, abs_val_root_path, abs_test_root_pa
4545
if cur_ratio < train_ratio:
4646
image_copy_path = os.path.join(abs_train_root_path, image_name)
4747
shutil.copy(image_path, image_copy_path)
48-
train_txt.write("{}\t{}\n".format(image_copy_path, image_label))
48+
train_txt.write("{}\t{}".format(image_copy_path, image_label))
4949
elif cur_ratio >= train_ratio and cur_ratio < val_ratio:
5050
image_copy_path = os.path.join(abs_val_root_path, image_name)
5151
shutil.copy(image_path, image_copy_path)
52-
val_txt.write("{}\t{}\n".format(image_copy_path, image_label))
52+
val_txt.write("{}\t{}".format(image_copy_path, image_label))
5353
else:
5454
image_copy_path = os.path.join(abs_test_root_path, image_name)
5555
shutil.copy(image_path, image_copy_path)
56-
test_txt.write("{}\t{}\n".format(image_copy_path, image_label))
56+
test_txt.write("{}\t{}".format(image_copy_path, image_label))
5757

5858

5959
# 删掉存在的文件

0 commit comments

Comments
 (0)