Principal Component Analysis (PCA) on Convolutional Neural Network (CNN) Features Please, I have a question regarding PCA and features which are extracted from a convolutional layer. link

if we have a test dataset , and we extract all conv features of all images at test dataset called feat. Then we do the following normalization and PCA to all conv features

feats = normalize(feats)
pca = PCA(512 ,whiten=True)
pca.fit(feats)


And then use pca model for test dataset 

# PCA MODEL - use paris for oxford data and vice versa
self.pca = pickle.load(open('_oxford.pkl', 'rb'))


And then applying PCA on the test dataset using the previous pca

print "Applying PCA"
self.db_feats = normalize(self.db_feats)
if self.pooling is 'sum':
self.db_feats = self.pca.transform(self.db_feats)
self.db_feats = normalize(self.db_feats)


What is the idea of using pca model of another dataset to transform the features of test dataset?
I'm not into details of this specific case but I can see some logic.

A convolution layer can be reformulated as a Matrix Multiplication:

$$ y = W x $$

Let's say we trained on Data Set $ {x}^{1} $ which is big and general.
Namely we expect the trained weights $ {W}^{1} $ to be good enough for almost any other data set.  

Let's assume we have another data set $ {x}_{2} $ with its matching weights $ {W}^{2} $.
By our assumption about how good $ {x}^{1} $ generalizes it means $ {W}^{1} \sim {W}^{2} $ with regard to some metric.  

If this metric is the Frobenious Norm / Matrix Induced $ {L}_{2} $ Norm then using PCA (Which is basically SVD) makes sense as using the PCA we take the component of $ {W}^{1} $ which generalizes the most and use it for other case.