Skip to content

Instantly share code, notes, and snippets.

View dneuraln's full-sized avatar

Programing with Deep Neural Networks dneuraln

View GitHub Profile
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
@dneuraln
dneuraln / min-char-rnn.py
Created July 15, 2016 01:50 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@dneuraln
dneuraln / elastic_transform.py
Created August 1, 2016 17:41 — forked from fmder/elastic_transform.py
Elastic transformation of an image in Python
import numpy
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def elastic_transform(image, alpha, sigma, random_state=None):
"""Elastic deformation of images as described in [Simard2003]_.
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for
Convolutional Neural Networks applied to Visual Document Analysis", in
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dneuraln
dneuraln / gputest.lua
Created August 27, 2016 01:36 — forked from jaderberg/gputest.lua
GPU Torch Benchmark
-- Max Jaderberg 4/9/13
-- GPU Effectiveness test
require 'torch'
require 'sys'
require 'nn'
require 'xlua'
cmd = torch.CmdLine()
cmd:text()
@dneuraln
dneuraln / conv_deconv_variational_autoencoder.py
Created September 6, 2016 06:53 — forked from Newmu/conv_deconv_variational_autoencoder.py
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
@dneuraln
dneuraln / conv_deconv_vae.py
Created September 6, 2016 06:53 — forked from kastnerkyle/conv_deconv_vae.py
Convolutional Variational Autoencoder, modified from Alec Radford at (https://gist.github.com/Newmu/a56d5446416f5ad2bbac)
# Alec Radford, Indico, Kyle Kastner
# License: MIT
"""
Convolutional VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
Additionally converted to use default conv2d interface instead of explicit cuDNN
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
@dneuraln
dneuraln / mdn_demo_theano.py
Created September 10, 2016 16:27 — forked from daniel-geon-park/mdn_demo_theano.py
Mixture Density Network(MDN) implemenation in Theano
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 22 00:36:48 2016
@author: park
"""
#%% train
import theano
import sys
sys.path.append('..')
import os
import json
from time import time
import numpy as np
from tqdm import tqdm
from matplotlib import pyplot as plt
from sklearn.externals import joblib
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import rnn
def lazy_property(function):