add tools
This commit is contained in:
21
tools/add_n_txt.py
Normal file
21
tools/add_n_txt.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
|
||||
# ======== 你可以修改的参数 ========
|
||||
start_id = 1 # 起始编号
|
||||
end_id = 200 # 结束编号
|
||||
save_dir = "labels" # 输出目录
|
||||
prefix = "neg_" # 文件名前缀
|
||||
zero_padding = 5 # 位数(例如 00001)
|
||||
# ==================================
|
||||
|
||||
os.makedirs(save_dir, exist_ok=True)
|
||||
|
||||
for i in range(start_id, end_id + 1):
|
||||
name = f"{prefix}{str(i).zfill(zero_padding)}.txt"
|
||||
path = os.path.join(save_dir, name)
|
||||
|
||||
# 创建空文件
|
||||
with open(path, "w") as f:
|
||||
pass
|
||||
|
||||
print("created:", path)
|
||||
Reference in New Issue
Block a user