def make_dataset(ifile_query, ifile_gallery): tmpdata = utils.readcsvfile(ifile_query, "\t") tmpdata2 = utils.readcsvfile(ifile_gallery, "\t") classes = [] for i in range(len(tmpdata)): classes.append(tmpdata[i][1]) classes = list(set(classes)) classes.sort() datalist_query = {} datalist_gallery = {} for i in range(len(classes)): datalist_query[i] = [] datalist_gallery[i] = [] for i in range(len(tmpdata)): row = tmpdata[i] datalist_query[classes.index(row[1])].append(row) for i in range(len(tmpdata2)): row = tmpdata2[i] datalist_gallery[classes.index(row[1])].append(row) return datalist_query, datalist_gallery, classes
def make_dataset_classfolders(ifile): tmpdata = utils.readcsvfile(ifile, "\t") classes = [] for i in range(len(tmpdata)): classes.append(tmpdata[i][1]) classes = list(set(classes)) classes.sort() datalist = {} for i in range(len(classes)): datalist[i] = [] for i in range(len(tmpdata)): row = tmpdata[i] datalist[classes.index(row[1])].append(row) return datalist, classes