Skip to content

Instantly share code, notes, and snippets.

View AruniRC's full-sized avatar

AruniRC AruniRC

View GitHub Profile
@AruniRC
AruniRC / install_env_gypsum.md
Last active July 4, 2019 20:31
Setup conda environment for Detectron with PyTorch on Gypsum

This walkthrough describes setting up Detectron (3rd party pytorch implementation) and Graph Conv Net (GCN) repos on the UMass cluster Gypsum. Most commands are specific to that setting.

Gypsum environment

$ module list
Currently Loaded Modulefiles:
  1) slurm/16.05.8                         3) hdf5/1.6.10                           5) gcc5/5.4.0                            7) cudnn/5.1
 2) openmpi/gcc/64/1.10.1 4) fftw2/openmpi/open64/64/float/2.1.5 6) cuda80/toolkit/8.0.61 8) hdf5_18/1.8.17
@AruniRC
AruniRC / context_heads_poincare.py
Last active April 24, 2019 19:07
Allow shifts and scales of Poincare distance which usually lies on the unit disc
import numpy as np
import itertools
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from torch.autograd import Function
from scipy.spatial.distance import pdist
def forward(self, x):
x = self.features(x)
[bs, ch, h, w] = x.shape
x = x.view(bs, ch, -1).transpose(2, 1)
# x.register_hook(self.save_grad('x'))
# Gram Matrix NxN for the N input features "x"
K = x.bmm(x.transpose(2, 1))
K = x * x; # < --- IS THIS CORRECT for 1st order features????
@AruniRC
AruniRC / Vim_netrw_howto.md
Last active February 27, 2019 23:04
HOWTO and quick links to help me learn (and remember) Vim and Netrw as part of my workflow
@AruniRC
AruniRC / netrw.txt
Created February 27, 2019 03:06 — forked from danidiaz/netrw.txt
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@AruniRC
AruniRC / distill_loss.py
Created September 13, 2018 02:43
Pytorch distillation soft targets
if self.distill:
soft_target = Variable(data[2].cuda())
distill_loss = torch.mean(torch.sum(- nn.Softmax(dim=1)(soft_target/self.T) * nn.LogSoftmax(dim=1)(out_data/self.T), 1))
loss += self.lbda*distill_loss
self.writer.add_scalar('train/distill_loss', distill_loss, i_acc+i+1)
@AruniRC
AruniRC / Make_caffe_centos.md
Last active July 13, 2018 15:09
Building caffe with multi-GPU support on CentOS
@AruniRC
AruniRC / Makefile.config
Created March 18, 2018 21:07
Faster RCNN Caffe makefile for Gypsum
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
@AruniRC
AruniRC / gist:2f0af7cd75e17e10876df4e2e96f031d
Last active March 13, 2018 02:57
detectron docker image from Hang

Getting docker running on CentOS server

   sudo systemctl start docker
   sudo systemctl status docker
   sudo systemctl enable docker
   sudo usermod -aG docker $(whoami)
@AruniRC
AruniRC / README_HARDNEG_MSCOCO.md
Last active March 10, 2018 19:56
Ms-coco hard negs on gypsum

Multi-Class Detection with RetinaNet

Location

On gypsum:

/mnt/nfs/scratch1/arunirc/data/MS-COCO_cls-1_hard-neg