Skip to content

Instantly share code, notes, and snippets.

@david-littlefield
Last active November 6, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-littlefield/966ef9c862b5ffe1f8f254c9978fe23c to your computer and use it in GitHub Desktop.
Save david-littlefield/966ef9c862b5ffe1f8f254c9978fe23c to your computer and use it in GitHub Desktop.
# Line 75
def infer(net , img , transform , thresh , cuda , shrink):
if shrink != 1:
img = cv2.resize(img, None, None, fx=shrink, fy=shrink, interpolation=cv2.INTER_LINEAR)
x = torch.from_numpy(transform(img)[0]).permute(2, 0, 1)
with torch.no_grad():
x = Variable(x.unsqueeze(0))
#if cuda: # <----------
# x = x.cuda() # <----------
# Line 180
def test_oneimage():
torch.set_grad_enabled(False)
# load net
cfg = widerface_640
num_classes = len(WIDERFace_CLASSES) + 1 # +1 background
net = build_ssd('test', cfg['min_dim'], num_classes) # initialize SSD
net.load_state_dict(torch.load(args.trained_model))
#net.cuda() # <----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment