This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExclusiveLinear(nn.Module): | |
def __init__(self, feat_dim=512, num_class=10572, norm_data=True, radius=20): | |
super(ExclusiveLinear, self).__init__() | |
self.num_class = num_class | |
self.feat_dim = feat_dim | |
self.norm_data = norm_data | |
self.radius = float(radius) | |
self.weight = nn.Parameter(torch.randn(self.num_class, self.feat_dim)) | |
self.reset_parameters() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# multi-class cross-entropy loss with center-exclusive | |
from __future__ import print_function | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
from torch.optim import lr_scheduler | |
torch.backends.cudnn.bencmark = True | |
import os, sys, random, datetime, time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "ResNet-50" | |
input: "data" | |
input_dim: 1 | |
input_dim: 3 | |
input_dim: 224 | |
input_dim: 224 | |
layer { | |
bottom: "data" | |
top: "conv1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### dual top-down path network for instance-level salient object detection | |
name: "LERG" | |
layer { | |
name: "data" | |
type: "Python" | |
top: "data" | |
top: "label" | |
python_param { | |
module: "pylayer" | |
layer: "ImageLabelMapDataLayer" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install common deps | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y build-essential cmake make | |
sudo apt-get install --no-install-recommends libboost-all-dev | |
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler | |
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev | |
sudo apt-get install libatlas-base-dev | |
sudo apt-get install python-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
sys.path.insert(0, 'path/to/caffe/python') | |
import caffe | |
from caffe import layers as L, params as P | |
from caffe.coord_map import crop | |
import numpy as np | |
def conv_relu(bottom, nout, ks=3, stride=1, pad=1, mult=[1,1,2,0]): | |
conv = L.Convolution(bottom, kernel_size=ks, stride=stride, | |
num_output=nout, pad=pad, weight_filler=dict(type='xavier'), |