diff options
-rwxr-xr-x | train.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -112,9 +112,10 @@ def test_model(M, faces_train, faces_test, target_train, target_test, args): faces_test = np.dot(faces_test, e_vecs.T) distances = np.zeros(faces_test.shape[0]) - for i in range(faces_test.shape[0]): - norm = LA.norm(faces_train - np.tile(faces_test[i], (faces_train.shape[0], 1)), axis=1) - distances[i] = np.amin(norm) + + + rec_vecs = np.add(np.tile(average_face, (faces_test.shape[0], 1)), np.dot(faces_test, e_vecs) * deviations_tr) + distances = LA.norm(raw_faces_test - rec_vecs, axis=1); if args.reconstruct: rec_vec = np.add(average_face, np.dot(faces_train[args.reconstruct], e_vecs) * deviations_tr) |