Skip to content

Instantly share code, notes, and snippets.

@wannaphong
Created October 26, 2017 12:19
Show Gist options
  • Save wannaphong/954ac2f26073043c09881da4d1614073 to your computer and use it in GitHub Desktop.
Save wannaphong/954ac2f26073043c09881da4d1614073 to your computer and use it in GitHub Desktop.
ทำ Face Recognition ง่าย ๆ ไม่กี่คำสั่งใน Python ใช้ประกอบในบทความ http://python3.wannaphong.com/2017/03/face-recognition-python.html
import face_recognition
picture_of_Steve_Jobs = face_recognition.load_image_file("Steve_Jobs_Headshot_2010-CROP.jpg") # ไฟล์ต้นแบบ
face_encoding = face_recognition.face_encodings(picture_of_Steve_Jobs)[0] # เข้ารหัสหน้าตา
unknown_picture = face_recognition.load_image_file("0x600.jpg") # ไฟล์ที่ต้องการตรวจสอบ
unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0] # เข้ารหัสหน้าตา
results = face_recognition.compare_faces([face_encoding], unknown_face_encoding) # ทำการเปรียบเทียบด้วย Face Recognition
if results[0] == True:
print("It's a picture of Steve Jobs!")
else:
print("It's not a Steve Jobs!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment