aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2018-10-29 15:58:14 +0000
committerVasil Zlatanov <v@skozl.com>2018-10-29 15:58:14 +0000
commit1b8df12ee7cfac206d74d28abd0ac4bf0957c7a1 (patch)
tree6d4bcac110a06cfe5c30d691b9df5f851000da07
parent5a4cab5acdff0b8f8379a120b01a3912448ad048 (diff)
downloadvz215_np1915-1b8df12ee7cfac206d74d28abd0ac4bf0957c7a1.tar.gz
vz215_np1915-1b8df12ee7cfac206d74d28abd0ac4bf0957c7a1.tar.bz2
vz215_np1915-1b8df12ee7cfac206d74d28abd0ac4bf0957c7a1.zip
Simplify condition
-rwxr-xr-xtrain.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/train.py b/train.py
index 3b2b364..0b0ce0e 100755
--- a/train.py
+++ b/train.py
@@ -64,6 +64,7 @@ parser.add_argument("-2", "--grapheigen", help="Swow 2D graph of targets versus
parser.add_argument("-p", "--pca", help="Use PCA", action='store_true')
parser.add_argument("-l", "--lda", help="Use LDA", action='store_true')
parser.add_argument("-r", "--reconstruct", help="Use PCA reconstruction, specify face NR", type=int, default=0)
+
parser.add_argument("-q", "--pca_r", help="Use Reduced PCA", action='store_true')
args = parser.parse_args()
@@ -85,7 +86,7 @@ sc = StandardScaler()
explained_variances = ()
-if args.pca or (args.pca and args.lda) or args.pca_r:
+if args.pca or args.pca_r:
# faces_pca containcts the principial components or the M most variant eigenvectors
average_face = np.mean(faces_train, axis=0)
faces_train = normalise_faces(average_face, faces_train)
@@ -94,6 +95,7 @@ if args.pca or (args.pca and args.lda) or args.pca_r:
e_vals, e_vecs = LA.eigh(np.cov(faces_train))
e_vecs_original = e_vecs
e_vecs = np.dot(faces_train.T, e_vecs)
+ # e_vecs = normalise_faces(np.mean(e_vecs,axis=0), e_vecs)
e_vecs = sc.fit_transform(e_vecs)
###TODO Maybe replace with our normalising function