Skip to content

Instantly share code, notes, and snippets.

View soroushmehr's full-sized avatar

Soroush Mehri soroushmehr

  • Microsoft Research (prev. Maluuba and MILA-UdeM)
  • Vancouver, BC
View GitHub Profile
@kastnerkyle
kastnerkyle / get_vctk_speakers.py
Last active December 20, 2016 13:33
Copy out certain speaker sets from vctk
# Based on code from Jose Sotelo
# Author: Kyle Kastner
# License: BSD 3-Clause
from __future__ import print_function
import os
import shutil
import subprocess
import stat
vctkdir = "/Tmp/kastner/vctk/VCTK-Corpus/"
@mickypaganini
mickypaganini / TestDense&HW.ipynb
Created May 7, 2016 19:13
Test Dense and Highway layers in Keras using the same inputs as in our lwtnn-test-highway.cxx
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anj1
anj1 / subexpr.py
Last active January 20, 2020 22:41
import types
import tensorflow as tf
import numpy as np
# Expressions are represented as lists of lists,
# in lisp style -- the symbol name is the head (first element)
# of the list, and the arguments follow.
# add an expression to an expression list, recursively if necessary.
def add_expr_to_list(exprlist, expr):
@thomelane
thomelane / jupyter_gym_render.py
Created September 11, 2018 00:40
OpenAI Gym render in Jupyter
import gym
from IPython import display
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
env = gym.make('Breakout-v0')
env.reset()
img = plt.imshow(env.render(mode='rgb_array')) # only call this once
for _ in range(100):
import math
import random
def get_random_neighbour(state):
neighbour = [house[:] for house in state] # Deep copy
i, j = random.sample(xrange(5), 2)
attr_idx = random.randint(0, 4)
neighbour[i][attr_idx], neighbour[j][attr_idx] = neighbour[j][attr_idx], neighbour[i][attr_idx]
# "Colorizing B/W Movies with Neural Nets",
# Network/Code Created by Ryan Dahl, hacked by samim.io to work with movies
# BACKGROUND: http://tinyclouds.org/colorize/
# DEMO: https://www.youtube.com/watch?v=_MJU8VK2PI4
# USAGE:
# 1. Download TensorFlow model from: http://tinyclouds.org/colorize/
# 2. Use FFMPEG or such to extract frames from video.
# 3. Make sure your images are 224x224 pixels dimension. You can use imagemagicks "mogrify", here some useful commands:
# mogrify -resize 224x224 *.jpg
# mogrify -gravity center -background black -extent 224x224 *.jpg
@machinaut
machinaut / Dockerfile
Created October 26, 2018 00:08
Demonstrating installing mujoco-py and gym[mujoco] on ubuntu 18.04
FROM ubuntu:18.04
# Install python and utils
RUN apt-get update && apt-get install -y python3-pip curl unzip \
libosmesa-dev libglew-dev patchelf libglfw3-dev
# Download mujoco
RUN curl https://www.roboti.us/download/mjpro150_linux.zip --output /tmp/mujoco.zip && \
mkdir -p /root/.mujoco && \
unzip /tmp/mujoco.zip -d /root/.mujoco && \
@endolith
endolith / frequency_estimator.py
Last active October 30, 2023 18:08
Frequency estimation methods in Python
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log, nonzero
from scipy.signal import blackmanharris, correlate
from time import time
import sys
try:
import soundfile as sf
except ImportError:
from scikits.audiolab import flacread
@Newmu
Newmu / conv_deconv_variational_autoencoder.py
Last active November 13, 2023 16:35
Prototype code of conv/deconv variational autoencoder, probably not runable, lots of inter-dependencies with local codebase =/
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.tensor.signal.downsample import max_pool_2d
from theano.tensor.extra_ops import repeat
from theano.sandbox.cuda.dnn import dnn_conv
from time import time
import numpy as np
from matplotlib import pyplot as plt