Example #1
0
            #     loadpath=loadpath, appoint=session)
            testData = numpy.load(loadpath + '%s-Session%d-Data.npy' %
                                  (gender, session))
            testLabel = numpy.load(loadpath + '%s-Session%d-Label.npy' %
                                   (gender, session))
            testSeq = numpy.load(loadpath + '%s-Session%d-Seq.npy' %
                                 (gender, session))

            for episode in range(100):
                graph = tensorflow.Graph()
                with graph.as_default():
                    classifier = CTC_Multi_BLSTM(trainData=None,
                                                 trainLabel=None,
                                                 trainSeqLength=None,
                                                 featureShape=numpy.shape(
                                                     testData[0])[1],
                                                 numClass=5,
                                                 rnnLayers=2,
                                                 graphRevealFlag=False,
                                                 startFlag=False)
                    print('\nEpisode %d/100' % episode)
                    classifier.Load(loadpath=netpath %
                                    (part, session, episode))
                    matrixDecode, matrixLogits, matrixSoftMax = classifier.Test_AllMethods(
                        testData=testData,
                        testLabel=testLabel,
                        testSeq=testSeq)
                    print('\n\n')
                    print(matrixDecode)
                    print(matrixLogits)
                    print(matrixSoftMax)
Example #2
0
import os

if __name__ == '__main__':
    part = 'Bands-30'
    session = 6
    startPosition = 13
    loadpath = 'E:/CTC_Target_MSP/Feature/%s/' % part
    savepath = 'E:/CTC_Target_MSP/CTC-MSP-Origin/%s-Session-%d/' % (part,
                                                                    session)

    trainData, trainLabel, trainSeq, trainScription, testData, testlabel, testSeq, testScription = Load_MSP(
        loadpath=loadpath, appointSession=session)

    graph = tensorflow.Graph()
    with graph.as_default():
        classifier = CTC_Multi_BLSTM(trainData=trainData,
                                     trainLabel=trainScription,
                                     trainSeqLength=trainSeq,
                                     featureShape=len(trainData[0][0]),
                                     numClass=5,
                                     rnnLayers=2,
                                     graphRevealFlag=False)
        print(classifier.information)
        classifier.Load(loadpath=savepath + '%04d-Network' % startPosition)
        for episode in range(startPosition + 1, 100):
            print('\nEpisode %d/100 : Total Loss = %f\n' %
                  (episode, classifier.Train()),
                  end='')
            classifier.Save(savepath=savepath + '%04d-Network' % episode)
    # exit()
    if os.path.exists(savepath): exit()

    os.makedirs(savepath + 'Decode')
    os.makedirs(savepath + 'Logits')
    os.makedirs(savepath + 'SoftMax')

    trainData, trainLabel, trainSeq, trainScription, testData, testLabel, testSeq, testScription = Load_FAU(
        loadpath=loadpath)

    for episode in range(100):
        graph = tensorflow.Graph()
        with graph.as_default():
            classifier = CTC_Multi_BLSTM(trainData=None,
                                         trainLabel=None,
                                         trainSeqLength=None,
                                         featureShape=bands,
                                         numClass=6,
                                         rnnLayers=2,
                                         graphRevealFlag=False,
                                         startFlag=False)
            print('\nEpisode %d/100' % episode)
            classifier.Load(loadpath=netpath % (bands, episode))
            matrixDecode, matrixLogits, matrixSoftMax = classifier.Test_AllMethodsWithLen(
                testData=testData, testLabel=testLabel, testSeq=testSeq)
            print('\n\n')
            print(matrixDecode)
            print(matrixLogits)
            print(matrixSoftMax)

            with open(savepath + 'Decode/%04d.csv' % episode, 'w') as file:
                for indexX in range(5):
                    for indexY in range(5):
from CTC_Target.Loader.IEMOCAP_Loader import Load_MSP
import tensorflow
from CTC_Target.Model.CTC_Multi_BLSTM import CTC_Multi_BLSTM
import os

if __name__ == '__main__':
    for part in ['Bands-30']:
        loadpath = 'E:/CTC_Target_MSP/Feature/%s/' % part
        for session in range(6, 7):
            savepath = 'E:/CTC_Target_MSP/CTC-MSP-Origin/%s-Session-%d/' % (part, session)
            if os.path.exists(savepath): continue
            os.makedirs(savepath)
            trainData, trainLabel, trainSeq, trainScription, testData, testlabel, testSeq, testScription = Load_MSP(
                loadpath=loadpath, appointSession=session)

            graph = tensorflow.Graph()
            with graph.as_default():
                classifier = CTC_Multi_BLSTM(trainData=trainData, trainLabel=trainScription, trainSeqLength=trainSeq,
                                             featureShape=len(trainData[0][0]), numClass=5, rnnLayers=2,
                                             graphRevealFlag=False)
                print(classifier.information)
                for episode in range(100):
                    print('\nEpisode %d/100 : Total Loss = %f\n' % (episode, classifier.Train()), end='')
                    classifier.Save(savepath=savepath + '%04d-Network' % episode)
            # exit()