Skip to content

Instantly share code, notes, and snippets.

@ih4cku
ih4cku / gist:a17b33d13a79498cde23bc150ae0d635
Created September 22, 2016 17:39 — forked from karpathy/gist:587454dc0146a6ae21fc
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@ih4cku
ih4cku / proxy.md
Last active September 14, 2016 13:02
work with proxy

All use http.proxy and https.proxy

git

git config --global http.sslVerify false

pip

pip install --trusted-host xxx.com package

@ih4cku
ih4cku / calc.py
Last active June 4, 2018 14:38
calc DeepLab receptive field
#!/usr/bin/env python
# net architecture of http://ccvl.stat.ucla.edu/ccvl/DeepLab/train.prototxt
# format: [kernel, stride]
deep_lab_vgg = [
# 1
[3, 1],
[3, 1],
[2, 2],
# 2
[3, 1],
//used for training
def bi_lstm_unroll(seq_len, input_size,num_hidden, num_embed, num_label, dropout=0.):
embed_weight = mx.sym.Variable("embed_weight")
cls_weight = mx.sym.Variable("cls_weight")
cls_bias = mx.sym.Variable("cls_bias")
last_states = []
last_states.append(LSTMState(c = mx.sym.Variable("l0_init_c"), h = mx.sym.Variable("l0_init_h")))
last_states.append(LSTMState(c = mx.sym.Variable("l1_init_c"), h = mx.sym.Variable("l1_init_h")))
forward_param = LSTMParam(i2h_weight=mx.sym.Variable("l0_i2h_weight"),
@ih4cku
ih4cku / cnn ocr
Created May 21, 2016 08:41 — forked from xlvector/cnn ocr
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme
# pylint: disable=superfluous-parens, no-member, invalid-name
import sys
sys.path.insert(0, "../../python")
import mxnet as mx
import numpy as np
import cv2, random
from io import BytesIO
from captcha.image import ImageCaptcha
@ih4cku
ih4cku / make_run_test.vim
Last active April 22, 2016 18:33
run test if make success
nnoremap <F7> :make! test<CR>
augroup MakeRunTestGroup
autocmd!
autocmd QuickFixCmdPost make call RunTest()
augroup END
function! RunTest()
" check quickfix list
let l:b_ok = 1
for m in getqflist()
#!/bin/env python
import requests
from bs4 import BeautifulSoup as Soup
import cPickle
def getStarers(soup):
stars = soup.select('#repos .follow-list-item')
starers = []
for s in stars:
starers.append(s.a['href']+'\n')
@ih4cku
ih4cku / opencv-2.4.11-cmake-command.txt
Created December 3, 2015 14:02
opencv-2.4.11-cmake-command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D CUDA_GENERATION=Auto..
@ih4cku
ih4cku / git-workflow.md
Created August 16, 2015 16:28
git workflow posts

working tree

  • A "working tree" consist of files that you are currently working on.

commits

  • a snapshot of
  • commiter
<blacklist>
<path>config.h</path>
<path>include.hpp</path>
<path>Makefile</path>
<path>rnnlib</path>
<path>rnnlib/Makefile</path>
<path>src/CodeNet.hpp</path>
<path>src/DecodingLayer.hpp</path>
<path>src/Makefile</path>
<path>src/MemoryNet.hpp</path>