This file contains 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
#!/usr/local/bin/python3 | |
import itertools | |
import string | |
class Node: | |
"""A trie node.""" | |
def __init__(self, char, parent=None): | |
self._char = char |
This file contains 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
config defaultToCurrentScreen true | |
config nudgePercentOf screenSize | |
config resizePercentOf screenSize | |
# Resize Bindings | |
# bind right:alt resize +10% +0 | |
# bind left:alt resize -10% +0 | |
# bind up:alt resize +0 -10% | |
# bind down:alt resize +0 +10% | |
# bind right:ctrl;alt resize -10% +0 bottom-right |
This file contains 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
import numpy as np | |
import theano | |
import theano.tensor as T | |
low = 'float32' | |
high = 'float64' | |
dtype_low, dtype_high = [T.TensorType(f, (False,)) for f in [low, high]] | |
pred32, target32 = dtype_low('p'), dtype_low('t') | |
pred64, target64 = dtype_high('p'), dtype_high('t') |
This file contains 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
import numpy as np | |
import theano | |
import theano.tensor as T | |
pred, target = T.vectors('pt') # pred in (-inf, +inf), target in [0, 1] | |
L1 = T.nnet.binary_crossentropy(T.nnet.sigmoid(pred), target).sum() | |
L2 = T.nnet.sigmoid_binary_crossentropy(pred, target).sum() | |
fl1, fl2 = [theano.function([pred, target], L) for L in (L1, L2)] | |
g1, g2 = [theano.grad(L, [pred, target]) for L in (L1, L2)] |
This file contains 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
#!/usr/bin/env python | |
import numpy as np | |
def convert(image): | |
image = np.asarray(image) | |
if len(image.shape) == 2: | |
image = image[..., np.newaxis] | |
assert len(image.shape) == 3 | |
return image.transpose(2, 0, 1).copy() |
This file contains 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
net: "train_val.prototxt" | |
test_iter: 736 | |
test_interval: 1000000 # py solving tests | |
display: 1 | |
average_loss: 100 | |
# lr_policy: "fixed" | |
lr_policy: "step" | |
stepsize: 50000 | |
gamma: 0.1 | |
# base_lr: 1e-4 |
This file contains 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
#!/bin/bash | |
set -x | |
set -e | |
export LD_LIBRARY_PATH='/usr/local/cuda/lib64/' | |
export PYTHONUNBUFFERED="True" | |
NAME="scratch" | |
NAME="/tmp/magic_caffenet.caffenet" | |
if [ "$#" -ge 1 ]; then | |
NAME=${2} |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
set -x | |
GPU=0 | |
CWD=$(pwd) | |
CAFFE_DIR=/raid/jdonahue/philkr-caffe | |
MAGIC_DIR=~/magic_init | |
CLASS_DIR=/raid/jdonahue/voc-classification |
This file contains 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
import numpy as np | |
def canonical_axis(x, axis): | |
def is_int_ndarray(x): | |
if not isinstance(x, np.ndarray): | |
return False | |
dtype = str(x.dtype) | |
prefixes = 'int', 'uint' | |
return any(dtype.startswith(p) for p in prefixes) | |
if axis is None: |
This file contains 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
#!/usr/bin/env python | |
from __future__ import division | |
import functools | |
import itertools | |
import numpy as np | |
import os | |
import matplotlib.pyplot as plt | |
from PIL import Image |
NewerOlder