dataTrain, dataTest = data[train_index], data[test_index]

		dTrain = bf.onlySampleSize(dataTrain, 1)
		dTest = bf.onlySampleSize(dataTest, 1)

		acc_xTrain = []
		acc_yTrain = []
		aud_xTrain = []
		aud_yTrain = []
		xTrain = []
		yTrain = []
		for d in dTrain:
			acc_xTrain.append(d[0 : numTotalAcc])
			aud_xTrain.append(d[numTotalAcc : numTotalAcc + numTotalAud])
			xTrain.append(d[0 : numTotalAcc + numTotalAud])
			acc_yTrain.append(bf.oneHotLabel(int(d[-1]), numLabel))
			aud_yTrain.append(bf.oneHotLabel(int(d[-1]), numLabel))
			yTrain.append(bf.oneHotLabel(int(d[-1]), numLabel))
		print('acc_xTrain : ', len(acc_xTrain))
		print('aud_xTrain : ', len(aud_xTrain))

		acc_xTest = []
		acc_yTest = []
		aud_xTest = []
		aud_yTest = []
		for d in dTest:
			acc_xTest.append(d[0 : numTotalAcc])
			aud_xTest.append(d[numTotalAcc : numTotalAcc + numTotalAud])
			acc_yTest.append(bf.oneHotLabel(int(d[-1]), numLabel))
			aud_yTest.append(bf.oneHotLabel(int(d[-1]), numLabel))
Exemple #2
0
    kf.get_n_splits(data)
    data = np.array(data)
    for train_index, test_index in kf.split(data):
        dataTrain, dataTest = data[train_index], data[test_index]

        dTrain = bf.onlySampleSize(dataTrain, 1)

        xTrain = []
        yTrain = []
        for d in dTrain:
            xTrain.append(d[0:300])

            #print("yTrain : ",(int(d[300])))
            #print("d[0:301 : " , d[0:301])
            #print("d : ",(d[300]))
            yTrain.append(bf.oneHotLabel(int(d[300]), numLabel))

        #       on Imac the GPU is not working. so
        with tf.device('/gpu:3'):
            inputX = tf.placeholder(tf.float32, [None, 300])
            outputY = tf.placeholder(tf.float32, [None, 10])

            #1 * 100 * 3
            W_conv1 = weight_variable([3, 1, 1, 9]) #width, height, channel input, channel output
            b_conv1 = bias_variable([9])
            x_image = tf.reshape(inputX, [-1, 100, 3, 1]) # -1, width, height, channel)
            h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
            h_pool1 = max_pool_2x2(h_conv1)
            #1 * 150 * 9
            W_conv2 = weight_variable([3, 1, 9, 18])
            b_conv2 = bias_variable([18])