In this paper, we propose a crack detection method using finite element model and machine learning algorithm. However, in order to use machine learning for crack detection, a lot of data is needed. Therefore, in this study, we propose a crack detection method that efficiently generates deformation data corresponding to various cracks using XFEM and generates a corresponding crack image when deformation data is given. To do this, we use the structure of variational autoencoder (VAE), which is a representative model, and modified the loss function to fit the problem. The crack detection results show that the position and shape of the crack can be detected using the deformation data. The crack detection method using the mode shape independent of the load is expected to be a basic study of the crack detection using the vibration data.