-
Notifications
You must be signed in to change notification settings - Fork 43
/
generateTestList.py
46 lines (29 loc) · 1.04 KB
/
generateTestList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
import os
import glob
def listFilesToTxt(dir,txtFile,extension,recursion):
exts = extension.split(";")
files = os.listdir(dir)
for name in files:
fullname = os.path.join(dir,name)
if(os.path.isdir(fullname) & recursion):
listFilesToTxt(fullname,txtFile,extension,recursion)
else:
for ext in exts:
if (name.endswith(ext)):
txtFile.write(name+"\n")
break
rootpath = './Datasets/'
datasets = ['DAVIS']
#datasets = ['DAVIS', 'DAVSOD', 'FBMS', 'MCL' , 'SegTrack-V1', 'SegTrack-V2', 'UVSD', 'ViSal', 'VOS']
for dataset in datasets:
dataPath = rootpath + dataset + '/'
seqList = os.listdir(dataPath)
outfile = './txt/' + dataset + '_test.txt'
with open(outfile,"w") as file:
for l in seqList:
s = dataPath + l + '/Imgs/'
imgFiles = glob.glob(os.path.join(s,'*.jpg'))
imgFiles.sort()
for f in imgFiles:
file.write(f+ ' 0'+"\n")