Skip to content

Instantly share code, notes, and snippets.

View insujeon's full-sized avatar

Insu Jeon insujeon

View GitHub Profile
@insujeon
insujeon / nms_fast.m
Created August 17, 2017 02:54 — forked from quantombone/nms_fast.m
blazing fast nms (non-maximum suppression)
function top = nms(boxes, overlap)
% top = nms_fast(boxes, overlap)
% Non-maximum suppression. (FAST VERSION)
% Greedily select high-scoring detections and skip detections
% that are significantly covered by a previously selected
% detection.
% NOTE: This is adapted from Pedro Felzenszwalb's version (nms.m),
% but an inner loop has been eliminated to significantly speed it
% up in the case of a large number of boxes
% Tomasz Malisiewicz (tomasz@cmu.edu)
class Maxout(nn.Module):
def __init__(self, d_in, d_out, pool_size):
super().__init__()
self.d_in, self.d_out, self.pool_size = d_in, d_out, pool_size
self.lin = nn.Linear(d_in, d_out * pool_size)
def forward(self, inputs):
shape = list(inputs.size())
@insujeon
insujeon / test_pytorch_mem.py
Created August 11, 2017 07:50 — forked from gwding/test_pytorch_mem.py
test pytorch memory usage
import sys
import torch
import torch.utils
import torch.nn as nn
from torch.autograd import Variable
from torchvision import models
try:
import gpustat
except ImportError:
@insujeon
insujeon / pvanet.py
Created August 10, 2017 07:54 — forked from DrustZ/pvanet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
def debug(debug_open, x, layername):
if debug_open:
print x.size(), 'after', layername
class PVANet(nn.Module):
@insujeon
insujeon / imageUtils.py
Created July 31, 2017 19:33 — forked from oeway/imageUtils.py
Improved image transform functions for dense predictions (for pytorch, keras etc.)
import numpy as np
import scipy
import scipy.ndimage
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
import collections
from PIL import Image
import numbers
__author__ = "Wei OUYANG"