Skip to content

Commit 0f1aaf3

Browse files
committed
* 制作文本检测数据集时需要判断txt文件存不存在
1 parent e7abe92 commit 0f1aaf3

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
### 更新日志
22

3-
#### DatasetToolsV1.1.0 - 2023-08-15
4-
* 制作箱号识别模型时去除空白字符
3+
#### DatasetToolsV1.1.1 - 2023-08-23
4+
* 制作文本检测数据集时需要判断txt文件存不存在
55
---
66
<details onclose>
77
<summary>查看更多更新日志</summary>
88

9+
#### DatasetToolsV1.1.0 - 2023-08-15
10+
* 制作箱号识别模型时去除空白字符
11+
---
912

1013
#### DatasetToolsV1.0.9 - 2023-03-13
1114
* 更新集装箱箱型判断的规则

dataset_tools/jade_create_paddle_text_detection_datasets.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# @Mailbox : jadehh@live.com
77
# @Software: Samples
88
# @Desc :
9+
import os.path
10+
911
from jade import *
1012
import json
1113
import base64
@@ -175,20 +177,23 @@ def createDatasets(root_path):
175177
with open(os.path.join(root_path, "train_icdar2015_label.txt"), "wb") as f1:
176178
for year in years:
177179
if len(year.split("-")) > 1 and os.path.isdir(os.path.join(root_path, year)):
178-
with open(os.path.join(root_path, year, "train_icdar2015_label.txt"), "rb") as f:
179-
content_list = f.readlines()
180-
for content in content_list:
181-
new_c = year + "/" + str(content,encoding="utf-8").strip()
182-
f1.write((new_c + "\n").encode("utf-8"))
180+
if os.path.exists(os.path.join(root_path, year, "train_icdar2015_label.txt")):
181+
with open(os.path.join(root_path, year, "train_icdar2015_label.txt"), "rb") as f:
182+
content_list = f.readlines()
183+
for content in content_list:
184+
new_c = year + "/" + str(content, encoding="utf-8").strip()
185+
f1.write((new_c + "\n").encode("utf-8"))
183186

184187
with open(os.path.join(root_path, "test_icdar2015_label.txt"), "wb") as f1:
185188
for year in years:
186189
if len(year.split("-")) > 1 and os.path.isdir(os.path.join(root_path, year)):
187-
with open(os.path.join(root_path, year, "test_icdar2015_label.txt"), "rb") as f:
188-
content_list = f.readlines()
189-
for content in content_list:
190-
new_c = year + "/" + str(content,encoding="utf-8").strip()
191-
f1.write((new_c + "\n").encode("utf-8"))
190+
if os.path.exists(os.path.join(root_path, year, "test_icdar2015_label.txt")):
191+
with open(os.path.join(root_path, year, "test_icdar2015_label.txt"), "rb") as f:
192+
content_list = f.readlines()
193+
for content in content_list:
194+
new_c = year + "/" + str(content, encoding="utf-8").strip()
195+
f1.write((new_c + "\n").encode("utf-8"))
196+
192197

193198

194199
def removeNolabelDatasets(root_path):

0 commit comments

Comments
 (0)