Skip to content

Commit 6ad91ff

Browse files
committed
update 制作文件夹时先删除原有的数据集
1 parent f5a8f77 commit 6ad91ff

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dataset_tools/jade_create_paddle_ocr_datasets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ def __init__(self, root_path, save_path, dataset_type=None):
197197
self.conta_check_model = ContaNumber()
198198
self.dataset_type = dataset_type ## 数据集类型,如车牌数据集,箱号数据集
199199
label_list = self.get_label_text_path()
200-
200+
if os.path.exists(save_path):
201+
try:
202+
shutil.rmtree(save_path)
203+
except:
204+
print("删除文件夹失败,文件夹为:{}".format(save_path))
201205
for label_path in label_list:
202206
self.createOCRDatasets(label_path)
203207

@@ -404,6 +408,7 @@ def createDatasets(self, root_path):
404408
if os.path.exists(os.path.join(root_path, "rec_gt_test.txt")) is True:
405409
os.remove(os.path.join(root_path, "rec_gt_test.txt"))
406410
years = os.listdir(root_path)
411+
train_list = []
407412
with open(os.path.join(root_path, "rec_gt_train.txt"), "wb") as f1:
408413
for year in years:
409414
if len(year.split("-")) > 1 and os.path.isdir(os.path.join(root_path, year)):

0 commit comments

Comments
 (0)