# 例2
import requests
def request_big_data(url):
name = url.split('/')[-1]
# 获取文件名
r = requests.get(url, stream=True)
# stream=True 设置为流读取
with open("new/"+str(name), "wb") as pdf:
for chunk in r.iter_content(chunk_size=1024):
# 每1024个字节为一块进行读取
if chunk:
# 如果chunk不为空
pdf.write(chunk)
request_big_data(url="https://www.python.org/ftp/python/3.7.4/python-3.7.4-amd64.exe")
face_recognition is a powerful, simple and easy-to-use face recognition open source project with complete development documents and application cases, especially it is compatible with Raspberry Pi.
In order to facilitate Chinese software developers to learn, make progress in face recognition development and source code contributions, I translated README file into simplified Chinese.
Salute to all contributors to this project.
Translator: Tommy in Tongji Univerisity Opensource Association 子豪兄Tommy
import face_recognition
image = face_recognition.load_image_file("my_picture.jpg")
face_locations = face_recognition.face_locations(image)
# face_locations is now an array listing the co-ordinates of each face!
import face_recognition
image = face_recognition.load_image_file("my_picture.jpg")
face_locations = face_recognition.face_locations(image, model="cnn")
# face_locations is now an array listing the co-ordinates of each face!
import face_recognition
image = face_recognition.load_image_file("my_picture.jpg")
face_landmarks_list = face_recognition.face_landmarks(image)
# face_landmarks_list is now an array with the locations of each facial feature in each face.# face_landmarks_list[0]['left_eye'] would be the location and outline of the first person's left eye.
import face_recognition
picture_of_me = face_recognition.load_image_file("me.jpg")
my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
# my_face_encoding now contains a universal 'encoding' of my facial features that can be compared to any other picture of a face!
unknown_picture = face_recognition.load_image_file("unknown.jpg")
unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
# Now we can see the two face encodings are of the same person with `compare_faces`!
results = face_recognition.compare_faces([my_face_encoding], unknown_face_encoding)
if results[0] ==True:
print("It's a picture of me!")
else:
print("It's not a picture of me!")