# Computational Acceleration of Topology Optimization Using Deep Learning
## 5 Evaluation Metrics
### Experiments on Dataset #3  
Authors of the work [19] applied three stage neural networks to Dataset #3. In the first stage, they used so-called feedforward NN to get a density distribution image. Input and output of the first stage are given to CNN in the second stage. The second stage output is passed through the third stage to obtain globally optimized structures.  
In our work, we applied CNN to the same Dataset #3 with modified inputs such as inputs of 2D objects based on 6 elements [VF, U1:U5], inputs of 3D objects based on 19 elements [VF, U1:18] and achieved 96.67% accuracy for 2D and 93.22% for 3D objects as shown in Table 4. According to the curve of the Loss function of the model, 50 epochs is enough to get the right decision (Figure 10).  
Generalization is the one of main measures to describe how well the machine learning model has been built. Generalization refers to a model's ability to adapt properly to new, previously unseen data, obtained from the same distribution as the one used to create the model. One of the gold standards to check generalization ability is to compare test and training accuracies.  
Thus, training and testing results of the proposed Res-U-Net are almost the same. The samples for the comparative studies are based on the conventional SIMP model, and the accuracy is 99%, and they are consistently around 99% after 30 iterations. Similar to [18], Dataset #2 is divided into training, validation, and test sets as follows: 4 displacement BCs of the total 42 are randomly selected as the test set. All data samples from the remaining 38 displacement boundary conditions are shuffled and split into training (80%) and validation (20%) sets. Note that the boundary conditions in the test set are not used for training of the neural networks. According to training results, training and validation binary accuracies are around 99%, but the test accuracy is around 90%. The main reason is that training and validation data are from the same distribution (38 scenarios) but test data is taken from another 4 scenarios. For Dataset #2, which has 42 different scenarios, better generalization can be obtained by increasing the variety of the training data (adding additional data with different boundary conditions).  
\begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**Experiment** & \multicolumn{2}{c}{**Test**} & \multicolumn{3}{c}{**Train**} & \multicolumn{3}{c}{**Validation**} \\ \hline  & **BA** & **MAE** & **MSE** & **BA** & **MAE** & **MSE** & **BA** & **MAE** & **MSE** \\ \hline
2D & 96.67 & 0.0461 & 0.0241 & 96.72 & 0.0449 & 0.0239 & 96.84 & 0.0441 & 0.0229 \\ \hline
3D & 93.22 & 0.0795 & 0.0513 & 94.01 & 0.0733 & 0.0450 & 93.94 & 0.0737 & 0.0457 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Results of the Res-U-Net on the Dataset#3.  
Figure 10: Illustration of the loss function of model for train and test data.  
The train, validation, and test binary accuracy are almost same for 2D (\(\sim\)96%), and 3D (\(\sim\)93) on Dataset #3. Better generalization can be obtained by adding different combinations of force values.  
To train the suggested models in a similar way, the following software and hardware are required: Python 3.7-3.10; pip version 19.0 or higher for Linux (requires manylinux2010 support) and Windows. pip version 20.3 or higher for macOS.; Windows Native requires Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019. The following NVIDIA(r) software are only required for GPU support.; NVIDIA(r) GPU drivers version 450.80.02 or higher.; CUDA(r) Toolkit 11.2.; cuDNN SDK 8.1.0.