Research Article

Research on the Image Description Algorithm of Double-Layer LSTM Based on Adaptive Attention Mechanism

Algorithm 1

AAM-DLSTM algorithm training process.
Pseudo-code implementation of AAM-DLSTM algorithm
(1) for i:1-10000{
(2)  for batch:1-Total number of images in the training set/batch_size{
(3)   Read a batch_size number of images into the model;
(4)    for t:1-T{
(5)     Extract global features and spatial local features of the image
(6)     Update the hidden layer state and memory layer state of the LSTM-1 module, and output the visual attention sentinel vector vst;
(7)     Update the hidden layer state and memory layer state of the LSTM-2 module;
(8)     Generate the predicted word st for the current time step
(9)    }
(10)   Get the text description sentence S of the current image;
(11)   Update each parameter in the AAM-DLSTM model;
(12)   }
(13)   }
(14)All the loops are over, and the parameters of the AAM-DLSTM model are obtained