资源简介
kitti转为VOC.zip

代码片段和文件信息
# create_train_test_txt.py
# encoding:utf-8
import pdb
import glob
import os
import random
import math
def get_sample_value(txt_name category_name):
label_path = ‘./Labels/‘
txt_path = label_path + txt_name+‘.txt‘
try:
with open(txt_path) as r_tdf:
if category_name in r_tdf.read():
return ‘ 1‘
else:
return ‘-1‘
except IOError as ioerr:
print(‘File error:‘+str(ioerr))
txt_list_path = glob.glob(‘./Labels/*.txt‘)
txt_list = []
for item in txt_list_path:
temp1temp2 = os.path.splitext(os.path.basename(item))
txt_list.append(temp1)
txt_list.sort()
print(txt_list end = ‘\n\n‘)
# 有博客建议train:val:test=8:1:1,先尝试用一下
num_trainval = random.sample(txt_list math.floor(len(txt_list)*9/10.0)) # 可修改百分比
num_trainval.sort()
print(num_trainval end = ‘\n\n‘)
num_train = random.sample(num_trainvalmath.floor(len(num_trainval)*8/9.0)) # 可修改百分比
num_train.sort()
print(num_train end = ‘\n\n‘)
num_val = list(set(num_trainval).difference(set(num_train)))
num_val.sort()
print(num_val end = ‘\n\n‘)
num_test = list(set(txt_list).difference(set(num_trainval)))
num_test.sort()
print(num_test end = ‘\n\n‘)
pdb.set_trace()
Main_path = ‘./ImageSets/Main/‘
train_test_name = [‘trainval‘‘train‘‘val‘‘test‘]
category_name = [‘Car‘‘Pedestrian‘‘Cyclist‘]
# 循环写trainvl train val testc
for item_train_test_name in train_test_name:
list_name = ‘num_‘
list_name += item_train_test_name
train_test_txt_name = Main_path + item_train_test_name + ‘.txt‘
try:
# 写单个文件
with open(train_test_txt_name ‘w‘) as w_tdf:
# 一行一行写
for item in eval(list_name):
w_tdf.write(item+‘\n‘)
# 循环写Car Pedestrian Cyclist
for item_category_name in category_name:
category_txt_name = Main_path + item_category_name + ‘_‘ + item_train_test_name + ‘.txt‘
with open(category_txt_name ‘w‘) as w_tdf:
# 一行一行写
for item in eval(list_name):
w_tdf.write(item+‘ ‘+ get_sample_value(item item_category_name)+‘\n‘)
except IOError as ioerr:
print(‘File error:‘+str(ioerr))
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-30 20:41 kitti转为VOC\
文件 2363 2017-12-14 13:01 kitti转为VOC\create_train_test_txt.py
文件 2138 2017-12-20 10:13 kitti转为VOC\kitti_label.py
文件 2079 2017-12-14 12:31 kitti转为VOC\modify_annotations_txt.py
文件 4056 2017-12-14 12:55 kitti转为VOC\txt_to_xm
相关资源
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
- 联想启天M4350 BIOS升级文件
评论
共有 条评论