# A Voxel Generator Based on Autoencoder
## 3 VoxGen
Moreover, the flattened layer of the original VGG16 is fully flattened, while that of the original ResNet 18, 34, and 50 is a global average pooling layer, as shown in Figure 4. Generally speaking, fully flattened layers are useful for improving the accuracy of generated 3D voxel models, as they retain all of the extracted features; however, they require massive data computation if the number of feature maps is large. Conversely, the global average pooling layer helps save on the computation cost of the neural network but may also degrade the accuracy of  
Figure 3: Structure of VoxGen with the modified-ResNet18 encoder. Figure 2: Structure of VoxGen with the modified-VGG16 encoder. generated 3D voxel models because it reduces a feature map to a single value. Currently, VoxGen allows users to choose between the fully flattened or global average pooling layer according to their need to either optimize accuracy or minimize computation cost. The step next to encoding is to generate the 3D mode voxel according to the latent variables through the decoder network. VoxGen has three decoder architectures, i.e., deconvolution, mixed-single convolution, and mixed-multiple convolution. The deconvolution decoder is composed of seven deconvolution layers. The parameters (filter number, filter dimension, stride) of these seven deconvolution layers are as follows: (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (24, 3 \(\times\) 3 \(\times\) 3, 1), (1, 3 \(\times\) 3 \(\times\) 3, 1), as shown in Figure 5.  
The mixed-single convolution decoder consists of six 3D deconvolution layers and one convolution layer, as shown in Figure 6. The parameters of the six deconvolution layers are (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (24, 3 \(\times\) 3 \(\times\) 3, 1). The parameter of the 3D convolution layer is (1, 3 \(\times\) 3 \(\times\) 3, 1). The mixed-multiple convolution decoder is composed of six deconvolution layers interleaved with six convolution layers, as shown in Figure 7. The parameters of the  
Figure 4: Fully flattened layer and global pooling layer. Figure 5: Structure of deconvolution decoder. Figure 6: Structure of mixed-single convolution decoder. six deconvolution layer are as follows: (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (64, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (32, 3 \(\times\) 3 \(\times\) 3, 2), (24, 3 \(\times\) 3 \(\times\) 3, 1). The parameters of the six 3D convolution layers are as follows: (64, 3 \(\times\) 3 \(\times\) 3, 1), (64, 3 \(\times\) 3 \(\times\) 3, 1), (64, 3 \(\times\) 3 \(\times\) 3, 1), (32, 3 \(\times\) 3 \(\times\) 3, 1), (32, 3 \(\times\) 3 \(\times\) 3, 1), (1, 3 \(\times\) 3 \(\times\) 3, 1). Adding the convolution layer to the decoder is useful to highlight the features of the generated voxel model and polish the model edges; however, this increases the computation cost of the decoder network and may induce the overfitting problem. The performance of these three decoders will be compared in Section 4.2. Finally, the loss function used by VoxGen is Mean Squared False Error (MSFE) [29], denoted as follows. \[ \begin{array}{c}\text{MSFE}=\text{FPE}^{2}+\text{FNE}^{2}\\ \text{MSFE}=\frac{1}{2}\Big{(}\big{(}\text{FPE}+\text{FNE}\big{)}^{2}+(\text{ FPE}-\text{FNE})^{2}\Big{)}\end{array}  \tag{1}\]  
In this formula, the False Positive Error (FPE) and False Negative Error (FNE) estimate the errors in the negative and positive classes, respectively. Their formulas are as follows.