当前位置:网站首页>Generate JDE dot train
Generate JDE dot train
2022-06-26 13:20:00 【Dabie Mountains】
Dot train format for JDE
- Generate train Format file
- Filter by the format of the dataset
from glob2 import glob
import os
images = r"C:\Users\lpf\Desktop\MOT\Code-MOT\Towards-Realtime-MOT-master\data\KITTI_Det\images"
dot_train = r"C:\Users\lpf\Desktop\MOT\Code-MOT\Towards-Realtime-MOT-master\data\kitti_det.train"
path_labels = r"C:\Users\lpf\Desktop\MOT\Code-MOT\Towards-Realtime-MOT-master\data\KITTI_Det\labels_with_ids"
def write_dot_train(path_dot_train, img_path_list):
with open(path_dot_train, "w") as f:
for path in img_path_list:
f.writelines("{}\n".format(path))
# This method is detection Special for dataset conversion
def generate_dot_train(path_labels):
include_object = []
include_img = []
labels_txt = glob(path_labels + "/*.txt")
for i in labels_txt:
file_size = os.path.getsize(i)
if file_size > 0:
include_object.append(i)
# print("File size is :", file_size, "bytes")
# print(i)
a = os.path.split(i)[-1]
temp = a[:-4]
temp = temp + ".png"
# temp = os.path.join(images, temp)
temp = "KITTI_Det/images/{}".format(temp)
include_img.append(temp)
# break
return include_img
# pass
include_image = generate_dot_train(path_labels=path_labels)
write_dot_train(dot_train,include_image)
# print(len(labels_txt))
# print(len(include_object))
# This method is tracking special
def generate_kitti_train():
# Note that the generated here is based on image Benchmarking train file , Include all pictures , And usually after screening lebels_with_ids No way. , Will be less
# Modification is the use of lebels_with_ids Benchmarking , And then txt Use replace Methods to png
path = os.walk(images)
for root, directories, files in path:
for _dir in directories:
line = "/KITTI_Det/images/{}/".format(_dir)
_dir = os.path.join(r"E:\8_DataSet\KITTI_tracking\image_02", _dir)
# dir_list.append(_dir)
txt_list = os.listdir(_dir)
with open("kitti-img.train", 'a') as f:
for item in txt_list:
line1 = line + item
f.writelines(line1)
f.writelines("\n")
边栏推荐
- mysql讲解(一)
- 2、并行接口、协议和相关芯片介绍(8080、8060)
- Solutions to insufficient display permissions of find and Du -sh
- IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times
- [how to connect the network] Chapter 2 (next): receiving a network packet
- J - Wooden Sticks poj 1065
- Copy multiple Excel files and name them different
- D - skiing
- H5 video automatic playback and circular playback
- C language: Exercise 2
猜你喜欢
随机推荐
Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
Electron official docs series: Development
code force Party Lemonade
Oplg: new generation cloud native observable best practices
Analysis of state transition diagram of Beifu NC axis
8. [STM32] timer (TIM) -- interrupt, PWM, input capture experiment (proficient in timer)
Electron official docs series: Contributing
Dark horse notes - Common APIs
I have a good word to say, and I admire myself
享元模式(Flyweight)
Explain C language 10 in detail (C language series)
5月产品升级观察站
IDC报告:百度智能云AI Cloud市场份额连续六次第一
C - Common Subsequence
8、【STM32】定时器(TIM)——中断、PWM、输入捕获实验(一文精通定时器)
I - Dollar Dayz
Electron official docs series: References
B - Bridging signals
C - Common Subsequence
橋接模式(Bridge)








