获取人脸数据集
This commit is contained in:
+3
-3
@@ -64,8 +64,8 @@ def ensure_dir_exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
# 加载训练数据
|
||||
trains_paths, trains_labels = load_data("cache/pretrains/train")
|
||||
test_paths, test_labels = load_data("cache/pretrains/test")
|
||||
trains_paths, trains_labels = load_data("DataImages-Train")
|
||||
test_paths, test_labels = load_data("DataImages-Test")
|
||||
|
||||
# 提取特征和标签
|
||||
X_train = np.array([extract_features(train_path) for train_path in tqdm.tqdm(trains_paths, desc="训练集特征提取中:")])
|
||||
@@ -87,7 +87,7 @@ for test_sample in tqdm.tqdm(X_test, desc="测试集中预测进度"):
|
||||
Y_pred.append(classifier.predict(test_sample.reshape(1, -1)))
|
||||
accuracy = accuracy_score(Y_test, Y_pred)
|
||||
|
||||
print(f"性能: {accuracy * 100:.2f}%")
|
||||
print(f"准确率: {accuracy * 100:.2f}%")
|
||||
|
||||
# 保存模型
|
||||
ensure_dir_exists("models")
|
||||
|
||||
Reference in New Issue
Block a user