def findData(opt):
maxLength = -1
dataPaths = [] #dataPaths is a py list
xmlRaw = open(os.path.join(opt.dataRoot, opt.dataset + '.txt'))
numData = opt.numEntry
xml = torch.zeros(numData, opt.maxXmlLen)
xmlLen = torch.zeros(numData)
for i, line in enumerate([itm for itm in xmlRaw]):
pieces = line.split()
xml[i][0] = normalizeRaw(0, float(pieces[1]), opt)
xml[i][1] = normalizeRaw(0, float(pieces[2]), opt)
xml[i][2] = normalizeRaw(0, float(pieces[3]), opt)
xml[i][3] = normalizeRaw(0, float(pieces[4]), opt)
xml[i][4] = int(pieces[0])
xmlLen[i] = 4
dataPaths.append(os.path.join('./', str(math.floor(int(pieces[0])/100)), pieces[0]))
if len(dataPaths[i]) + 1 > maxLength:
maxLength = len(dataPaths[i]) + 1
# dataPath = torch.CharTensor(numData, maxLength)
#TODO: Maybe try assign values to dataPath, which is using CharTensor instead of py list
return dataPaths, xml, xmlLen
评论列表
文章目录