from postprocesslen import Processor import csv import pyaudio from significancetest import Trendtest as Tt sigtest = Tt() k = open("streamtest/real_time.csv", "w") writer_log = csv.writer(k, lineterminator="\n") p = open("streamtest/real_time_report_silent.csv", "w") writer_log_raw = csv.writer(p, lineterminator="\n") filter = Processor(file_name="streamtest/predict_sig.csv") ParseData = DP() RunGraph = WG() SetMaker = SM() JUMPTIME = 2 FRAMERATE = 4096 CHUNK = 8192 OFFSET = 512 TIMEOUT = 4096 TIMEOUTSECS = TIMEOUT / FRAMERATE ALPHALEVEL = 0.995 STREAMING_ALPHA_LEVEL = 0.90 FORMAT = pyaudio.paInt16 timex = time.clock() time_zero = time.clock() prediction_dictionary = {0: "inhale", 1: "exhale", 2: "unknown"} x = -1 last_x = -1 time_last = time.clock()
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")