generate_testlist_multicrop.py 516 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import os

vallist = 'vallist.txt'
testlist = 'testlist.txt'
sampling_times = 10
cropping_times = 3

fl = open(vallist).readlines()
fl = [line.strip() for line in fl if line.strip() != '']
f_test = open(testlist, 'w')

for i in range(len(fl)):
    line = fl[i].split(' ')
    fn = line[0]
    label = line[1]
    for j in range(sampling_times):
        for k in range(cropping_times):
            test_item = fn + ' ' + str(i) + ' ' + str(j) + ' ' + str(k) + '\n'
            f_test.write(test_item)

f_test.close()