Exemplo n.º 1
0

class Hyperparameters:
    INPUT_LAYER = 43
    HIDDEN_LAYER = 75  #Modify??
    OUTPUT_LAYER = 3
    NUM_EPOCHS = 10000
    #NUM_EPOCHS = 1
    BATCH_NUMBER = 240
    LEARNING_RATE = 0.1
    VALIDATION_NUMBER = 30
    TEST_NUMBER = 30


HYP = Hyperparameters()
set_maker = SM()
pbfilename = "GraphV5/GRAPHS/GraphV5_frozen.pb"
file_name = "sen_data/inhale/61.wav"
prediction_dictionary = {0: "inhale", 1: "exhale", 2: "unknown"}

with tf.gfile.GFile(pbfilename, "rb") as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())

with tf.Graph().as_default() as graph:
    tf.import_graph_def(graph_def,
                        input_map=None,
                        return_elements=None,
                        name="")
    input = graph.get_tensor_by_name("placeholders/input_placeholder:0")
    output = graph.get_tensor_by_name("prediction_and_loss/output:0")
    NUM_EPOCHS = 10001
    #NUM_EPOCHS = 1
    BATCH_NUMBER = 340
    LEARNING_RATE = 0.1
    VALIDATION_NUMBER = 30
    TEST_NUMBER = 30


class Information:
    INPUT_DIMENSIONS = 43
    INPUT_TIME_DIV = 0.125
    INPUT_SECTORS = 8
    SAMPLE_RATE = 4096


set_maker = SM()
HYP = Hyperparameters()
prediction_dictionary = {0: "inhale", 1: "exhale", 2: "unknown"}

W_In = tf.Variable(
    tf.random_normal(shape=[HYP.INPUT_LAYER, HYP.HIDDEN_LAYER],
                     stddev=0.1,
                     mean=0),
    name="W_In")  #note: this used to have a mean of zero, so check that
W_Hidd = tf.Variable(tf.random_normal(
    shape=[HYP.HIDDEN_LAYER, HYP.HIDDEN_LAYER], stddev=0.1, mean=0),
                     name="W_Hidd")
W_Out = tf.Variable(tf.random_normal(
    shape=[HYP.HIDDEN_LAYER, HYP.OUTPUT_LAYER], stddev=0.1, mean=0),
                    name="W_Out")