Ejemplo n.º 1
0
    targetStrings.extend(curTargetString)
    wordTargetStrings.extend(curWordTargetString)
    # print len(curTargetString)
    # print curCharSet
    charSet = charSet.union(curCharSet)

    #     for i in range(len(curTargetString)):
    #         print curWordTargetString[i]
    #         print curTargetString[i]

    xmlNames = getXmlNames(curXmlDir, l)
    assert len(curTargetString) == len(xmlNames)
    for xmlName in xmlNames:
        seqTags.append(xmlName)
        xmlFilePath = os.path.join(curXmlDir, xmlName)
        curLineStroke = getLineStroke(xmlFilePath)
        # print len(curLine)
        inputs.extend(curLineStroke)
        seqLengths.append(len(curLineStroke))
        seqDims.append([len(curLineStroke)])

inputsArr = np.array(inputs)
inputMeans = np.mean(inputsArr, 0)
inputStds = np.std(inputsArr, 0)
inputsArr[:, :-1] = (inputsArr[:, :-1] - inputMeans[:-1]) / inputStds[:-1]
inputs = inputsArr.tolist()
# print inputMeans
# print inputStds
# print inputs

labels = list(charSet)
Ejemplo n.º 2
0
    targetStrings.extend(curTargetString)
    wordTargetStrings.extend(curWordTargetString)
    # print len(curTargetString)
    # print curCharSet
    charSet = charSet.union(curCharSet)

#     for i in range(len(curTargetString)):
#         print curWordTargetString[i]
#         print curTargetString[i]
    
    xmlNames = getXmlNames(curXmlDir, l)
    assert len(curTargetString) == len(xmlNames)
    for xmlName in xmlNames:
        seqTags.append(xmlName)
        xmlFilePath = os.path.join(curXmlDir, xmlName)
        curLineStroke = getLineStroke(xmlFilePath)
        # print len(curLine)
        inputs.extend(curLineStroke)
        seqLengths.append(len(curLineStroke))
        seqDims.append([len(curLineStroke)])

inputsArr = np.array(inputs)
inputMeans = np.mean(inputsArr, 0)
inputStds = np.std(inputsArr, 0)
inputsArr[:, :-1] = (inputsArr[:, :-1] - inputMeans[:-1]) / inputStds[:-1]
inputs = inputsArr.tolist()
# print inputMeans
# print inputStds
# print inputs

labels = list(charSet)