Skip to content

Instantly share code, notes, and snippets.

name: "SENet"
# mean_value: 104, 117, 123
layer {
name: "data"
type: "Input"
top: "data"
input_param: {
shape: {
dim: 1
dim: 3
@zhanghang1989
zhanghang1989 / eval_ade.py
Created June 5, 2018 18:04
Evaluating Script for ADE20K Dataset
import os
import sys
from tqdm import tqdm
from PIL import Image
import numpy as np
# adapt from https://github.com/CSAILVision/placeschallenge/blob/master/sceneparsing/evaluationCode/utils_eval.py
def intersectionAndUnion(imPred, imLab, numClass):
imPred = np.asarray(imPred)
imLab = np.asarray(imLab)
@zhanghang1989
zhanghang1989 / TwoLayerExample.m
Created March 9, 2018 01:36
Training Two Layer NN
N = 64;
D_in = 1000;
H = 100;
D_out = 10;
% init input and output
x = rand(N, D_in)-0.5;
y = rand(N, D_out)-0.5;
% init weights
colorscheme papaya
syntax on
set nu
set hlsearch
set autoindent
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set cursorline
autocmd BufRead,BufNewFile *.cu set filetype=cpp
autocmd Filetype cpp setlocal expandtab tabstop=2 shiftwidth=2
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4
" Vim color file
" Maintainer: Gerald S. Williams
" Last Change: 2003 Apr 17
" A nice light background (you guessed it, PapayaWhip) that's relatively easy
" on the eyes yet very usable. Not nearly as "puffy" as peachpuff.
"
" Only values that differ from defaults are specified.
set background=light
# export PATH=$PATH:/usr/local/cuda/bin
# export LD_LIBRARY_PATH=/usr/local/cuda/lib
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
alias l='ls -GFh'
alias count='ls -F |grep -v / | wc -l'
@zhanghang1989
zhanghang1989 / camera_demo.lua
Created May 27, 2017 02:55
Torch Lua Camera Demo
require 'torch'
require 'image'
require 'camera'
require 'qt'
local function main()
local camera_opt = {
idx = 0,
fps = 30,
@zhanghang1989
zhanghang1989 / camera_demo.py
Created May 27, 2017 02:55
Python Opencv Camera Show
import cv2
def run_demo(mirror=False):
cam = cv2.VideoCapture(0)
cam.set(3, 640)
cam.set(4, 480)
key = 0
while True:
# read frame
ret_val, img = cam.read()