This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy.linalg import svd | |
| from scipy.io import wavfile | |
| from scipy.cluster.vq import vq | |
| from scipy.signal import firwin | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import zipfile | |
| import tarfile | |
| from numpy.lib.stride_tricks import as_strided | |
| import theano |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy.linalg import svd | |
| from scipy.io import wavfile | |
| from scipy.cluster.vq import vq | |
| from scipy.signal import firwin | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import zipfile | |
| import tarfile | |
| from numpy.lib.stride_tricks import as_strided | |
| import theano |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SPPLayer(lasagne.layers.Layer): | |
| def __init__(self, incoming, **kwargs): | |
| super(SPPLayer, self).__init__(incoming, **kwargs) | |
| # divide by 4 gives 16 patches | |
| self.win1 = (int(np.floor(incoming.output_shape[2]/4.0)), int(np.floor(incoming.output_shape[3]/4.0))) | |
| self.str1 = (int(np.ceil(incoming.output_shape[2]/4.0)), int(np.ceil(incoming.output_shape[3]/4.0))) | |
| # divide by 2 gives 4 patches | |
| self.win2 = (int(np.floor(incoming.output_shape[2]/2.0)), int(np.floor(incoming.output_shape[3]/2.0))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def gaussian_density_batch(x, mean, stddev, correlation, compute_derivatives=False): | |
| """ | |
| Compute the Gaussian density at x for a 2D normal distribution with parameters mean, stddev, correlation. | |
| This works simultaneously on a batch of inputs. The inputs should have dimensions: | |
| x.shape = (n, 1, 2) | |
| mean.shape = stddev.shape = (n, m, 2) | |
| correlation.shape = (n, m, 1) | |
| where n*m is the number of different Gaussian density functions that we want to evaluate, on n input points x. | |
| So the same input x is plugged into the density for m Gaussian pdfs. (This is convenient for evaluating a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| bitmap utils from Shawn Tan | |
| """ | |
| # Author: Kyle Kastner | |
| # License: BSD 3-clause | |
| # Equation 46 from http://arxiv.org/abs/1308.0850 | |
| from theano import tensor | |
| from scipy import linalg | |
| import theano | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| raise ValueError("DEPRECATED/FROZEN - see https://github.com/kastnerkyle/tools for the latest") | |
| # License: BSD 3-clause | |
| # Authors: Kyle Kastner | |
| # Harvest, Cheaptrick, D4C, WORLD routines based on MATLAB code from M. Morise | |
| # http://ml.cs.yamanashi.ac.jp/world/english/ | |
| # MGC code based on r9y9 (Ryuichi Yamamoto) MelGeneralizedCepstrums.jl | |
| # Pieces also adapted from SPTK | |
| from __future__ import division | |
| import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # code from Stack Overflow with minor Python 3 tweaks | |
| # Thanks to Andrew from SO for making such great code! | |
| # http://stackoverflow.com/questions/14416130/dynamically-create-a-list-of-shared-arrays-using-python-multiprocessing | |
| # For a reference on parallel processing in Python see this tutorial by David Beazley | |
| # http://www.slideshare.net/dabeaz/an-introduction-to-python-concurrency | |
| import time | |
| import ctypes | |
| import logging | |
| try: | |
| import Queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Author: Kyle Kastner | |
| # License: BSD 3-Clause | |
| # For a reference on parallel processing in Python see tutorial by David Beazley | |
| # http://www.slideshare.net/dabeaz/an-introduction-to-python-concurrency | |
| # Loosely based on IBM example | |
| # http://www.ibm.com/developerworks/aix/library/au-threadingpython/ | |
| try: | |
| import Queue | |
| except ImportError: | |
| import queue as Queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Authors: Kyle Kastner, Francesco Visin | |
| # License: BSD 3-Clause | |
| try: | |
| import Queue | |
| except ImportError: | |
| import queue as Queue | |
| import threading | |
| import time | |
| from matplotlib.path import Path | |
| from PIL import Image |