BATCH_SIZE = 37 PKL_ID = './ID_test.pkl' PGRAM_ROOT= 'dnn_result/posteriorgram/' DNN_MODEL = 'Angus_2' MEM_PGRAM = PGRAM_ROOT+DNN_MODEL+'_test.pgram' MEM_PGRAM_shape = (180406,48) ######################## # load RNN open file # ######################## print "Loading RNN..." layers,Ws,Whs,bs = pickle.load(open(MODEL_ROOT+MODEL,'rb')) nn = RNN_net(layers,Ws,Whs,bs, batch_size=BATCH_SIZE, momentum_type=MOMENTUM_TYPE, act_type=ACT_FUNC, cost_type=COST_FUNC) #IDs,TEST_DATA,VAL_DATA = readfile_for_test( TEST_ROOT+TEST,1 ) print "Reading data..." mem_pgram = np.memmap(MEM_PGRAM,dtype='float32',mode='r',shape=MEM_PGRAM_shape) IDs = readID(PKL_ID) idx = 0 IDs_utter = [] while idx <= len(IDs)-1: IDs_utter.append(["_".join(IDs[idx][0].split('_')[0:2]),IDs[idx][1]]) #IDs_utter = [utter_name,utter_max] idx+=IDs[idx][1]
frame_max = max(IDs_utter, key=lambda x: x[1]) train_data_length = len(pickList)*VAL_SET_RATIO DATA_LAYER = [ mem_pgram.shape[1] ] LABEL_LAYER = DATA_LAYER LAYERS = DATA_LAYER + HIDDEN_LAYERS + LABEL_LAYER ######################## # Create RNN # ######################## print "Creating RNN..." nn = RNN_net(LAYERS, batch_size = BATCH_SIZE, momentum_type = MOMENTUM_TYPE, act_type = ACT_FUNC, cost_type = COST_FUNC) ######################## # Train RNN # ######################## val_label_vec = None StateToVec = get_PhoneStateVec() PhoneState = load_liststateto48() PhoneIdx = load_dict_IdxPh48() prev_err = float('inf') prev_2 = float('inf') prev_3 = float('inf') cal_dev = 3
BATCH_SIZE = 1 PKL_ID = './ID_test.pkl' PGRAM_ROOT= 'dnn_result/posteriorgram/' DNN_MODEL = 'Angus_2' MEM_PGRAM = PGRAM_ROOT+DNN_MODEL+'_test.pgram' MEM_PGRAM_shape = (180406,48) ######################## # load RNN open file # ######################## print "Loading RNN..." layers,Ws,Whs,bs = pickle.load(open(MODEL_ROOT+MODEL,'rb')) nn = RNN_net(layers,Ws,Whs,bs, batch_size=BATCH_SIZE, momentum_type=MOMENTUM_TYPE, act_type=ACT_FUNC, cost_type=COST_FUNC) #IDs,TEST_DATA,VAL_DATA = readfile_for_test( TEST_ROOT+TEST,1 ) print "Reading data..." mem_pgram = np.memmap(MEM_PGRAM,dtype='float32',mode='r',shape=MEM_PGRAM_shape) IDs = readID(PKL_ID) idx = 0 IDs_utter = [] while idx <= len(IDs)-1: IDs_utter.append(["_".join(IDs[idx][0].split('_')[0:2]),IDs[idx][1]]) #IDs_utter = [utter_name,utter_max] idx+=IDs[idx][1]
frame_max = max(IDs_utter, key=lambda x: x[1]) train_data_length = len(pickList) * VAL_SET_RATIO pdb.set_trace() DATA_LAYER = [mem_pgram.shape[1]] LABEL_LAYER = DATA_LAYER LAYERS = DATA_LAYER + HIDDEN_LAYERS + LABEL_LAYER ######################## # Create RNN # ######################## print "Creating RNN..." nn = RNN_net(LAYERS, batch_size=BATCH_SIZE, momentum_type=MOMENTUM_TYPE, act_type=ACT_FUNC, cost_type=COST_FUNC) ######################## # Train RNN # ######################## val_label_vec = None StateToVec = get_PhoneStateVec() PhoneState = load_liststateto48() PhoneIdx = load_dict_IdxPh48() prev_err = float('inf') prev_2 = float('inf') prev_3 = float('inf') cal_dev = 3
frame_max = max(IDs_utter, key=lambda x: x[1]) train_data_length = len(pickList)*VAL_SET_RATIO DATA_LAYER = [ mem_pgram.shape[1] ] LABEL_LAYER = DATA_LAYER LAYERS = DATA_LAYER + HIDDEN_LAYERS + LABEL_LAYER ######################## # Create RNN # ######################## print "Creating RNN..." nn = RNN_net(LAYERS, batch_size=BATCH_SIZE, momentum_type="rmsprop", act_type="ReLU", cost_type="EU") ######################## # Train RNN # ######################## val_label_vec = None StateToVec = get_PhoneStateVec() PhoneState = load_liststateto48() PhoneIdx = load_dict_IdxPh48() p_s,p_e = 0,1 if p_e > len(pickList): p_e = len(pickList)
BATCH_SIZE = 1 PKL_ID = './ID_test.pkl' PGRAM_ROOT= 'dnn_result/posteriorgram/' DNN_MODEL = 'Angus_2' MEM_PGRAM = PGRAM_ROOT+DNN_MODEL+'_test.pgram' MEM_PGRAM_shape = (180406,48) ######################## # load RNN open file # ######################## print "Loading RNN..." layers,Ws,Whs,bs = pickle.load(open(MODEL_ROOT+MODEL,'rb')) nn = RNN_net(layers,Ws,Whs,bs, batch_size=BATCH_SIZE, momentum_type=MOMENTUM_TYPE, act_type=ACT_FUNC, cost_type=COST_FUNC) nn2 = RNN_net(layers,Ws,Whs,bs, batch_size=BATCH_SIZE, momentum_type=MOMENTUM_TYPE, act_type=ACT_FUNC, cost_type=COST_FUNC) #IDs,TEST_DATA,VAL_DATA = readfile_for_test( TEST_ROOT+TEST,1 ) print "Reading data..." mem_pgram = np.memmap(MEM_PGRAM,dtype='float32',mode='r',shape=MEM_PGRAM_shape) IDs = readID(PKL_ID) idx = 0