-
-
Save sazio/dcc32bc68d098af30001bf8f8ebf2bb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# return ((x,y,w,h, confidence)) | |
def extract_faces(files, source, detector=detect_face_cv2): | |
results = [] | |
# for idx, file in tqdm(enumerate(files), total=len(files)): | |
for idx, file in enumerate(files): | |
try: | |
img = cv2.cvtColor(cv2.imread(file, cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2RGB) | |
face_locations = detector(img) | |
results.append((source, file[file.find("output_"):], face_locations, len(face_locations))) | |
except: | |
print("Cannot extract faces for image: %s" % file) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment