import os
# DET_train.txt
prestr = 'train/ILSVRC2015_VID_train_0000/'
rdPath = './Data/VID/train/ILSVRC2015_VID_train_0000/'
wtPath = './ImageSets/DET_train.txt'
dirList = os.listdir(rdPath)
with open(wtPath, 'a') as f:
for na in dirList:
wtstr = ''.join([prestr, na, ' 1\n'])
f.write(wtstr)
# VID_train_15frames.txt
frameNum = 15
prestr = 'train/ILSVRC2015_VID_train_0000/'
rdPath = './Data/VID/train/ILSVRC2015_VID_train_0000/'
wtPath = './ImageSets/VID_train_15frames.txt'
dirList = os.listdir(rdPath)
with open(wtPath, 'a') as f:
for na in dirList:
head = ''.join([prestr, na, ' 1 '])
childPath = "".join([rdPath, na, '/'])
cnt = len(os.listdir(childPath))
interval = cnt // frameNum
start = cnt // 2 - (frameNum // 2) * interval
tail = ''.join([' ', str(cnt), '\n'])
for j in range(frameNum):
frameID = start + j * interval
wtstr = ''.join([head, str(frameID), tail])
f.write(wtstr)
# VID_train_every10frames.txt
everyFrames = 10
prestr = 'train/ILSVRC2015_VID_train_0000/'
rdPath = './Data/VID/train/ILSVRC2015_VID_train_0000/'
wtPath = './ImageSets/VID_train_every10frames.txt'
dirList = os.listdir(rdPath)
with open(wtPath, 'a') as f:
for na in dirList:
head = ''.join([prestr, na, ' 1 '])
childPath = "".join([rdPath, na, '/'])
cnt = len(os.listdir(childPath))
interval = everyFrames
start = 0
tail = ''.join([' ', str(cnt), '\n'])
cycles = cnt // interval
cycles = cycles + 1 if cycles * interval < cnt else cycles
for j in range(cycles):
frameID = start + interval * j
wtstr = ''.join([head, str(frameID), tail])
f.write(wtstr)
# VID_val_frames.txt
start = 1
prestr = 'val/'
rdPath = './Data/VID/val/'
wtPath = './ImageSets/VID_val_videos.txt'
dirList = os.listdir(rdPath)
with open(wtPath, 'a') as f:
for na in dirList:
childPath = "".join([rdPath, na, '/'])
cnt = len(os.listdir(childPath))
tail = ''.join([' ', str(cnt), '\n'])
for j in range(cnt):
head = "".join([prestr, na, ' ', str(start), ' '])
wtstr = ''.join([head, str(j), tail])
f.write(wtstr)
start = start + 1
# VID_val_videos.txt
start = 1
prestr = 'val/'
rdPath = './Data/VID/val/'
wtPath = './ImageSets/VID_val_frames.txt'
dirList = os.listdir(rdPath)
with open(wtPath, 'a') as f:
for na in dirList:
childPath = "".join([rdPath, na, '/'])
cnt = len(os.listdir(childPath))
head = "".join([prestr, na, '/'])
for j in range(cnt):
temp = "{:0>6d}".format(j)
tail = ''.join([' ', str(start), '\n'])
wtstr = ''.join([head, temp, tail])
f.write(wtstr)
start = start + 1