# The Assisted Positioning Technology for High Speed Train Based on Deep Learning
## 3 The Construction of Data Set Based on DCGAN  
### DCGAN Algorithm  
DCGAN introduces the idea of a convolution operation into the generative model to perform unsupervised training, and uses the powerful feature extraction ability of the convolutional network to improve the learning ability of the generative network [36]. It adopts the idea of game theory and is mainly composed of two parts--Generator (\(G\)) and Discriminator (\(D\)). The \(D\) is a typical convolutional neural network twoclassifier. It is a full convolution neural network. It ensures maximum retention of the clarity of feature information and avoids the fuzziness of feature information caused by a pooling layer. The \(G\) is also a convolutional neural network in essence, but it requires image features to be restored, so the convolution layer is replaced by the transpose convolution layer. In this paper, the \(D\) is designed as a five-layer structure, including four convolution layers and one output layer. The first four layers are convolution layers. Their convolution kernel size is \(5\times 5\), and the activation function is a leaky-relu function. The last layer is the output layer, and its activation function is the sigmoid function. In order to achieve Nash equilibrium between \(D\) and \(G\) in the model, it is usually necessary to make their performance consistent, otherwise the model cannot converge easily. Therefore, the setting of \(G\) is basically consistent with \(D\), which is also a total of five layers. In addition, because the input of \(G\) is a random noise, the data dimension needs to be adjusted to fit the operation, so a full connection layer is added to adjust the data dimension before the transpose convolution layers. The last four layers are transpose convolution layers, and the convolution kernel size is also \(5\times 5\). The last layer uses tanh as the activation function, and the other layers use relu as the activation function. The basic structure of DCGAN is shown in Figure 1. Compared with GAN, the generator and discriminator of DCGAN use a convolutional layer instead of the fully connected layer, which can generate a higher quality image. As DCGAN is the combination of GAN and CNN, this results in a qualitative enhancement in the effect of GAN, and most of the commonly used generative adversarial networks are improved [34]. In Figure 1, the \(D\) is mainly used to discriminate the authenticity of the input data, and the \(G\) aims to generate fake data that is very similar to the real data. In the training process, the input of \(D\) represents the real data and the fake data generated by \(G\).The task of \(D\) is to discriminate whether the input data are real or fake. According to the discriminant results of \(D\), the parameters of \(D\) and \(G\) are optimized simultaneously. If the discriminant of \(D\) is correct, it is necessary to optimize the parameters of \(G\) to generate more realistic fake data. On the contrary, if the discriminant of \(D\) is wrong, it is necessary to optimize the parameters of \(D\) to obtain a more accurate discriminant. A balanced continuous confrontation optimization is needed until the data generated by \(G\) are highly simialr to the real data. The detailed training steps and criteria are as follows [35]:  
1. The input of \(G\) is random noise z and the output of it is the generated image \(G(z)\). The input of \(D\) is real data \(x\) and the generated image \(G(z)\), and the output of it is \(D(x)\) and \(D(G(z))\). 2. The loss function of \(D\) is calculated as follows: \[D_{\text{loss}}=\frac{1}{m}\sum_{i=1}^{m}\left[\log D(x^{(i)})+\log(1-D(G(z^{( i)})))\right]\] (1) where \(m\) is the number of samples taken each time. The cross entropy of real samples and generated samples is calculated, and the average value of cross entropy of all samples is calculated as the loss function of \(D\) to optimize \(D\). 3.