Skip to content

Instantly share code, notes, and snippets.

@david-littlefield
Last active November 6, 2020 20:08
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/2afac3e130da4a9d87923051a66c4030 to your computer and use it in GitHub Desktop.
Save david-littlefield/2afac3e130da4a9d87923051a66c4030 to your computer and use it in GitHub Desktop.
# Line 68
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment