EKF2-gen.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:PytorchDL 作者: FredHuangBia 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号