Scientific knowledge
The full English name of AAAI is the Association for the Advance of Artificial Intelligence, and the Chinese meaning is the Association for the Advance of Artificial Intelligence.
American Association for Artificial Intelligence is one of the main academic organizations in the field of artificial intelligence. The annual meeting (AAAI, The National Conference on Artificial Intelligence) hosted by the association is a major artificial intelligence academic conference.
# Preface
SEP.
In the last article of the theoretical chapter, we learned about the GoogLeNet network. Its core is the Inception module. Through this module, the neural network can be designed very deep. Today we will use TensorFlow to carry out the actual combat of the Inception module. I hope you like it.
TensorFlow's Inception combat
In this actual combat, we use the facial expression data set for training. The model is mainly the Inception module. Since it is only a demo, we only design a simple layer. The code will be open sourced to gitee.
1. Data preparation
This time the data uses the RAFDB facial expression dataset, which contains seven categories: peaceful, happy, sad,
Surprised, disgusted, angry, scared. Similar to the previous dataset, this facial expression dataset also contains
Training set and test set, each set does not contain 7 folders (expressions). with the previous dataset
Same, the data set contains training set and test set, each set contains seven folders (expressions)
some samples show
2. Network structure
The network structure is as above, because it is very simple to change the module, we will not carefully analyze the parameters of the network, the specific parameters can be seen from the previous article (Deep Learning Theory (16) -- GoogLeNet's re-exploration of depth Mystery ), from the code below, you should be able to see the dimensional transformation of each layer, which is really incomprehensible, I believe that as long as you debug carefully, there will be no problem, it is recommended to print the dimension information of each line of code, and it will be clear Know how the feature map changes step by step in the network.
def inference(images, batch_size, n_classes,drop_rate):
#左1x1 conv
conv1 = Conv_layer(names = 'conv_block1', input = images , w_shape = [1, 1, 3, 128], b_shape = [128], strid = [1, 1])
# print("******** conv1 {} ".format(conv1.shape))
#1x1 conv
conv2 = Conv_layer(names = 'conv_block2', input = images , w_shape = [1, 1, 3, 64], b_shape = [64], strid = [1, 1])
# 第二层卷积1
conv2_1 = Conv_layer(names = 'conv_block2_1', input = conv2 , w_shape = [3, 3, 64, 192], b_shape = [192], strid = [1, 1])
# print("******** conv2_1 {} ".format(conv2_1.shape))
#1x1 conv
conv3 = Conv_layer(names = 'conv_block3', input = images , w_shape = [1, 1, 3, 64], b_shape = [64], strid = [1, 1])
# 第二层卷积2
conv3_1 = Conv_layer(names = 'conv_block3_1', input = conv3 , w_shape = [5, 5, 64, 96], b_shape = [96], strid = [1, 1])
# print("******** conv3_1 {} ".format(conv3_1.shape))
#3x3 max pooling
pool_1 = Max_pool_lrn(names = 'pooling1', input = images , ksize = [1, 3, 3, 1], is_lrn = False)
# 第二层卷积2
conv4 = Conv_layer(names = 'conv_block4', input = pool_1 , w_shape = [1, 1, 3, 64], b_shape = [64], strid = [1, 1])
print("******** conv4 {} ".format(conv4.shape))
concat_op = tf.concat([conv1, conv2_1, conv3_1, conv4],3)
conv5 = Conv_layer(names = 'conv_block5', input = concat_op , w_shape = [1, 1, 480, 64], b_shape = [64], strid = [1, 1])
# print("******** concat_op {} ".format(concat_op.shape))
If you look at the network structure carefully, I added a layer of 1x1 convolution to the last layer of the output, the purpose is why,
Of course, there is no mine at home, so I can only reduce the dimension.
3. Training process
Source code acquisition: https://gitee.com/fengyuxiexie/inception
END
epilogue
The sharing of this issue is over. The module is very simple. I hope that students will also contact more. In addition, this time we have added a new facial expression dataset. Students who need it can consult in the background.
Editor: Layman Yueyi|Review: Layman Xiaoquanquan
Advanced IT Tour
Past review
Deep Learning Practical Chapter (14) -- VGG16 of TensorFlow
Deep Learning Practical Chapter (13) -- AlexNet of TensorFlow
Deep Learning Practical Chapter (12) -- LetNet-5 of TensorFlow
What have we done in the past year:
[Year-end Summary] Saying goodbye to the old and welcoming the new, 2020, let's start again
[Year-end summary] 2021, bid farewell to the old and welcome the new
Click "Like" and let's go~