从NPZ文件加载预计算的特征向量
(self, features_file)
| 16 | self.load_features(features_file) |
| 17 | |
| 18 | def load_features(self, features_file): |
| 19 | """从NPZ文件加载预计算的特征向量""" |
| 20 | print(f"Loading pre-computed features from {features_file}") |
| 21 | data = np.load(features_file) |
| 22 | self.known_face_encodings = data['encodings'] |
| 23 | self.image_paths = data['image_paths'] |
| 24 | print(f"Loaded {len(self.known_face_encodings)} face features") |
| 25 | |
| 26 | def extract_face_encodings(self, image): |
| 27 | rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) |