Hi,
I am using python 3.6.I have created a face recognition model using Anaconda python and want to create a API service using Flask or any API service.Could you please help me on this.Basically this code will take the input from the user and identify the face and will provide the output as image matched or not with the trained images.
I just want to create a python API for this.I have googled and read in many forums but didn't get help to create a python API for face recognition.Thanks in advance for you help.
This is the code for the same:
I am using python 3.6.I have created a face recognition model using Anaconda python and want to create a API service using Flask or any API service.Could you please help me on this.Basically this code will take the input from the user and identify the face and will provide the output as image matched or not with the trained images.
I just want to create a python API for this.I have googled and read in many forums but didn't get help to create a python API for face recognition.Thanks in advance for you help.
This is the code for the same:
import tensorflow #import keras import cv2 import face_recognition import os #from sklearn2pmml.pipeline import PMMLPipeline images = os.listdir('C:/Users/vaddm/Documents/Murali/AI_COE/face_recognition/images') # load your image image_to_be_matched = face_recognition.load_image_file('C:/Users/vaddm/Documents/Murali/AI_COE/face_recognition/user_aadhar.jpg') # encoded the loaded image into a feature vector image_to_be_matched_encoded = face_recognition.face_encodings( image_to_be_matched)[0] # iterate over each image for image in images: # load the image current_image = face_recognition.load_image_file("C:/Users/vaddm/Documents/Murali/AI_COE/face_recognition/images/" + image) # encode the loaded image into a feature vector current_image_encoded = face_recognition.face_encodings(current_image)[0] # match your image with the image and check if it matches result = face_recognition.compare_faces( [image_to_be_matched_encoded], current_image_encoded) # check if it was a match if result[0] == True: print ("Matched: " + image) else: print ("Not matched: " + image)