Image Classification Based On Transfer Learning of CNN
Image Classification Based On Transfer Learning of CNN
Abstract: Aiming at the issue of timeliness and lack of partial image data in life, an algorithm, transfer learning which based on
convolutional neural network (CNN) is proposed, combining image histogram of oriented gradient (HOG) feature extraction
method and support vector machine (SVM) pre-classification method. Firstly, the HOG features of the training sample similar
to the attributes of the samples which to be classified are extracted, then the hog features of the training samples are imported
into the SVM classifier to get the pre-classification results. Finally, the pre-classification results are used as training samples to
train the transfer network of CNN for getting new transfer learning model, this model can be used to classify similar pre-
classification samples. The experimental results show that the classification accuracy of the five categories of elephants and
dinosaurs used in this paper is effectively improved, and the overall classification accuracy can reach 95%, compared with the
traditional classifier algorithm and convolutional neural network algorithm. The classification accuracy has been improved by
about 5%.
Key Words: Convolutional neural network, Transfer learning , Image classification, Support vector machine
7506
pixel of the image. The next, the images are divided into 6*6 ܹ כൌ σே כ
ୀଵ ݕ ܽ ܺ (2-3)
כ כ כ
cells. ܽ ൣݕ ሾሺ ܹۃή ܺ ۄ ܾ ሻ െ ͳሿ൧ ൌ Ͳ (2-4)
ܾ כൌ ݕ െ כ ܹۃή ܺ ۄ (2-5)
݂ሺܺሻ ൌ σே כ
ୀଵ ݕ ܽ ܺۃή ܺ ۄ ܾ
כ
(2-6)
It is difficult to find a corresponding classification
hyperplane at low latitude level for datasets. We introduce a
kernel function to convert the data into high-dimensional
മ ⚠ᓖമ
planes.
ሩ⇿њFHOOඇሩ
ᖂаॆ༴ 䇑㇇ở
ởᓖⴤᯩമ䘋㹼
⨶ ᓖ 㿴ᇊᵳ䟽Ⲵᣅᖡ
ᡰᴹⲴEORFNⲴ ሩ⇿њ䟽ਐEORFN
ⴤᯩമੁ䟿㓴ᡀ ඇⲴFHOOሩ∄
+RJ⢩ᖱੁ䟿 ᓖᖂаॆ
+RJ⢩ᖱⴤᯩമ ᯩੁởᓖമ
ሺǡ ሻ ൌ ඥܩ௫ ሺݔǡ ݕሻଶ ܩ௬ ሺݔǡ ݕሻଶ (1-3) intermediate nodes, each intermediate node pair uses a
ீ ሺ௫ǡ௬ሻ
Ƚሺǡ ሻ ൌ ିଵ ሺ ሻ (1-4) support vector, as shown in Figure 2.
ீೣ ሺ௫ǡ௬ሻ
In the above formula, x and y are pixel coordinates, and 4 Transfer learning
the gradient histogram of each cell is counted. Each 3*3 cells
Using the neural networks such as Alex-net and VggNet
constitute a block. Then all the cell feature vectors in the
for image classification can obtain better classification
block are connected in series to obtain the HOG
results. As shown in Figure 3, the AlexNet network input
characteristics of the block. The last step is to collect HOG
dataset type 227*227*3 RGB image is calculated by the
features from all overlapping blocks in the detection window
convolution layer, pooling layer, active layer, Dropout layer,
and combine them into the final feature vector for
fully connected layer and other large data to become 1000-
classification.
dimensional Vector to be classified. finally use the softmax
3 SVM classification classifier to achieve classification effect. But the AlexNet
and VggNet algorithms are too dependent on huge amounts
The basic idea of the support vector machine is to solve of data and require a lot of computation time. The emergence
the separation hyperplane that can divide the training data of transfer learning can solve this problem well.
set correctly and has the largest geometric interval [15]. In
order to get the optimal classifying hyperplane, it is actually
to solve a quadratic programming problem. The classical
solution method is the Lagrange multiplier method, and the
Lagrange equation is formula (2-1). In the formula, W is the
coefficient vector and b is the constant. Obtaining partial
derivatives for W and b yields formula (2-2), in which
and are the pixel coordinates of the image. Solving this
equation results in vector W*. The result is shown in formula
(2-3). The optimal a* is determined by the constraint
formula (2-4), a* and W* can be obtained by a quadratic
programming algorithm, and then a support vector Xi can be
selected to obtain the value of b*, as shown in formula (2-5).
The final optimal discriminant function is shown in formula
(2-6).
ଵ
ܮሺǡ ǡ ሻ ൌ ȁȁܹȁȁଶ െ σே ୀଵ ܽ ሼݕ ሺܺۃ ή ܹ ۄ ܾሻ െ ͳሽ
ଶ Fig.3 :AlexNet network structure
(2-1)
ଵ ே
ሺሻ ൌ σே ܽ
ୀଵ െ σ σ ே
ݕ ݕ ܽ ܽ ܺۃ ή ܺ ۄ The purpose of transfer learning is to transfer information
ଶ ୀଵ ୀଵ
(2-2) between the relevant source and target domains. The main
7507
idea is to use a training model parameter obtained from a (one-to-many) and Hierarchical Support Vector Machines.
large amount of training data to classify a small amount of This experiment adopts a one-to-one method that any An
test data and obtain an ideal classification accuracy. The SVM is designed between two types of samples. When
main process of transfer learning is as follows: classifying an unknown sample, the category with the largest
(1) Use Alexnet to train a large number of source domain number of times that is finallyclassified into a certain class
data to save the best model of classification effect. is the unknown sample class.
(2) Transfer the best model and weight parameters. In the last three layers of the transfer network, the full
(3) Use the model after the transfer to test the data under connection layer sets the Weight_Learn _Rate_Factor
the target domain. (weighted learning factor) and the Bias_Learn_Rate_Factor
The specific process is shown in Figure 4. First, use (base learning factor) to 20. In order to improve the training
Alexnet to train the Imagenet dataset, obtain the weight speed, the training related parameters are set as shown in
parameters through a series of convolution pooling Table 1.
processes, and save the model after obtaining the optimal
results. Secondly, the obtained optimal model is migrated to Table 1: Transfer Network Control Parameters
the data with less sample set for training. After fine-tuning Attribute澳 Parameter澳
the model, it can be used to test the classification of the MiniBatchSize澳 10澳
sample. MaxEpochs澳 6澳
InitialLearnRate澳 1e-4澳
ValidationFrequency澳 3澳
ValidationPatience澳 Inf澳
7508
Table 5: AlexNet classification results
AlexNet
7509
6 Conclusions and future prospects [7] Guandong Li, Chunju Zhang, Mingyu Wang, Xueying Zhang.
High-resolution image scene classification learning with
This paper proposes an Alexnet-based transfer learning convolutional neural network transfer [J/OL]. Science of
algorithm combined with the svm algorithm to avoid Surveying and Mapping, 2019(06): 1-13
over-fitting caused by too little training data set. The [8] Jia gang, wang zongyi. Application of hybrid transfer
algorithm reduces the training time as much as possible learning method in medical image retrieval [J]. Journal of
while improving the accuracy. In addition, the deep Harbin Institute of Technology, 2015, 36(7):938-942.
[9] Jinghui Chu, Zerui Wu, Wei Lu, Zhe Li. Mammary tumor
learning model used in this algorithm can be optimized
diagnosis system based on transfer learning and deep
and updated according to the development of the deep convolutional neural network [J/OL]. Progress in Laser and
learning network. Based on the excellent performance of Optoelectronics: 1-12[2018-05-03]
the algorithm under the small sample training set, the [10] E. Rezende, G. Ruppert, T. Carvalho, F. Ramos and P. de
algorithm should have good applicability in medical Geus, "Malicious Software Classification Using Transfer
image analysis and regional detection. However, if we Learning of ResNet-50 Deep Neural Network," 2017 16th
want to apply this algorithm to the actual situation, we IEEE International Conference on Machine Learning and
also need to solve the problems of under-adaptation and Applications (ICMLA), Cancun, 2017, pp. 1011-1014.doi:
negative transfer in transfer learning, so as to improve the 10.1109/ICMLA.2017.00-19
[11] C. Galea and RA Farrugia, "Matching Software-Generated
generalization ability of the transfer model in new
Sketches to Face Photographs With a Very Deep CNN,
situations. Morphed Faces, and Transfer Learning," on IEEE
Transactions on Information Forensics and Security, vol. 13,
References no.6.Pp.1421-1431,June2018.doi:
10.1109/TIFS.2017.2788002
[1] D. Cheng, Controllability of switched bilinear systems, IEEE [12] Danfeng Liu, Jianxia Liu. Neural Network Model for Deep
Trans. on Automatic Control, 50(4): 511–515, 2005. Learning Over-Fitting Problem[J]. Journal of Natural Science
[2] Fuzhen Zhuang, Ping Luo, Qing He, Zhongzhi Shi. Research of Xiangtan University, 2018, v.40; No.145(02):100-103.
progress in transfer learning[J]. Journal of Software, 2015, [13] Li Tao, Wei Yang, Wei Yang. Research on Model
26(01): 26-39. Construction and Over-Fitting of Deep Learning[J]. Journal
[3] Zhijie Xu. Research on Transfer Learning Theory and of Computer, 2018.
Algorithm [D]. East China Normal University, 2012. [14] Dalal N, Triggs B. Histograms of oriented gradients for
[4] Pan S J , Yang Q . A Survey on Transfer Learning[J]. IEEE human detection[C]// IEEE Computer Society Conference on
Transactions on Knowledge and Data Engineering, 2010, Computer Vision and Pattern Recognition. IEEE, 2005:886-
22(10):1345-1359. 893.
[5] M. Oquab, L. Bottou, I. Laptev and J. Sivic, "Learning and [15] Geismann P , Schneider G . A two-staged approach to vision-
Transferring Mid-level Image Representations Using based pedestrian recognition using Haar and HOG
Convolutional Neural Networks," 2014 IEEE Conference on features[C]// Intelligent Vehicles Symposium, 2008 IEEE.
Computer Vision and Pattern Recognition, Columbus, OH, IEEE, 2008.
2014, Pp. 1717-1724.doi: 10.1109/CVPR.2014.222 [16] Shi-Fei D , Bing-Juan Q I , Hong-Yan A T . An Overview on
[6] Song Li, Zhonghao Wei, Bingchen Zhang, Wen Hong. SAR Theory and Algorithm of Support Vector Machines[J].
target recognition in deep learning convolutional neural Journal of University of Electronic Science & Technology of
network[J]. University of Chinese Academy of Sciences, China, 2011, 40(1):2-10.
2018, 35(01): 75-83.
7510