Skip to content

Commit

Permalink
Merge pull request amdegroot#90 from jackiechen0708/master
Browse files Browse the repository at this point in the history
add support for python2
  • Loading branch information
ellisbrown authored Jan 25, 2018
2 parents c8ec468 + c8d33e0 commit ae5a75e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions layers/box_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import torch

def point_form(boxes):
Expand Down
1 change: 1 addition & 0 deletions layers/functions/prior_box.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import division
import torch
from math import sqrt as sqrt
from itertools import product as product
Expand Down
3 changes: 2 additions & 1 deletion layers/modules/l2norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def reset_parameters(self):

def forward(self, x):
norm = x.pow(2).sum(dim=1, keepdim=True).sqrt()+self.eps
x /= norm
#x /= norm
x = torch.div(x,norm)
out = self.weight.unsqueeze(0).unsqueeze(2).unsqueeze(3).expand_as(x) * x
return out
1 change: 1 addition & 0 deletions layers/modules/multibox_loss.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
Expand Down
8 changes: 4 additions & 4 deletions ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def build_ssd(phase, size=300, num_classes=21):
if size != 300:
print("Error: Sorry only SSD300 is supported currently!")
return

return SSD(phase, *multibox(vgg(base[str(size)], 3),
add_extras(extras[str(size)], 1024),
mbox[str(size)], num_classes), num_classes)
base_,extras_,head_=multibox(vgg(base[str(size)], 3),
add_extras(extras[str(size)], 1024),
mbox[str(size)], num_classes)
return SSD(phase,base_,extras_,head_, num_classes)

0 comments on commit ae5a75e

Please sign in to comment.