Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ducha-aiki authored Feb 9, 2018
1 parent 42865a9 commit b5c06ef
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions pretrained/3rd_party/HardNetPS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ This version of HardNet is trained on [PS dataset](https://github.com/rmitra/PS-

The structure of the network has minor changes, use this definition:

class HardNetPS(nn.Module):
def __init__(self):
super(HardNetPS, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(1, 32, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(32, affine=True),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(32, affine=True),
nn.ReLU(),
nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1, bias = True),
nn.BatchNorm2d(64, affine=True),
nn.ReLU(),
nn.Conv2d(64, 64, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(64, affine=True),
nn.ReLU(),
nn.Conv2d(64, 128, kernel_size=3, stride=2,padding=1, bias = True),
nn.BatchNorm2d(128, affine=True),
nn.ReLU(),
nn.Conv2d(128, 128, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(128, affine=True),
nn.ReLU(),
nn.Conv2d(128, 128, kernel_size=8, bias = True)
)
return
def input_norm(self,x):
flat = x.view(x.size(0), -1)
mp = torch.mean(flat, dim=1)
sp = torch.std(flat, dim=1) + 1e-7
return (x - mp.unsqueeze(-1).unsqueeze(-1).unsqueeze(-1).expand_as(x)) / sp.unsqueeze(-1).unsqueeze(-1).unsqueeze(1).expand_as(x)
class HardNetPS(nn.Module):
def __init__(self):
super(HardNetPS, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(1, 32, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(32, affine=True),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(32, affine=True),
nn.ReLU(),
nn.Conv2d(32, 64, kernel_size=3, stride=2, padding=1, bias = True),
nn.BatchNorm2d(64, affine=True),
nn.ReLU(),
nn.Conv2d(64, 64, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(64, affine=True),
nn.ReLU(),
nn.Conv2d(64, 128, kernel_size=3, stride=2,padding=1, bias = True),
nn.BatchNorm2d(128, affine=True),
nn.ReLU(),
nn.Conv2d(128, 128, kernel_size=3, padding=1, bias = True),
nn.BatchNorm2d(128, affine=True),
nn.ReLU(),
nn.Conv2d(128, 128, kernel_size=8, bias = True)
)
return
def input_norm(self,x):
flat = x.view(x.size(0), -1)
mp = torch.mean(flat, dim=1)
sp = torch.std(flat, dim=1) + 1e-7
return (x - mp.unsqueeze(-1).unsqueeze(-1).unsqueeze(-1).expand_as(x)) / sp.unsqueeze(-1).unsqueeze(-1).unsqueeze(1).expand_as(x)

def forward(self, input):
x_features = self.features(self.input_norm(input))
Expand All @@ -42,17 +42,17 @@ class HardNetPS(nn.Module):
If you use this weights, please cite:


@ARTICLE{2018arXiv180101466M,
author = {{Mitra}, R. and {Doiphode}, N. and {Gautam}, U. and {Narayan}, S. and
{Ahmed}, S. and {Chandran}, S. and {Jain}, A.},
title = "{A Large Dataset for Improving Patch Matching}",
journal = {ArXiv e-prints},
archivePrefix = "arXiv",
eprint = {1801.01466},
primaryClass = "cs.CV",
keywords = {Computer Science - Computer Vision and Pattern Recognition},
year = 2018,
month = jan,
adsurl = {http://adsabs.harvard.edu/abs/2018arXiv180101466M},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@ARTICLE{2018arXiv180101466M,
author = {{Mitra}, R. and {Doiphode}, N. and {Gautam}, U. and {Narayan}, S. and
{Ahmed}, S. and {Chandran}, S. and {Jain}, A.},
title = "{A Large Dataset for Improving Patch Matching}",
journal = {ArXiv e-prints},
archivePrefix = "arXiv",
eprint = {1801.01466},
primaryClass = "cs.CV",
keywords = {Computer Science - Computer Vision and Pattern Recognition},
year = 2018,
month = jan,
adsurl = {http://adsabs.harvard.edu/abs/2018arXiv180101466M},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

0 comments on commit b5c06ef

Please sign in to comment.