制作无车辆数据集步骤
使用工具:
potplayer
vscode
第一步
使用potplayer打开准备好的无车辆的视频
同时按下ctrt+G
,设置自己想要截取的格式
此处,我设置的是是按ms截取,采集数量设置的大些就行,可以自行估算其最小值应为多少
注意这里命名文件方式也可以按需修改
第二步
对文件进行批量重命名(如果你需要的话)
import os
class BatchRename():
def rename(self):
path = "place your path here"
filelist = os.listdir(path)
total_num = len(filelist)
i = 0
for item in filelist:
if item.endswith('.jpg'):
src = os.path.join(os.path.abspath(path), item)
dst = os.path.join(os.path.abspath(path), ''+str(i)+'.jpg')
try:
os.rename(src, dst)
i += 1
except:
continue
print('total %d to rename & converted %d jpg'%(total_num, i))
if __name__=='__main__':
demo = BatchRename()
demo.rename()
第三步
批量创建每张图片对应的标签文件
import os,pprint
#将文件目录指定到新建的文件目录下
os.chdir('your path')
print(os.getcwd())#确认当前目录
#用open函数创建文件
#使用join拼写目录
for i in range(1,540):
a = os.path.join('your path',str(i)+'.txt')
c = open(a,'w')
#遍历文件夹下的所有文件
print(os.listdir())
通过以上三步,无车辆的道路数据集就建立好了
以上仅供个人使用,侵权删