-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathface.py
executable file
·22 lines (20 loc) · 927 Bytes
/
face.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python
import os, sys
# model dir
#model_path = "/home/haichen/models/caffe/"
model_path = "/media/sdcard/"
data_path = "/home/haichen/datasets/MSRBingFaces/"
from example import *
#lbl = face_recognition(os.path.join(data_path, "iu/112.jpg"), [152,152], [152,152], os.path.join(model_path, "D0.prototxt"), os.path.join(model_path, "D0.caffemodel"))
#lbl = face_recognition(sys.argv[1], [152,152], [152,152], os.path.join(model_path, "D0.prototxt"), os.path.join(model_path, "D0.caffemodel"))
net = face_net([152,152], [152,152], os.path.join(model_path, "D0.prototxt"), os.path.join(model_path, "D0.caffemodel"))
caffe.set_mode_gpu()
target = "iu_cropped.jpg"
if len(sys.argv) > 1:
target = sys.argv[1]
#print(lbl)
input_image = skimage.io.imread(target)
prepared = face_input_prepare(net, [input_image])
for i in range(10):
out = net.forward_all(**{net.inputs[0]: prepared})
print(out["prob"].argmax())