Introduction

Machine learning algorithms aim at building a model from example inputs in order to make data-driven decisions or predictions. Applications such as face recognition, spam filtering, and recommendation engines which use large dataset uses machine learning. Google uses machine learning to identify and deindex webspam. Various machine learning software such as Weka, Java Neural Network Framework Neuroph, Scikit Learn, Open NN Multiple Back propagation exists that assists researchers in solving complex problems. These packages have conventional algorithms [19] for image analysis, machine learning and data mining that assume training and test data have the same distribution. In many real-world applications, this may not hold, for example, if one has to detect users current location using previously collected Wi-Fi data. It is expensive to calibrate Wi-Fi data in large-scale environment as the user needs to label extensive collection of Wi-Fi signal at each location. Knowledge transfer or transfer learning may be useful in saving significant efforts in labeling data [10]. Transfer of knowledge from a related task that has already been learned to a new task which shares some of the commonality is transfer learning. Basics of transfer learning are well explained in [11]. Transfer learning aims to solve the problem when the training and test data are different. Transfer learning approaches like instance transfer, feature representation transfer, parameter transfer, and relational knowledge transfer are discussed in [1216]. Transfer learning finds its motivation in the fact that human beings can intelligently apply knowledge acquired previously to solve the new problem faster or with better solutions. NISP-95 workshop on “Learning to Learn” had a special session that discussed the fundamental motivation behind transfer Learning. The workshop was focused on the need for lifelong machine learning techniques that retain and reuse previously acquired knowledge [12, 17, 18]. Thus, the machine learning software packages should provide some simple and automatic/semiautomatic setting for users dealing with transfer learning tasks.

Multilayer feedforward neural networks are been effectively used in machine learning. They can be used to approximate complex nonlinear functions from high-dimensional input data. The performance of multilayer perceptron (MLP) depends on the underlying feature extraction method used [19]. The choice of feature extraction algorithm and features used for classification is often empirical, and therefore, it is suboptimal. One can directly use the training algorithm to find the best feature extractors by adjusting the weights. However, when the input dimension is high (image processing application), the number of connections, the number of free parameters increases because each hidden unit is fully connected to the input layer. This may lead to a network that overfits the data as the neural network would have a too high complexity. The input patterns are to be well aligned and normalized while presenting to such type of MLP leading to no built in variance with respect to local distortions and translations [20]. Various neural network classifiers are explained in [18, 2126]. A convolutional neural network(CNN) tries to solve the problems of MLP by extracting local features and combining them subsequently to perform the detection or recognition. CNN and neocognitron are the neural network architectures which are meant for visual pattern recognition. These architectures have integrated feature extraction and classification layers. However, in the literature, no work has been reported which focuses on neural networks (meant for visual pattern recognition) equipped with transfer learning without making changes in the architecture.

The contributions of this paper include the following:

  1. 1.

    Novel training algorithm for CNN architecture under transfer learning task. Three-phase training algorithm is proposed for the same. Phase I is a conventional phase in which CNN is trained with the conventional methods in [2729]. Phase II is a knowledge transfer in which knowledge acquired from new training samples is transferred into the architecture with minimum changes in the free parameters (weights) of the neural network architecture. Phase III is a weight update for transfer learning phase. Phase II and III are the new steps added to the existing, i.e., conventional algorithm of CNN. These phases avoid complete retraining of CNN when new training data are available subsequently once the CNN is trained with old data. The proposed algorithm may enhance the utility of any machine learning software by reducing the training time for transfer learning.

  2. 2.

    A training method which can be used for any neural network architecture meant for visual pattern recognition under transfer learning.

  3. 3.

    The novel dataset that is unique and meant to advance the research on face recognition under transfer learning.

  4. 4.

    Minimum change principle is been proposed which can be used to train a neural network under transfer learning.

The remainder of this paper is organized as follows. Section “Related work” throws light on the work done in the area of transfer learning and deep learning. The aim of the proposed work is to equip CNN (deep learning network) with transfer learning framework. This section explains various ongoing applications in field of transfer learning and deep learning. Section “The framework of transfer learning” explains the transfer learning framework used in this research. Framework of transfer learning is applied to principal component analysis (PCA) to derive the projection matrix. Section “Convolutional neural networks” explains the architecture of CNN followed by the proposed training algorithm for the CNN architecture. Section “Comparison of traditional algorithm (conventional) with proposed algorithm” explains the comparison of traditional algorithm with the proposed algorithm. Section “Dataset” describes the dataset that is used in this research. Section “Experiments, parameter settings, and observations” throws light on the experiments performed on the CNN architecture. This section also explains various parameter setting in the algorithm followed by the observations. Section “Conclusion” brings ahead the conclusion of this research work.

Related work

In the last few years, visual recognition community has shown a growing interest in transfer learning algorithms [30, 31]. Transfer subspace learning (TSL) is effectively used in understanding kin relationships in the photo [32]. Classification under covariate shift is been solved by transfer learning [33]. Features with meta-features that can be used in prediction task is studied in [34]. Building classifiers for text classification by extracting positive examples from unlabeled examples for improving performance of the system are highlighted in [10]. Transfer subspace learning that can reduce time and space cost is proposed in [35]. Enhanced subspace clustering algorithms [36, 37] are used to handle complex data and to improve clustering results. Cross-domain discriminative locally linear embedding (CDLLE) can be used to reduce the human labeling efforts for social image annotation problem [38]. Robust framework against noise in the transfer learning setting is proposed in [39]. Semisupervised clustering algorithm with domain adaptation and the constraint knowledge with transferred centroid regularization is proposed in [40]. Xiaoxin Yin et al. have proposed [41] efficient classification across multiple database relations. Performance improvement is seen when transfer learning is used in medical image segmentation followed by classification [42]. Low-resolution face images are matched with the high-resolution gallery images using transfer learning which improved cross-resolution face matching [43]. Transfer learning using Bayesian model was used in [44] for face verification application. Ensemble-based transfer learning was used in text classification [45]. Knowledge was transferred between text and images using matrix factorization approach by Zhu et al. [46]. Geng et al. used domain adaptation metric learning for face recognition and web image annotation [47]. Server-based spam filter learned from public sources was designed and applied to individual users with the help of transfer learning [48].

In recent years due to its state-of-the art performance in many research domains, deep learning has attracted attention of academic community. Companies like Google, Facebook and Apple who collect and analyze massive amounts of data are putting forward lot of deep learning-related projects that happens to be the prime motivation behind this research. Deep learning challenges and perspectives are well explained in [49]. Weilong Hou et al. have done blind quality assessment via deep learning [50]. Shuhui Bu et al. for the first time applied deep learning for 3D shape retrieval [51]. Traffic flow prediction and deep learning approach is been proposed in [52]. Object tracking in blurred videos using blurred videos and deep image representations is proposed by Jianwei Ding et al. [53]. Adaptively learn representation that is more effective for the task of vehicle color recognition using spatial pyramid deep learning is given by Chuanping Hu et al. [54]. Deep learning is also been used to grade nuclear cataracts [55]. Deep learning is been widely used in medical image processing for segmentation, classification and registration [5661], image denoising [62] and multimodal learning [63]. Deep learning is proved to give robust image representation for single training sample per person in face recognition task [64]. Corey Kereliuk et al. did music content analysis with deep learning [65]. Land use classification [66], scene classification [67] and visual tracking [68] applications work well with deep learning architectures. Impact of deep learning on developmental robotics is explained in [69]. Multi-label image annotation is been achieved using semisupervised deep learning [70]. Financial signal representation is done in [71] using deep neural networks. Pipeline for object detection and segmentation in the context of volumetric image parsing is proposed using marginal space deep learning [72]. Deep learning is also been used in indoor localization that reduces the location error compared with the three existing methods [73]. Convolutional neural networks (CNN), a very popular deep learning network is used in almost all the applications since it is believed to be one of the most appropriate networks for modeling images [74]. CNN are used for image classification [75], pose estimation [76], face recognition [77] and modeling texts [7884].

The proposed work contrasts clearly from a concurrent work on deep learning and transfer learning in following ways:

  1. 1.

    Support vector machine (SVM) is extensively used in transfer learning methods. Most of the transfer learning algorithms are developed only for specific model that makes it difficult to use it for other models and restrict the applicability. To the best of author’s knowledge and the data available from literature, the first attempt made to equip deep neural network with transfer learning framework was by Mingsheng Long et al. [85]. In their framework they have modified the architecture of CNN. However, the research work proposed in this paper is for the conventional CNN architecture. A novel training algorithm under transfer learning is proposed without changing the architecture of CNN. There was also an attempt to equip shallow neural network with transfer learning [52]. The authors of this paper also acknowledge the work of Fan Zhang et al., in their work they have suggested a neural network ensemble training to improve prediction accuracy at the expense of increased trainable parameters [67]. In short the proposed algorithm is generic and can be used for any deep learning architecture.

  2. 2.

    The transfer learning task is demonstrated with applications like medical image segmentation, text classification [86], web image annotation, face recognition, etc. Various standard datasets like Yale Face database, the Facial Recognition Technology (FERET) and Labeled Faces in the Wind (LFW) exists for doing the experimentation on recognition of faces. The face images in these datasets are acquired with various poses, illumination [87] and expressions, etc. No dataset of face exists which has face images acquired at different distances. The authors of this paper have made their own dataset which may be used by researchers working on a problem of face recognition at a distance. The details of the dataset is explained in Sect. “Dataset”.

The framework of transfer learning

Given m training samples with x as a input and t as a target for classification task, \({T}=\left\{ {\left( {{X}_{1},{ t}_{1}}\right) ,\left( {{X}_{2},{t}_{2}}\right) ,\left( {{X}_{ m},{ t}_{m}}\right) }\right\} , n\) testing samples, \({ U}=\left\{ {\left( {{X}_{{m}+1}}\right) ,\left( {{X}_{{ m}+2}}\right) ,\ldots \left( {{X}_{{m}+{n}},}\right) }\right\} \). The samples are drawn from a high-dimensional space \(R^\mathrm{D}\). The subspace learning algorithm finds a low-dimensional space \(R^\mathrm{d}\). A linear function \(y = W^\mathrm{T}X\), where W \(\epsilon \) \(R^{D \times d}\) and y \(\epsilon \) R\(^\mathrm{d}\) will find a low-dimensional space R\(^{d}\). The objective function can be

$$\begin{aligned} W = \mathrm{arg}\,\,\mathrm{min}\,\,E(W) \end{aligned}$$
(1)

subject to constraints \(W^\mathrm{T}W = I\). The objective function E(W) reduces the classification error. Equation (1) performs well if training and testing samples are independent and identically distributed. However, in practice, this might not be true. The distribution of training samples \(P_{T}\) and that of testing samples \(P_{U}\) may be different. Under such conditions, the learning framework given by equation fails. To solve this problem, the Bregman divergence-based regularization \({D}_{W} ({P}_{T} ||{P}_{U} )\) which measures the distribution difference of samples in a projected subspace W is used [17]. Equation (1) is modified for transfer learning. The new framework for transfer learning is given as (2)

$$\begin{aligned} W = \mathrm{arg}\,\,\mathrm{min} E(W) + \rho D_W (P_T ||P_U ) \end{aligned}$$
(2)

With constraints, e.g., \(W^{T}\) \(W = I\). In (2) \(\rho \) is the regularization parameter that controls the trade-off between E(W) and \(D_\mathrm{W}(P_\mathrm{T}{\vert }{\vert }P_\mathrm{U})\). The solution of (2) can be obtained by the gradient descent algorithm and is given by

$$\begin{aligned} W(\mathrm{new}) =W(\mathrm{old}) - \alpha (\partial \,\,E(W)/\partial W)+ O, \end{aligned}$$
(3)

where \(O = \rho \) \(\frac{\partial {D}_{W} ({P}_{T} ||{P}_{U} )}{\partial W}/\partial W\) and \(\alpha \) is the learning rate.

Framework of TSL applied to principal component analysis (PCA)

Principal component analysis (PCA) projects the high-dimensional data to lower dimensional space by capturing maximum variance [88]. PCA projection matrix maximizes the trace of the total scatter matrix

$$\begin{aligned} W = arg\,\,max\,\,tr(W^{T}R W) \end{aligned}$$
(4)

Subject to WW\(^{T} =\) I. R is the autocorrelation matrix of training samples. E(W) of PCA is given by (5)

$$\begin{aligned} E(W) = -tr (W^{T}RW) \end{aligned}$$
(5)
$$\begin{aligned} \partial E(W)/ \partial W=-2RW \end{aligned}$$
(6)

By substituting (5) and (6) into (3), we can obtain the projection matrix W for transfer learning. The detailed procedure to get the solution of (3) is given in [2].

Fig. 1
figure 1

Basic convolutional architecture for face recognition

Convolutional neural networks

Figure 1 shows convolutional neural network for face recognition task. The input plane receives images. The input is \(74 \times 74\) pixel image. Layer C\(_{1}\) is a convolutional layer with six feature maps. Each unit in each feature map has a connection to the \(11 \times 11\) neighborhood in the input. The size of the feature map is \(64 \times 64\). C\(_{1}\) contains six kernels of size \(11 \times 11\) and six biases, so the total number of trainable weights is 732.

Layer \(S_{2}\) is a subsampling layer with six feature maps of size \(32 \times 32\). Each unit in feature map has a connection to a \(2 \times 2\) neighborhood in the corresponding feature map of \(C_{1 }\). Layer \(S_{2 }\) has no trainable weights.

Layer \(C_{3 }\)is a convolutional layer consisting of 16 feature maps, i.e., 16 kernels of size \(11 \times 11\) and sixteen biases which result in 1952 trainable weights.

Layer \(S_{4}\) is a subsampling layer with 16 feature maps of size \(22 \times 22\). The \(S_{4}\) layer has no trainable parameters.

Layer \(C_{5 }\) is a convolutional layer consisting of 120 feature maps, i.e., 120 kernels of size \(11 \times 11\) and 120 biases which result in 14,640 trainable weights.

Layer \(F_{6}\) contains 84 units, and the output layer consists of 25 units for solving a classification problem of 25 users or 50 units for solving a classification problem of 50 users. Trainable parameters for layer \(F_{6}\) are 10,080. Trainable parameters for output layer are 2100 for 25 users and 4200 for 50 users classification problem.

Proposed three-phase training algorithm for CNN architecture using transfer learning approach

Figure 2 shows the proposed three-phase training algorithm.

Fig. 2
figure 2

Proposed three-phase training algorithm for CNN architecture under transfer learning approach

Comparison of traditional algorithm (conventional) with proposed algorithm

Phase I of the algorithm is the training of CNN C and S Layers. Supervised learning is used to train C and S layers. A gradient descend method is used to update the weights in all the layers. Phase II of the algorithm is only used when new training samples are available. The issue is to incorporate the information available from the new samples into the trained network. This issue is solved by the Phase II step of the algorithm. In this phase output, O\(^\mathrm{z}\) of the last CNN layer is tapped and reweighted or updated using Eq. (3) to get new vector O\(^\mathrm{ztk}\) for each training sample. In Phase III step of the algorithm, layer F\(_{6 }\) is trained with O\(^\mathrm{ztk}\) as training vectors for the classification task.

Traditional/conventional algorithm which is used to train CNN has following two steps:

  1. 1.

    Conventional phase: this phase is same as conventional phase of proposed algorithm. MSE1 is the performance index used in this phase. This phase is used to train feature extraction layers of CNN (C\(_{1}\), C\(_{3 }\) and C\(_{5)}\).

  2. 2.

    Weight updating phase: output of C\(_{5}\) layer which is also called as features is used to train F\(_{6 }\) and output layer. Weight modification is done by using all the samples in the training data set. MSE2 is the performance goal used in this step.

In the proposed algorithm, we have tapped the output of C\(_{5 }\) layer and reweighted the same using Eq. 3. The output features are reweighted till the distribution difference between old training and new samples is reduced. In the phase III part of the proposed algorithm, these reweighted features are used to train F\(_{6 }\) and output layer. When the new training set is made available, the proposed algorithm does not disturb the trained CNN layers (C\(_{1}\), C\(_{3 }\) and C\(_{5)}\). However, the new information is incorporated into the network by modifying weights on F\(_{6}\) and output layer. This is proposed minimum change principle.

Table 1 Proposed database
Fig. 3
figure 3

Sample images from database (scale 1–scale 8)

Table 2 Recognition rates in % for CNN algorithm trained with conventional algorithm for 25 users

Dataset

To the best of our knowledge, there is no public dataset constructed with a large number of samples for performing experiments on face recognition under transfer subspace learning. The distance between subject and camera is varied, and the camera position is shifted while preparing the database. The distance is varied in steps of 15 cm.We refer to distance of 15 cm as scale 1 (S1), 30 cm as scale 2 (S2) and 120 cm as scale 8 (S8). Similarly, shift of 5 cm at S1 as S1sh1, shift of 10 cm at S1 as S1sh2, rotation of 5\(^{\circ }\) at S7 as S7r1 and rotation of 10\(^{\circ }\) as S7r2, etc. Camera positions were shifted by 5 and 10 cm at scale S1 and S2. The camera was rotated with 5\(^{\circ }\) and 10\(^{\circ }\) of inclination at scale S7 and S8. The images were collected in an illumination controlled environment. For maintaining a level of consistency throughout the database, the same physical setup was used in each photography session. Because the equipment had to be reassembled for each session, there was some minor variation in images collected on different dates. The proposed database was collected in 10 sessions between December 2012 and June 2013.

Table 3 Recognition rates in % for CNN algorithm trained with conventional algorithm for 50 users

The database contains 20,000 images that include 50 subjects. For every subject 25 images per scale, at four shifts and two angles were taken (total 400 images per subject). The details of the database are shown in Table 1. Figure 3 shows some sample images in database.

Experiments, parameter settings, and observations

Basic CNN architecture was trained using the conventional/traditional algorithm as per the steps discussed in Sect. “Comparison of traditional algorithm (conventional) with proposed algorithm” with the samples from developed database. Table 2 shows the results for 25-user system. Table 3 shows the results for 50-user system. 10 images per user per scale were used for training and 15 images per user per scale were used for testing. It was observed that when the training and testing samples are from the same scale, the classification rate seems to be high as compare to the testing samples from different scales.

Table 4 Recognition rates in % for CNN algorithm trained with proposed three phase algorithm for 25 users:
Table 5 Recognition rates in % for CNN algorithm trained with proposed three phase algorithm for 50 users:
Fig. 4
figure 4

Performance plot of MSE1 versus iterations (50-user system)

Fig. 5
figure 5

Performance plot of MSE2 versus iterations for traditional algorithm (50-user system)

Fig. 6
figure 6

Performance plot of MSE2 versus iterations for proposed algorithm (50-user system)

To improve the classification rate for samples belonging to cross-scale, we trained the CNN network with Proposed algorithm discussed in Sect. “Proposed three-phase training algorithm for CNN architecture using transfer learning approach”. We skipped the phase I part of the algorithm as the initial layers are already been trained by traditional algorithm. The aim here is to incorporate new information into the network that is available from new samples. Table 4 shows the results for 25-user system using proposed three-phase training algorithm. Table 5 shows the results of 50-user system using proposed three-phase algorithm. CNN was trained, using traditional algorithm for 3000 epochs with a learning rate of 0.05, 0.5 and 0.8. Best results were obtained with learning rate of 0.5. Figure 4 shows the plot of MSE1 versus iterations.Performance plot of traditional algorithm and the proposed algorithm, for training F\(_{6}\) and output layer with MSE2 as performance index is been shown in Figs. 5 and 6, respectively. Weight modification phase under transfer learning with proposed algorithm converges faster compare to traditional algorithms weight modification phase.

Table 6 Trainable weights in CNN
Fig. 7
figure 7

Comparison of classification rates of conventional CNN algorithm with proposed algorithm when the network was trained with scale S1 samples (25 users)

Fig. 8
figure 8

Comparison of classification rates of conventional CNN algorithm with proposed algorithm when the network was trained with scale S1 samples (50 users)

Fig. 9
figure 9

Variation of classification accuracy as a function of rho (\(\rho )\) and alpha (\(\alpha )\) (25-user system)

Fig. 10
figure 10

Variation of classification accuracy as a function of rho (\(\rho )\) and alpha (\(\alpha )\) (50-user system)

As shown in Table 6, basic CNN trained for 25 users has 29,504 trainable parameters. If the network has to incorporate knowledge from new training samples taken at different scales made available subsequently, it has to be retrained again with 29,504 trainable weights. However, the proposed algorithm avoids complete retraining by using minimum change principle, i.e., by updating weights in F\(_{6}\) and output layer with which a relatively acceptable classification rate can be achieved with 12,180 trainable parameters. Same is true for a 50-user system with only 14,280 trainable weights in transfer learning task. 17,324 weights are not disturbed in the proposed three-phase training algorithm for CNN. For a 25-user system, the proposed algorithm gives an average classification rate of 80 percent for all scales in transfer subspace task and an average rate of 60 percent for a 50-user system. Figures 7 and 8 show the comparison of classification rates of conventional CNN algorithm with proposed algorithm when the training samples are from the scale 1. As seen from Tables 4 and 5, the same scale (training and testing with same scales) classification rates tend to drop with the proposed algorithm. This implies that there is a negative transfer that hinders the percentage classification rate at same scales. The negative transfer happens if the sources of data are too dissimilar [89].

We experimented CNN with \(52 \times 52, 60 \times 60, 74 \times 74\) and \(84 \times 84\) input size. The CNN was trained using proposed algorithm with learning rate values of 0.05, 0.5 and 0.8. The best results were obtained with an input size of \(74 \times 74\) and learning rate of 0.5. In Eq. 3 there are two parameters \(\alpha \) and \(\rho \). setting higher value of \(\alpha \) allows more information to be transferred. However, very high value of \(\alpha \) makes most of the elements of O\(^\mathrm{ztk}\) zero which is not suitable for transfer of information. Larger the value of \(\rho \), the distribution between source and target domains will be small. However, very small value of \(\rho \) will result in less transfer of information. We heuristically determined the value of \(\alpha \) and \(\rho \), by varying \(\alpha \) and keeping \(\rho \) constant and vice versa. Variation of classification accuracies with different values of \(\alpha \) and \(\rho \) are shown in Figs. 9 and 10.

Various researchers have tackled different applications of transfer learning on SVM architecture. We have proposed a generic training algorithm which can be used for any deep learning network having feature extraction and classification layer integrated. Also the application of face recognition at a distance is novel. As a result there is no data available in the literature with which the proposed work can be compared. Hence authors of this paper have compared the proposed training algorithm with the existing traditional algorithm of CNN.

Conclusion

We have proposed a novel training algorithm that can be used to train any neural network architecture which is meant for visual pattern recognition. These networks have feature extraction and classification layers integrated into the architecture. In many applications training data are made available subsequently. In this situation neural networks like CNN and neocognitron are to be trained again with the new data. The proposed approach can be used in such situations. In this approach, one can tap the output of the last feature extraction layer and reweight the output in such a way that the distribution difference between the old and new training samples is reduced. We have shown the utility of the algorithm for the CNN architecture. However, the approach is generic and can be used for any neural network architecture which has feature extraction and classification layers integrated into one architecture.

Training time of any neural network increases with the increasing number of samples. If the training samples are not available at one time, then the situation demands retraining. Many machine learning softwares do not have provision to avoid retraining. The proposed algorithm can increase the utility of any machine learning software by giving an user a method with which by doing few disturbances in the trainable parameters transfers the new information into the architecture. By this approach the training time can be reduced under transfer learning task.

We have proposed a novel three-phase training algorithm for CNN under transfer learning that gives a constant average classification rate. With the proposed framework one has to disturb only 60 percent weights in the architecture for incorporating the knowledge available from the new training samples. We proposed minimum change principle, as per that one has to disturb few weights to transfer knowledge. The work may be extended by (1) reducing a negative transfer of knowledge; (2) coming up with information theoretic measure of the information transfer.