Last active
November 6, 2020 20:07
-
-
Save david-littlefield/f1536abb4117aa3f857064dcbbd10208 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Line 61 | |
def detect_face(image, shrink): | |
x = image | |
if shrink != 1: | |
x = cv2.resize(image, None, None, fx=shrink, fy=shrink, interpolation=cv2.INTER_LINEAR) | |
#print('shrink:{}'.format(shrink)) | |
width = x.shape[1] | |
height = x.shape[0] | |
x = x.astype(np.float32) | |
x -= np.array([104, 117, 123],dtype=np.float32) | |
x = torch.from_numpy(x).permute(2, 0, 1) | |
x = x.unsqueeze(0) | |
with torch.no_grad(): # <---------- | |
x = Variable(x.cuda()) # <---------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment