自制VOC数据集
环境 win10 cuda10 pytorch1.0
项目地址:faster-rcnn
参考博客:https://blog.csdn.net/weixin_43380510/article/details/83004127
data文件夹格式:
---VOC2007
------Annotations
------ImagesSet
---------Main
--------trainval.txt
--------test.txt
------JPEGImages
Annotations放xml文件
JPEGImages放图片
Main中存放txt文件,里面是图片名称,不带“.jpg”
手动制作txt代码如下:
import os
path_name = r'D:\Coding\python\faster-rcnn.pytorch-pytorch-1.0\data\VOCdevkit\VOC2007\JPEGImages'
f = open('D:/Coding/python/faster-rcnn.pytorch-pytorch-1.0/data/VOCdevkit/VOC2007/ImagesSet/Main/trainval.txt', mode='w')
for item in os.listdir(path_name):
original_name = os.path.join(path_name, item)
print(item)#原始名称带.jpg
str_name=item.split('.')#分割字符
print(str_name[0