Skip to content

Commit

Permalink
Merge pull request #22 from kilianovski/main
Browse files Browse the repository at this point in the history
Remove global 'torch.set_grad_enabled(False)' from FaceBoxes
  • Loading branch information
choyingw committed Aug 21, 2022
2 parents b79d600 + 3d04863 commit d34e4af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FaceBoxes/FaceBoxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ def viz_bbox(img, dets, wfp='out.jpg'):

class FaceBoxes:
def __init__(self, timer_flag=False):
torch.set_grad_enabled(False)

net = FaceBoxesNet(phase='test', size=None, num_classes=2) # initialize detector
self.net = load_model(net, pretrained_path=pretrained_path, load_to_cpu=True)
self.net.eval()

for p in self.net.parameters():
p.requires_grad_(False)

# print('Finished loading model!')

self.timer_flag = timer_flag
Expand Down

0 comments on commit d34e4af

Please sign in to comment.