Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jtkim-kaist committed Jan 26, 2018
1 parent b5cb8ae commit bdfb76c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions lib/python/graph_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import argparse
import tensorflow as tf
import data_reader_bDNN_v2 as dr
import data_reader_DNN_v2 as dnn_dr
import data_reader_RNN as rnn_dr


import utils as utils
import numpy as np
import os, sys

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = ""

def bdnn_prediction(batch_size, logits, threshold=0.6, w=19, u=9):
bdnn_batch_size = batch_size + 2*w
Expand Down Expand Up @@ -64,7 +61,7 @@ def do_test(fname_model, test_file_dir, norm_dir, data_len, is_default, model_ty
final_label = []

if model_type == 0: # acam

import data_reader_bDNN_v2 as dr
print(os.path.abspath('./configure/ACAM'))
sys.path.insert(0, os.path.abspath('./configure/ACAM'))

Expand Down Expand Up @@ -120,7 +117,7 @@ def do_test(fname_model, test_file_dir, norm_dir, data_len, is_default, model_ty
return final_softout[0:data_len, :], final_label[0:data_len, :]

if model_type == 1: # bdnn

import data_reader_bDNN_v2 as dr
print(os.path.abspath('./configure/bDNN'))
sys.path.insert(0, os.path.abspath('./configure/bDNN'))

Expand Down Expand Up @@ -170,7 +167,7 @@ def do_test(fname_model, test_file_dir, norm_dir, data_len, is_default, model_ty
return final_softout[0:data_len, :], final_label[0:data_len, :]

if model_type == 2: # dnn

import data_reader_DNN_v2 as dnn_dr
print(os.path.abspath('./configure/DNN'))
sys.path.insert(0, os.path.abspath('./configure/DNN'))

Expand Down Expand Up @@ -216,6 +213,7 @@ def do_test(fname_model, test_file_dir, norm_dir, data_len, is_default, model_ty
return final_softout[0:data_len, :], final_label[0:data_len, :]

if model_type == 3: # lstm
import data_reader_RNN as rnn_dr

print(os.path.abspath('./configure/LSTM'))
sys.path.insert(0, os.path.abspath('./configure/LSTM'))
Expand Down Expand Up @@ -309,4 +307,4 @@ def do_test(fname_model, test_file_dir, norm_dir, data_len, is_default, model_ty
# })
# # I taught a neural net to recognise when a sum of numbers is bigger than 45
# # it should return False in this case
# print(y_out) # [[ False ]] Yay, it works!
# print(y_out) # [[ False ]] Yay, it works!
2 changes: 1 addition & 1 deletion main.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
audio_dir = './data/clean/clean_speech.wav';
% audio_dir = './data/example/SNR103F3MIC021001_ch01.wav';

mode = 3; % 0 : ACAM3, 1 : bDNN, 2 : DNN, 3 : LSTM
mode = 2; % 0 : ACAM3, 1 : bDNN, 2 : DNN, 3 : LSTM
threshold = 0.4; % threshold for hard decision
output_type = 1; % 0 : frame based prediction, 1: sample based prediction
is_default = 1; % 0 : use trained model, 1: use default model
Expand Down
Binary file added result/label.mat
Binary file not shown.
Binary file added result/pred.mat
Binary file not shown.
Binary file added sample_data/Labels/label_000.bin
Binary file not shown.
Binary file added sample_data/mrcg_000.bin
Binary file not shown.
Binary file added sample_data/normalize_factor.mat
Binary file not shown.

0 comments on commit bdfb76c

Please sign in to comment.