Hello
I am using face_recognition for my task.
The general description of my system is a time attendance system that uses facial recognition.
For each person, there will be a range of 100-200 photos with their face, the image size is not fixed. I tested on about 20 people with more than 2000 images.
I used the Colad GPU to encoding that set of images, but the problem happened was that when I was encoding around 190 images, the Colad's memory was full.
Is there any way to optimize this encoding?
Thank you
What I Did
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--dataset", required=True, help="path to input directory of faces and images")
ap.add_argument("-e", "--encodings", required=True, help="path to serialize db of facial encodings")
ap.add_argument("-d", "--detection-method", type=str, default="cnn", help="face detection model to use 'hog' or 'cnn")
args = vars(ap.parse_args())
print("[INFO] quantifying faces...")
imagePaths = list(paths.list_images(args['dataset']))
knownEncodings = []
knownNames = []
for i, imagePath in enumerate(imagePaths):
print("[INFO] processing image {}/{}".format(i + 1, len(imagePaths)))
name = imagePath.split(os.path.sep)[-2]
image = cv2.imread(imagePath)
rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
boxes = face_recognition.face_locations(rgb, model=args["detection_method"])
encodings = face_recognition.face_encodings(rgb, boxes)
for encoding in encodings:
knownEncodings.append(encoding)
knownNames.append(name)
print("[INFO] serializing encodings...")
data = {"encoding": knownEncodings, "names": knownNames}
with open(args["encodings"], "wb") as f:
f.write(pickle.dumps(data))
Description
Hello I am using face_recognition for my task. The general description of my system is a time attendance system that uses facial recognition. For each person, there will be a range of 100-200 photos with their face, the image size is not fixed. I tested on about 20 people with more than 2000 images. I used the Colad GPU to encoding that set of images, but the problem happened was that when I was encoding around 190 images, the Colad's memory was full. Is there any way to optimize this encoding? Thank you
What I Did