Skip to content

Commit

Permalink
Update encode.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Anurag14 authored May 9, 2019
1 parent 2dea966 commit d2f6024
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ def process_and_encode(dataset):
continue
(x,y,w,h,prob)=boxes[0]
#TODO align faces
part_image=preprocess_image(image[int(x - w/2):int(x + w/2),int(y - h/2):int(y + h/2)])
x1 = int(x - w/2)
y1 = int(y - h/2)
x2 = int(x + w/2)
y2 = int(y + h/2)
part_image = image[y1:y2,x1:x2]
landmarks=face_alignment_predictor.get_landmarks(part_image)
if(landmarks!=[] and landmarks!=None):
part_image=execute_alignment(part_image,landmarks)
part_image=preprocess_image(part_image)
encoding = vgg_face_descriptor.predict(part_image)[0,:]
# the person's name is the name of the folder where the image comes from
name = image_path.split(os.path.sep)[-2]
Expand Down

0 comments on commit d2f6024

Please sign in to comment.