## 2 Model Building
### The Sequence Modeling Module  
RNN is an important branch of deep neural network, which is very good at processing sequence-like data. The most significant feature of RNN is that the current output of a node in the hidden layer is not only related to the current input, but also to the output of the hidden layer at the previous moment, and its node structure is schematically shown in Figure 3.  
Neural network \(A\) is regarded as a function \(g\), the weight matrix is \(\omega\), and the RNN recursive function can be expressed as:  
\[h_{t}=g(h_{t-1},x_{t},w), \tag{5}\]  
In this way, it can ensure that each moment of the RNN contains information from the previous moment, and contextual links between feature sequences can be established. The current output of CNN is only related to the current input, leading the dependencies of samples on time or space sequences cannot be modeled, so it is necessary to introduce RNN for the following reasons: Firstly, RNN has a strong ability to capture contextual information in sequences. Secondly, in the digital instrument reading recognition task, the characters at each position of the reading string are relatively random while some neighboring sequences have complementary features, so it is important to establish the short-distance dependencies not the long-distance among the preceding and following  
Figure 3: The structure of RNN nodes.  
sequences. Thirdly, RNN can traverse sequences of arbitrary lengths, and effectively deal with the recognition of variable-length readings.  
Traditional RNN unit (BasicRNN) [18] and Long-Short Term Memory (LSTM) [31] unit are two representative types of RNN units, whose structures are shown in Figure 4. From the figure, we can see that the repeated cell structure of BasicRNN is simple, and there is only one neural network layer. Due to the chain law, the preliminary information of BasicRNN is easier to be lost, and the information it keeps is usually short-distance. The repeated cell structure of LSTM is complex with not only one neural network layer but also three gating units, and these gating structures interact with each other to control cell selects the information of interest, as shown by the horizontal line running through the top of the cell in the figure. The cell states in LSTM only need to perform linear summation operations to pass the hidden layer, so it is good at conveying long-term information but lacks the ability to focus on local regions. On account of the previous analysis, we expect the characters of the string to be relatively independent from each other, but to preserve the short-distance dependencies among the feature sequences, in the digital instrument reading recognition task, so we select the BasicRNN network for sequence modeling.  
To be specific, given the feature sequence \(X=\left\{x_{1},\ldots,x_{j},\ldots,x_{T}\right\}\) from the extractor, in order to get the contextual information, the recurrent neural network \(G(\bullet\ )\) generates the contextual representati \(C=\left\{c_{1},\ldots,c_{j},\ldots,c_{T}\right\}\) through the recurrent connection \(c_{t}=G(c_{t-1},x_{t})\). Finally, for the generated sequence, we obtain the posteriori probability distribution over the label space for per-frame in the sequence via a linear layer:  
\[y_{j}=softmax(c_{j}),j=1,2,\ldots,T, \tag{6}\]  
Then the whole label distribution \(Y=\left\{y_{1},\ldots,y_{j},\ldots,y_{T}\right\}\) are made based on \(C=\left\{c_{1},\ldots,c_{j},\ldots,c_{T}\right\}\). The entire process of the sequence modeling module can be represented as:  
\[Y=R_{\theta_{2}}(X), \tag{7}\]  
where \(\theta_{2}\) is the parameters of the feature extractor \(R_{\theta_{2}}(\bullet)\) denotes the whole sequence module based on Bi-BasicRNN, which capture the short-distance sequential dependencies with both directions.