├── MOT17
│ ├── images
│ ├── labels_with_ids
10个参数 或者 8个参数
, , , , , , , , ,

9个参数

主要介绍视频的帧率、分辨率等基本信息。

数据标签含义与train相同。

其中,gt.txt 与 det.txt 中标签的含义在 readme.txt 中已经详细给出,现需要进行MOT17对应的格式。
├── UAVDT-MOT
│ ├── images
│ │ ├──train
│ │ │ ├──XXX(视频的文件夹名称)
│ │ │ │ ├──det
│ │ │ │ │ ├──det.txt(目标跟踪不需要)
│ │ │ │ ├──gt
│ │ │ │ │ ├──gt.txt
│ │ │ │ ├──img1
│ │ │ │ │ ├──XXX(jpg文件,其中名称与txt文件名称对应)
│ │ │ │ ├──seqinfo.ini
│ │ ├──test
│ │ │ ├──XXX(视频的文件夹名称)
│ │ │ │ ├──det
│ │ │ │ │ ├──det.txt(目标跟踪不需要)
│ │ │ │ ├──img1
│ │ │ │ │ ├──XXX(jpg文件,其中名称与txt文件名称对应)
│ │ │ │ ├──seqinfo.ini
│ ├── labels_with_ids
│ │ ├──train
│ │ │ ├──XXX(视频的文件夹名称)
│ │ │ │ ├──image1
│ │ │ │ │ ├──XXX(txt文件,其中名称与jpg文件名称对应)
目前UAVDT的文件路径如下,
├── UAVDT
│ ├── UAV-benchmark-M
│ │ ├── XXX(视频的文件夹名称)
│ │ │ ├──XXX(jpg文件,其中名称与txt文件名称对应)
│ ├── UAV-benchmark-MOTD_v1.0
│ │ ├──GT
│ │ │ ├──XXX_gt.txt
│ │ │ ├──XXX_gt_ignore.txt
│ │ │ ├──XXX_gt_whole.txt
需要进行的工作:
jpg文件已有,
gt.txt 的前7个标签是 *_gt.txt 的前7个标签;
gt.txt 的第8个标签是 *_gt_whole.txt 的第9个标签;
gt.txt 的前9个标签是 *_gt_whole.txt 的第7和第8个标签决定,共有12种情况;对应关系如下:
| out-of-view | occlusion | visibility ratio |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 2 | 0.8 |
| 1 | 3 | 0.85 |
| 1 | 4 | 0.95 |
| 2 | 1 | 0.85 |
| 2 | 2 | 0.5 |
| 2 | 3 | 0.6 |
| 2 | 4 | 0.7 |
| 3 | 1 | 0.85 |
| 3 | 2 | 0.6 |
| 3 | 3 | 065 |
| 3 | 4 | 0.75 |
import os
from tqdm import tqdm
import shutildef del_filefolder(path):list = ['M0403', 'M1301', 'M0203', 'M0701', 'M0209', 'M0208', 'M1009', 'M0802', 'M0602', 'M1001', 'M1401', 'M0606','M1101', 'M1302', 'M1303', 'M1007', 'M1004', 'M0205', 'M0801', 'M0601']for i in list:folder_path=os.path.join(path,'UAV-benchmark-M',i)print(folder_path)if os.path.exists(folder_path):shutil.rmtree(folder_path)print('del folder over!')def del_file(path):list = ['M0403', 'M1301', 'M0203', 'M0701', 'M0209', 'M0208', 'M1009', 'M0802', 'M0602', 'M1001', 'M1401', 'M0606','M1101', 'M1302', 'M1303', 'M1007', 'M1004', 'M0205', 'M0801', 'M0601']for i in list:gt_txt_path=os.path.join(path,'GT',str(i)+'_gt.txt')gt_whole_txt_path=os.path.join(path,'GT',str(i)+'_gt_whole.txt')if os.path.exists(gt_txt_path):os.remove(gt_txt_path)print('del gt_file over!')if os.path.exists(gt_whole_txt_path):os.remove(gt_whole_txt_path)print('del gt_whole_file over!')def count(path):''':param path: "1.txt":return:'''vedio_path = os.path.join(path, "UAV-benchmark-M")vedio_set = os.listdir(vedio_path)print(vedio_set)gt_path = os.path.join(path, 'GT')print(gt_path)# file_path=os.path.join(path,'sequences')# file_set=os.listdir(file_path)# # print(file_set)for i in tqdm(vedio_set):txt_path=os.path.join(gt_path,str(i)+'_gt.txt')whole_txt_path=os.path.join(gt_path,str(i)+'_gt_whole.txt')txt_count = len(open(txt_path,'rU').readlines())whole_txt_count = len(open(whole_txt_path,'rU').readlines())print('txt_count:',txt_count)print('whole_txt_count:',whole_txt_count)if(txt_count==whole_txt_count):print('ok')else:print(str(i)+'XXXXXXXXXXXXXX')print('----------------------------------------------')if __name__ == '__main__':del_filefolder('/home/course/ldw/dataset/UAVDT_MOT/')del_file('/home/course/ldw/dataset/UAVDT_MOT/')# count('/home/course/ldw/dataset/UAVDT_MOT/')
import os
import shutil
import timefrom tqdm import tqdm
from PIL import Imagedef process(path):vedio_path = os.path.join(path, "UAV-benchmark-M")vedio_set = os.listdir(vedio_path)print(vedio_set)gt_path = os.path.join(path, 'GT')print(gt_path)# file_path=os.path.join(path,'sequences')# file_set=os.listdir(file_path)# # print(file_set)for i in tqdm(vedio_set):file_path = os.path.join(path, 'train', str(i))makedir(file_path)file_gt_path = os.path.join(file_path, 'gt')makedir(file_gt_path)gt_url = file_gt_path + '\\gt.txt'print(gt_url) # E:\Projects\pythonprojects\Test\uavdt2mot\train\M0101\gt\gt.txtif not os.path.isfile(gt_url):fd = open(gt_url, mode="w", encoding="utf-8")file = open(gt_url, 'w').close()gt1_url = file_gt_path + '\\gt1.txt'print(gt1_url) # E:\Projects\pythonprojects\Test\uavdt2mot\train\M0101\gt\gt.txtif not os.path.isfile(gt1_url):fd = open(gt1_url, mode="w", encoding="utf-8")file = open(gt1_url, 'w').close()gt2_url = file_gt_path + '\\gt2.txt'print(gt2_url) # E:\Projects\pythonprojects\Test\uavdt2mot\train\M0101\gt\gt.txtif not os.path.isfile(gt2_url):fd = open(gt2_url, mode="w", encoding="utf-8")file = open(gt2_url, 'w').close()gt_txt_name = os.path.join(gt_path, i + '_gt.txt')print(gt_txt_name)gt_whole_name = os.path.join(gt_path, i + '_gt_whole.txt')print(gt_whole_name)f_gt = open(gt_txt_name, "r")f_whole_gt = open(gt_whole_name, 'r')for line2 in f_whole_gt.readlines():line2 = line2.replace("\n", "")if line2.endswith(","): # filter dataline2 = line2.rstrip(",")line_list2 = [int(i) for i in line2.split(",")]if (line_list2[6] == 1 and line_list2[7] == 1):line_list2[7] = 1if (line_list2[6] == 1 and line_list2[7] == 2):line_list2[7] = 0.8if (line_list2[6] == 1 and line_list2[7] == 3):line_list2[7] = 0.85if (line_list2[6] == 1 and line_list2[7] == 4):line_list2[7] = 0.95if (line_list2[6] == 2 and line_list2[7] == 1):line_list2[7] = 0.85if (line_list2[6] == 2 and line_list2[7] == 2):line_list2[7] = 0.5if (line_list2[6] == 2 and line_list2[7] == 3):line_list2[7] = 0.6if (line_list2[6] == 2 and line_list2[7] == 4):line_list2[7] = 0.7if (line_list2[6] == 3 and line_list2[7] == 1):line_list2[7] = 0.85if (line_list2[6] == 3 and line_list2[7] == 2):line_list2[7] = 0.6if (line_list2[6] == 3 and line_list2[7] == 3):line_list2[7] = 0.65if (line_list2[6] == 3 and line_list2[7] == 4):line_list2[7] = 0.75str_text2 = ',' + str(line_list2[8]) + ',' + str(line_list2[7])print(str_text2)with open(gt1_url, 'a') as file_name:file_name.write(str_text2 + '\n')for line in f_gt.readlines():line = line.replace("\n", "")if line.endswith(","): # filter dataline = line.rstrip(",")line_list = [int(i) for i in line.split(",")]# print(line_list)str_text = str(line_list[0]) + ',' + str(line_list[1]) + ',' + str(line_list[2]) + ',' + str(line_list[3]) + ',' + str(line_list[4]) + ',' + str(line_list[5]) + ',' + str(line_list[6])print(str_text)with open(gt2_url, 'a') as file_name:file_name.write(str_text + '\n')com(gt1_url,gt2_url,gt_url)def del_file(path):if os.path.exists(path):os.remove(path)print('del over!')def move(old_path, new_path):makedir(new_path)copyfile(old_path, new_path)def copyfile(old_folder_path, new_folder_path):print('---------------------')for file in os.listdir(old_folder_path):old_file_path = os.path.join(old_folder_path, file)# print(file)# print(new_folder_path)shutil.copy(old_file_path, new_folder_path)def makedir(filepath):if not os.path.exists(filepath):os.mkdir(filepath)def com(file1path,file2path,file_path):file_1 = open(file1path, 'r', encoding='utf-8')file_2 = open(file2path, 'r', encoding='utf-8')list1 = []for line in file_1.readlines():ss = line.strip()list1.append(ss)file_1.close()list2 = []for line in file_2.readlines():ss = line.strip()list2.append(ss)file_2.close()file_new = open(file_path, 'w', encoding='utf-8')for i in range(len(list1)):# 将两个txt文件合并到一行 中间用分隔符隔开sline = list2[i] + list1[i]# 写入新的txt文件 换行file_new.write(sline + '\n')file_new.close()if __name__ == '__main__':path = r'E:\Projects\pythonprojects\Test\uavdt2mot'process(path)
from main1_win import *def process(path):vedio_path = os.path.join(path, "UAV-benchmark-M")vedio_set = os.listdir(vedio_path)print(vedio_set)gt_path = os.path.join(path, 'GT')print(gt_path)# file_path=os.path.join(path,'sequences')# file_set=os.listdir(file_path)# # print(file_set)for i in tqdm(vedio_set):file_path = os.path.join(path, 'train', str(i))print('file_path:',file_path)makedir(file_path)file_gt_path = os.path.join(file_path, 'gt')makedir(file_gt_path)gt_url = file_gt_path + '\\gt.txt'print(gt_url) # E:\Projects\pythonprojects\Test\uavdt2mot\train\M0101\gt\gt.txtgt1_url = file_gt_path + '\\gt1.txt'print(gt1_url) # E:\Projects\pythonprojects\Test\uavdt2mot\train\M0101\gt\gt.txtgt2_url = file_gt_path + '\\gt2.txt'print(gt2_url)# del_file(gt1_url)# del_file(gt2_url)print('***********************************')img_path = os.path.join(vedio_path,str(i))img_set = os.listdir(img_path)img = Image.open(os.path.join(img_path, img_set[0]))ini_path = file_pathprint(ini_path)ini_file = ini_path + '\\seqinfo.ini'print(ini_file)if not os.path.isfile(ini_file):fd = open(ini_file, mode="w", encoding="utf-8")with open(ini_file, 'a') as ini_name:ini_text = '[Sequence]\n' + 'name=' + i + '\n' + 'imDir=img1\n' + 'frameRate=30\n' + 'seqLength=' + str(len(img_set)) + '\n' + 'imWidth = ' + str(img.size[0]) + '\n' + 'imHeight = ' + str(img.size[1]) + '\n' + 'imExt =.jpg\n'print(ini_text)ini_name.write(ini_text + '\n')if __name__ == '__main__':path = r'E:\Projects\pythonprojects\Test\uavdt2mot'process(path)