Esempio n. 1
0
    input_space = dnn_model.get_input_space()
    batch = input_space.make_theano_batch()
    fprop = theano.function([batch], dnn_model.fprop(batch))

    # load aux model
    aux_model = joblib.load(args.aux_model)
    L = os.path.splitext(os.path.split(args.aux_model)[-1])[0].split('_L')[-1]
    if L == 'All':
        which_layers = [1, 2, 3]
    else:
        which_layers = [int(L)]

    # fft params
    nfft = 2 * (input_space.dim - 1)
    nhop = nfft // 2
    win = winfunc(1024)

    # design lowpass filter.
    b, a = sp.signal.butter(4, cut_freq / (22050. / 2.))

    flist = glob.glob(args.in_path + '*.wav')

    dnn_file = open(
        os.path.join(args.out_path,
                     stripf(args.dnn_model) + '.adversaries.txt'), 'w')
    dnn_file_filt = open(
        os.path.join(args.out_path,
                     stripf(args.dnn_model) + '.adversaries.filtered.txt'),
        'w')
    aux_file = open(
        os.path.join(args.out_path,
Esempio n. 2
0
    input_space = dnn_model.get_input_space()
    batch       = input_space.make_theano_batch()
    fprop       = theano.function([batch], dnn_model.fprop(batch))

    # load aux model
    aux_model = joblib.load(args.aux_model)
    L = os.path.splitext(os.path.split(args.aux_model)[-1])[0].split('_L')[-1]
    if L=='All':
        which_layers = [1,2,3]
    else:
        which_layers = [int(L)]

    # fft params
    nfft = 2*(input_space.dim-1)
    nhop = nfft//2
    win = winfunc(1024)
    
    # design lowpass filter.
    b,a = sp.signal.butter(4, cut_freq/(22050./2.))

    flist = glob.glob(args.in_path +'*.wav')

    dnn_file = open(os.path.join(args.out_path, stripf(args.dnn_model) + '.adversaries.txt'), 'w')
    dnn_file_filt = open(os.path.join(args.out_path, stripf(args.dnn_model) + '.adversaries.filtered.txt'), 'w')
    aux_file = open(os.path.join(args.out_path, stripf(args.aux_model) + '.adversaries.txt'), 'w')
    aux_file_filt = open(os.path.join(args.out_path, stripf(args.aux_model) + '.adversaries.filtered.txt'), 'w')

    for f in flist:
        fname = stripf(f)

        # load audio file
Esempio n. 3
0
    # load aux model
    if args.aux_model:
        aux_model = joblib.load(args.aux_model)
        L = os.path.splitext(os.path.split(args.aux_model)[-1])[0].split('_L')[-1]
        if L=='All':
            which_layers = [1,2,3]
        else:
            which_layers = [int(L)]
        aux_file = open(os.path.join(args.out_path, stripf(args.aux_model) + '.adversaries.txt'), 'w')

    dnn_file = open(os.path.join(args.out_path, stripf(args.dnn_model) + '.adversaries.txt'), 'w')

    # fft params
    nfft = 2*(dim-1)
    nhop = nfft//2
    win = winfunc(2048)
    
    flist = glob.glob(os.path.join(args.in_path, '*'))

    for f in flist:
        fname = stripf(f)

        if f.endswith('.wav'):
            read_fun = audiolab.wavread             
        elif f.endswith('.au'):
            read_fun = audiolab.auread
        elif f.endswith('.mp3'):
            read_fun = read_mp3
        else:
            continue