Ejemplo n.º 1
0
############# GET MODEL PARAMETERS #################
seth = GetValues()
prep, folds, save_model, model_type,\
model,feature, dropout, act1, act2,\
act3, input_neurons, epochs, batchsize,\
num_classes, agg_num, hop, loss, optimizer,\
dataset=seth.get_parameters(dataset='dcase_2016')
import config as cfg

############# EXTRACT FEATURES #####################
extract = False
if extract:
    aud_audio.extract(feature,
                      cfg.wav_dev_fd,
                      cfg.dev_fd + '/' + feature,
                      'parameters.yaml',
                      dataset=dataset)
    aud_audio.extract(feature,
                      cfg.wav_eva_fd,
                      cfg.eva_fd + '/' + feature,
                      'parameters.yaml',
                      dataset=dataset)

############# LOAD DATA ###########################
tr_X, tr_y = seth.get_train_data()
dimx = tr_X.shape[-2]
dimy = tr_X.shape[-1]
tr_X = aud_utils.mat_3d_to_nd(model, tr_X)
miz = aud_model.Functional_Model(input_neurons=input_neurons,
                                 dropout=dropout,
Ejemplo n.º 2
0
input_neurons=400      # Number of Neurons
epochs=10              # Number of Epochs
batchsize=128          # Batch Size
num_classes=15         # Number of classes
filter_length=3        # Size of Filter
nb_filter=100          # Number of Filters
#Parameters that are passed to the features.
agg_num=10             # Agg Number(Integer) Number of frames
hop=10                 # Hop Length(Integer)

dataset = 'dcase_2016'
extract = 0

## EXTRACT FEATURES
if extract:
    aud_audio.extract(feature, wav_dev_fd, dev_fd+'/'+feature,'example.yaml',dataset=dataset)
    aud_audio.extract(feature, wav_eva_fd, eva_fd+'/'+feature,'example.yaml',dataset=dataset)

def GetAllData(fe_fd, csv_file, agg_num, hop):
    """
    Input: Features folder(String), CSV file(String), agg_num(Integer), hop(Integer).
    Output: Loaded features(Numpy Array) and labels(Numpy Array).
    Loads all the features saved as pickle files.
    """
    # read csv
    with open( csv_file, 'rb') as f:
        reader = csv.reader(f)
        lis = list(reader)
    
    # init list
    X3d_all = []
Ejemplo n.º 3
0
print "Epochs", epochs
print "Batchsize", batchsize
print "Number of filters", nb_filter

## UNPACK THE DATASET ACCORDING TO KERAS_AUD

# [NEEDED AT INITIAL STAGE]
path = 'E:/akshita_workspace/chime_home'
# [NEEDED AT INITIAL STAGE]
#aud_utils.unpack_chime_2k16(path,wav_dev_fd,wav_eva_fd,meta_train_csv,meta_test_csv,label_csv)

## EXTRACT FEATURES

aud_audio.extract(feature,
                  wav_dev_fd,
                  dev_fd + '/' + feature,
                  'defaults.yaml',
                  dataset='chime_2016')
aud_audio.extract(feature,
                  wav_eva_fd,
                  eva_fd + '/' + feature,
                  'defaults.yaml',
                  dataset='chime_2016')


def GetAllData(fe_fd, csv_file, agg_num, hop):
    """
    Input: Features folder(String), CSV file(String), agg_num(Integer), hop(Integer).
    Output: Loaded features(Numpy Array) and labels(Numpy Array).
    Loads all the features saved as pickle files.
    """