# Single image feature reduction at inference time : SVM

I am trying to train a SVM classifier using scikit-learn.. At training time I want to reduce the feature vector dimension. I have used PCA to reduce the dimension.

pp = PCA(n_components=400).fit(features)
features = pp.transform(features)


PCA requires m x n dataset to determine the variance. but at the time of inference I have only single image and corresponding 1d feature vector.. I am wondering how to reduce feature vector at inference time in order to match the training dimension.

Or if anyone can suggest some other dimension reduction technique that can be used with single image wiil be highly appreciable.

• svm_classifier.predict(pp.transform(new_feature_vector) should do the trick Jul 30 '20 at 20:19