Skip to content

Instantly share code, notes, and snippets.

View keunhong's full-sized avatar

Keunhong Park keunhong

View GitHub Profile
______________________ _________________________ _________.___
\______ \_ _____/\ \ / /\_ _____/\______ \/ _____/| |
| _/| __)_ \ / | __)_ | _/\_____ \ | |
| | \| \ \ / | \ | | \/ \| |
|____|_ /_______ / \___/ /_______ / |____|_ /_______ /|___|
\/ \/ \/ \/ \/
[<<] K Park, 2008 (k@y.flixey.com)
[<<] Visit http://flixey.com for more.
[<<] GNU General Public License:
import math
def normal(x, mu, sigma):
return 1.0 / (sigma * math.sqrt(2*math.pi)) * torch.exp(-(x - mu)**2 / (2*sigma**2))
def continuous_histogram(batch, bins=32):
hists = Variable(torch.zeros(batch.size(0), 3, bins).cuda())
binvals = Variable(torch.linspace(0, 1, bins).cuda())
# Expand values so we compute histogram in parallel.
binvals = binvals.view(1, 1, 1, bins).expand(*batch.size(), bins)
import skimage
import skimage.io
import numpy as np
from kitnn.models import minc
import toolbox.images
mincnet = minc.MincVGG()
mincnet.load_npy('path/to/model.npy')
mincnet = mincnet.cuda()
@keunhong
keunhong / nag_verizon.py
Created July 3, 2012 04:26
Nag Verizon for order status
#!/usr/bin/python
import urllib.parse
import urllib.request
import re
import threading
import json
import pprint
from datetime import datetime
@keunhong
keunhong / install_blender_pyenv.md
Last active March 20, 2020 12:56 — forked from alexlee-gk/install_blender_pyenv.md
Install blender as a module with python 3.5 and pyenv

Install blender as a module with python 3.7 and pyenv

Instructions WIP

Tested on Ubuntu 18.04.

Setting up a new python environment using pyenv

Follow instructions from here.

Installing boost

@keunhong
keunhong / evaluate_pose.py
Created September 2, 2020 05:30
evaluate_pose.py
import argparse
import json
import time
from pathlib import Path
import shutil
from typing import Optional
import toml
@keunhong
keunhong / opencv.md
Last active September 23, 2021 18:52

Get the prefix for the virtualenv directory and the main python installation. Note that the pyenv commands are somewhat misleading.

PREFIX_MAIN=`pyenv virtualenv-prefix`
PREFIX_VENV=`pyenv prefix`

Download opencv and opencv_contrib into a clean directory. Make a separate build directory in same directory as opencv and opencv_contrib and enter it.