Computer vision with error estimation for reduced order modeling of macroscopic mechanical tests

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés. Computer vision with error estimation for reduced order modeling of macroscopic mechanical tests Franck N’Guyen, Selim M. Barhli, Daniel Pino Muñoz, David Ryckelynck


Introduction
In biomechanics, computer vision and mechanical testing have been coupled to obtain patient-specific simulation approaches, as proposed in [1]. At the same time, with the growth of industry 4.0, imaging techniques are more and more widespread in factories. When combined with artificial neural networks, digital images enable the classification of products to obtain the best possible process, as proposed in [2] for olive batches classification in oil extracting process or as shown in [3] for composite materials manufacturing. Nowadays, we have the possibility of extending these methods to the classification of mechanical parts produced in industry, in order to develop part-specific decision approaches. For mechanical parts, the quality of manufacturing processes has a direct influence on the ultimate mechanical properties of the manufactured parts. For example, the way the fracture is initiated in a specimen often reveals defects in the material whose origin can be tracked back to the manufacturing process [4]. In general, the numerical computation of mechanical stresses in a given manufactured part allows the predictive evaluation of the link between the ultimate mechanical properties of this part and the manufacturing process. The reader can find an example of how to optimize a process for curing composite parts in [5] according to this paradigm. The mechanical modeling of manufactured parts has for purpose to verify if defects induced by a manufacturing process are tolerable, if an observed part must be rejected, or if the manufacturing process must be improved.
In this paper, we restrict our attention to the stress prediction in a part under an observed loading environment by a digital image, while including all its geometrical defects. We propose a hybrid approach that simultaneously exploits a data-driven model and a physics-based model, in mechanics of materials. The reader can find a review on hybrid modeling in [6] for remaining useful life predictions of engineering systems. We show that the strength of the proposed hybrid modeling is its ability to incorporate an error estimator related to the modeling chain with computer vision and convolutional neural networks (CNN) [7,8].
2 Complexity As explained in [9], computer vision with deep convolutional neural networks has achieved state-of-the-art performance on standard recognition datasets and tasks. In this paper, we explore the capabilities of a CNN as a recommender system for the mechanical modeling of structures submitted to various loading. The proposed hybrid modeling couples a noncentered principal component analysis (PCA) and a CNN, in order to preserve an accurate description of spatial information.
Image processing for computer vision is usually very fast. It does not make sense to couple computer vision with numerical simulations of mechanical stresses that take hours of computation. Hence, we couple computer vision with reduced order modeling of structures, in order to get fast mechanical predictions of stresses. A reduced order model is a surrogate model obtained by the projection of high dimensional equations on a reduced space, and it also involves a reduced approximation space for the variables of the high dimensional problem. When they are the same, the surrogate model is a Galerkin reduced order model [10]. In hyperreduced order models these two reduced spaces are different [11]. Then, because we consider projection of physics-based equations, hyperreduced order models preserve the physical parameters involved in the high dimensional equations. The reduced spaces involved in the hyperreduced modeling are spanned by empirical modes extracted from simulation data, by using the proper orthogonal decomposition [10] of known finite element predictions. This procedure is similar to a noncentred principal component analysis (PCA). Hence, the proposed modeling via computer vision exploits both simulation data and observational data, which are, respectively, finite element predictions and digital images of mechanical tests.
In general, the empirical modes obtained by noncentred PCA are very sensitive to the loading environment imposed when computing the simulation data. If the variety of loading conditions considered to calculate simulation data is too wide, the number of empirical modes becomes too large. They can no longer reduce the numerical complexity of the mechanical balance equations. Clustering methods have been applied for model-order reduction in [12,13], in order to preserve small reduced-bases of empirical modes. Moreover, cluster-based reduced order modeling (CROM) has been proposed in [14] to define a small subset of critical data to learn an efficient (CROM) with a sparse approximation space [15]. In this paper, a dictionary of hyperreduced order models is generated by considering clusters of possible loading environments in the observed mechanical tests. Then, the identification of the hyperreduced order model is done via recognition of a class of mechanical loads by a convolutional neural network. In practice, each item of the dictionary is not directly a hyperreduced order model. In order to face a possible variability on the geometry of the observed structures, it is more robust to define an item of the dictionary as a set of finite element solutions for various ideal geometries and for a given class of mechanical loads. Hence, the proposed workflow is robust enough to face geometrical defects in the observed mechanical parts. We assume that the mesh for the finite element modeling of the parts is obtained by using image-meshing techniques, as proposed in [16], of segmented 3D digital images obtained by X-ray computed tomography. We refer the reader to [17,18] for more details on finite element modeling of 3D images obtained by Xray computed tomography. An example of X-ray computed tomography applied to manufactured parts can be found in [19]. The ideal geometries involved in the proposed workflow were obtained by using computer-aided-design (CAD). Such CAD models are usually used to find an optimal design of the manufactured parts, with parametric finite element simulations [20].

Materials and Methods
Prior to the stress prediction, a reduced order model is setup for the projection of the mechanical balance equations.
Here the reduced order model concerns the displacement in the observed mechanical part. Usually, for the computation of reduced approximations in nonlinear problems, we formally consider all possible situations in a given parameter space [21]. The parameters aim to describe all the possible mechanical problems, in advance, before the observation of a realization of one situation. This approach defines a tensor for the description of all possible displacements. The order of this tensor is the number of scalar parameters involved in the parametric equations, plus one. For instance, if a single parameter is introduced then we need two indices i and j to have access to the value of the i th degree of freedom of a finite element model for the j th value of the parameter. When D parameters are introduced, we need D+1 indices: i, j (1) , . . . j (D) , to have access to a scalar value in the tensor containing all the possible displacements. This tensor formalism aims to introduce a sampling procedure of the parameter space in order to get an estimation of the reduced approximation, or a reduced basis, for the displacements. For instance, this sampling procedure can be achieved by the proper generalized decomposition (PGD) [21] or the Tensor Train decomposition [22,23]. In this paper, the loading environment is depicted by an image of 3968 × 2976 pixels. Then the parameter space dimension is around 12 millions (the number of pixels) for the description of all possible loading environments. Hence the tensor formalism for model-order reduction would require the decomposition of a tensor of order 12 millions. To our knowledge, no tensor decomposition method has been applied to such a huge tensor order. A purely tensor approach seems to be unaffordable. In this paper, we do not pretend to model all the possible solutions of mechanical equations related to a huge parameter space. We do not follow the usual paradigm of low rank approximations. The proposed image-based modeling aims to exploit available data for fast approximate predictions with fast error estimation.
The workflow of the proposed modeling via computer vision is shown in Figure 1. Four kinds of inputs are required: (i) a 2D digital image of the part in the test machine, this image is denoted by * ; (ii) a database where are saved all simulation data, ordered with respect to a cluster index and the index   of the available ideal mesh in the list ( ) =1 , these are the meshes used when generating the simulation data by the finite element method; (iii) a 3D voxel image of the part alone, we assumed that this 3D image is obtained by X-ray computed tomography; (iv) a measurement of the load magnitude at the end of the mechanical test and a measurement of the displacement at one fixed point of on the part, at the end of the test.
The CNN network aims to recognize the index of the class of loading environment. It gives access to the simulation data required to create on the fly a hyperreduced order model. The measurement of the displacement magnitude helps to get a precise location of the load by solving an inverse problem with hyperreduced equations as proposed in [24].
The stress predicted by the hyperreduction is obtained via constitutive equations in the framework of elasticity. It depends on the spatial position in the part, denoted by , and nodal values of the displacement, denoted by the vector * . This vector has * components. * is the order of the finite element model of the part. The superscript * is introduced for the variables related to the observed mechanical part in the experimental setup. The mesh of the mechanical part is denoted by * and the stress is denoted by ( , * ). The reduced approximation of the displacement reads * ≈ * * , where * is the matrix form of the reduced basis (it has less columns than rows) and * is the solution of the hyperreduced balance equations. Since the finite element method is a numerical scheme for partial differential equations, Dirichlet boundary conditions are applied on the boundary of the domain occupied by the mesh. Here these conditions are null. Hence the displacements belong to a vector space, which is a subspace of a Hilbert space. The columns of * span a subspace of this vector space. They fulfill the Dirichlet boundary conditions applied on * . The hyperreduced balance equations are set on a reduced mesh R * , which is the restriction of * to the finite elements connected to a given list of degrees of freedom, denoted by F. The residual of the finite element equations is denoted by * ( * ). Hence the hyperreduced balance equation reads [20] The larger the set F the higher the computational complexity of the projection of the equations when considering the observed geometry. In the sequel, F is the set of degrees of freedom (dof) indices near the loading areas on * supplemented by the list of dof in a region of interest. When * is the identity matrix and F contains all the dof of the mesh, then (1) returns to the original finite element equations, * ( * ) = 0.
Property 1. The following property holds: if the finite element solution is unique, if the solution of the hyperreduced equation is unique, and if the reduced basis is exactly reproducing the finite element solution, the hyperreduced solution is exact. Hence the following expression holds: * = * * .
In hybrid hyperreduced order models proposed in [24,25], the reduced basis is extended with few finite element shape functions available inside R * . By construction, these shape functions are not connected to the remaining elements of * . The set of indices of these shape functions is denoted by P. It is a subset of F, by construction. For the sake of simplicity, we order the degrees of freedom such that = {1, . . . card( )} ⊂ , where card(P) is the number of elements in the set P. Hence the reduced basis of the hybrid hyperreduced order model, denoted by H , is the following block matrix: where is the identity matrix in dimension card(P). By substituting H for * in the hyperreduced balance equations, one obtains the hybrid hyperreduced equations, of which solution is denoted by . If the projection of * on * is exact, then it has also an exact projection on the larger subspace spanned by H . According to Property 1, if * is exact and if the hybrid hyperreduced equations have a unique solution, then the first components of should be zero and the last one should be equal to * . It turns out that if * is exact and if the hybrid hyperreduced equations have a unique solution, then the stress predictions ( , * * ) and ( , ) are equal. Hence, the following error estimator is proposed, in order to assess the accuracy of the hyperreduced order model that has been recognized by the computer vision workflow: where Ω is the spatial domain occupied by the reduced mesh R * and c is a constant. The larger R * , the more complex the error estimation. When ( , ) fulfills the finite element equilibrium equations, this error indicator is similar to the error indicator proposed in [26] for standard materials. If = 1, if Ω is the domain occupied by the full mesh * , and if P contains all the dof indices, then ( , * ) is the true error. The constant c can be evaluated by following the procedure proposed in [25]. Here, we assume that = 1.
As shown in Figure 1, * is obtained by a noncentred PCA applied on simulation data * . These data are displacement fields ( , ) remapped on mesh G * from the mesh G and restrained to the loads in the class of the load clustering. This clustering of loading environments in the mechanical tests is presented below. A simple interpolation of the data in ( , ) is done for the remapping of the displacement fields on the mesh G * for nodes in the domain occupied by G . For nodes in G * that are not in the domain occupied by the mesh G , the remapping is done via Laplace's equation with an enforced continuity at the boundary of G * and outside G . In practice, a robust model reduction is achieved if the meshes ( ) =1 are restricted to elements that are not connected to nodes submitted to a concentrated load or a Dirichlet boundary condition. In the remapping procedure, the Dirichlet boundary conditions are enforced as Dirichlet boundary conditions of the Laplace's equation. Then ( , ) fulfills the Dirichlet boundary condition on the mesh G * .
The clustering of loading environments in the mechanical tests is performed by using the simulation data mentioned in the workflow in Figure 1. Unfortunately, these data do not have the same dimension since they are supported by different meshes ( ) =1 . Then, they are remapped on the mesh of a bounding box that surrounds all the meshes ( ) =1 , so comparisons are easier. The extrapolation of the data outside the meshes ( ) =1 follows the Laplace's equation again. The remapped simulation data on the bounding box are saved in the tensor ∈ R × × ×̃o f order 4. Four indices are introduced to have access to scalar values saved in . This value is denoted by ( , , , ), where i is the load case index, p is the dof index in the bounding box, j is the index of the mesh in the list ( ) =1 , and n is the index related to additional parameter variations. For instance, local variations of the mechanical properties have the capability to enrich the simulation data for model-order reduction as proposed in [11]. When considering simulation data related to finite element models, a high resolution in spatial fields is achieved by high dimensional finite element space. Hence , the second dimension of , is often larger than 10 5 and can reasonably be up to 10 7 in industrial applications. In very high-dimension spaces, all the data are "far away" from the centre. Hence, a feature extraction is required in the framework of mechanical modeling, prior to clustering the simulation data. Several tensor decomposition methods are available in the literature for feature extraction. For instance, the k-PCA has been coupled to the proper generalized decomposition method in [27,28] for extracting hidden model parameters. We refer the reader to [29] for a review on feature extraction. Here, we adopt a hierarchical Tucker format [30]: wherêis obtained by the following truncated singular value decomposition:̂=̂̂̂, wherêis the reshape of as a second order tensor: = ( , , , ) , We restrict the clustering of data to features in dimension 2, for the ease of results visualization, and on the two following average data: This two-dimensional feature space enables visualizing clusters on loading environments. Here, we arbitrary select K clusters by using the k-means method. In the future we would experiment other clustering methods such as graph-based clustering, for instance. Then, we obtain a partition of the simulation data into K sets 1 , . . . The CNN architecture chosen for this work is based on the layer composition initially described in [31]. The input to the CNN is a fixed-size RGB image of 246 × 246 pixels, denoted ℎ 0 . This input image is obtained by downscaling the original 3968 × 2976 images denoted by * in Figure 1.
The image goes through a set of convolutional layers followed by max-pooling layers. The convolution and pooling stack is repeated 3 times. The rectified linear unit (ReLu) activation function [8] is used for the convolutional layers. This function is denoted by ⟨•⟩ + . Each layer generates a feature map, denoted by ℎ after the th layer. Each feature map is a tensor of order 3, which dimensions are denoted by 1 , 2 , 3 . The first feature map is ℎ 0 . The th convolution layer applies linear filters to ℎ −1 . Each linear filter is determined by the weights and the bias , such that where = 2 − 1, = 2 − 1. The output of the last pooling layer is flattened and fed through 3 fully connected layers: the first one has 512 nodes and the second one 64 nodes; those first two layers use the ReLu activation function. The third layer is a soft-max layer with 4 nodes thus performing the 4way classification task, such that In order to reduce overfitting, dropout regularization is implemented for the first fully connected layer with a dropout rate of 50%.

Experimental Setup.
We consider a very simple mechanical test on a part in order to check its manufacturing process via the stress distribution in the part and the related response of the part submitted to various loading environments on the top of it. An image of the experimental setup is shown on Figure 2. The modeling via computer vision aims to recognize the loading environment applied on the part, in order to predict stresses by using a hyperreduced order model. The magnitude of the load and the vertical displacement at a fixed point are measured precisely during the mechanical test. But the location of the load has to be determined by the computer vision approach. We are considering L=18 possible loading cases regularly spaced on the top of the part. The region of interest shown in red in Figure 3 is hidden in Figure 2 by the experimental setup. If this region of interest would be visible on each image of the experimental design, a digital image correlation [32] approach could have provided an estimate of the mechanical stresses in the part. But it is not appropriate here, because the part is partially masked in some digital images. Figure 3: The red, blue, and yellow regions have been submitted to variations of the Young modulus in order to enhance the space spanned by the simulation data. The region in red is the region of interest selected by the designer of the experimental setup. The mesh shown here is the mesh G 4 . It has 5. 10 5 degrees of freedom.

Simulation Data, Feature Extraction, and Clusters of Mechanical
Loading. Prior to starting the manufacturing process, the experimental setup has been designed by using finite element simulations on four ideal geometries (M=4). The material of the part is elastic, for each mesh G j . The mechanical constitutive equations are the following: where is the symmetric part of the i th finite element shape function related to the i th degree of freedom of the mesh, Here, is the dof index where the load F is applied downward, Ω( ) is the spatial domain occupied by the mesh j , and is the Kronecker delta. The observed magnitude of the mechanical load is 159.9 N.
For each geometry, three local variations of the Young modulus of -20% have been simulated by the finite element model, in order to enhance the space spanned by using the simulation data. The regions affected by these variations are shown in Figure 3. It turns out that we have donẽ= 4 predictions of the displacement fields, for each geometry and each loading case. The region of interest is shown in red in Figure 3. It covers the subdomain where stress concentrations are expected to be highest during the mechanical test.
An example of the remapping of a vertical displacement field onto the bounding box is shown on Figure 4. The mesh of the bounding box has = 8. 10 5 dofs. The first feature mode (the first column of̂) is shown in the right of Figure 4. This feature mode is consistent with the bending simulation of the mechanical parts.
We have arbitrary chosen K = 4 centroids to cluster the mechanical loadings. The L points ( ⏞⏞ ⏞⏞⏞ ⏞⏞ (1) , ⏞⏞ ⏞⏞⏞ ⏞⏞ (2) ) are shown in Figure 5 with the 4 clusters presented by red circles.

Observational Data.
About 250 high resolution digital images for each class of loading have been generated before starting any mechanical experiment. Examples of such images are shown on Figure 6. It takes approximately 10 minutes to get 1000 images. The size of each image is 3968 × 2976 pixels.

Training and Testing the Convolutional Neural Network.
The CNN has been implemented with Keras library in TensorFlow. The train/test set was built following a 90/10 ratio upon the 1000 digital images of loading environments. The volume of training data was artificially increased by using a synthetic data augmentation strategy. Each "original" image was transformed using a combination of random sheer, zoom, and horizontal flip values. The sheer was limited to a maximum of 10% and the zoom to a maximum of 30%. The training was performed by optimizing a multinomial cross entropy loss using a minibatch gradient descend approach with the RMSprop adaptive learning rate method; batch size is set to 32 and the model is trained on 120K steps (60 epochs).
The performance of the CNN is assessed on the test set; a top-1 error value of 1.9% was achieved. This great performance is explained by the easiness of the classification task due to no large variations between input images being observed, since they are all related to the same experimental setup.

Hyperreduction of Finite Element
Equations. The modeling via computer vision has been applied to a mechanical test. The mesh G * of the part is in red in Figure 7. The smallest Hausdorff distance between the ideal meshes and G * is achieved by G 4 , so = 4. This is the grey mesh superposed to G * in Figure 7. There is * =8. 10 5 dof in G * .
The digital image of the mechanical part in the experimental setup is shown in Figure 8. The convolutional neural network recognizes the class number 3 of loading environment. Then =3, and we can extract the simulation data from the database in order to compute the reduced basis * , by using the noncentred PCA. We restrict this reduced basis to five empirical modes. Hence, the projection error of the selected simulation data on this reduced basis is less than 0.1%.
The reduced mesh R * is generated on the fly. It is shown in Figure 9. Here, F is a set of dof in the region of possible loading for class #3, plus the dof close to the displacement measurement, plus the dof in the region of interest. The elements of R * are the elements connected to F.

Stress Prediction and Error Estimation.
A finite element simulation takes 45 min. The stress prediction by the hyperreduced order model shown in Figure 10 is obtained in less than 10 min. 99% of this computational time is spent for the solution of (1). By choosing a smaller set of degrees of freedom F, one can obtain prediction in less than 2 min. The larger the set F, the longer the  simulations. As we can see in Figure 10, the elements of reduced mesh G R * are not necessarily in a continuous domain. As explained in [11], the boundary conditions at the interface between G R * and the remaining elements of G * are similar to Dirichlet boundary conditions. They are enforced by the empirical modes of the reduced basis. Then, the mechanical coupling between the discontinuous parts of the mesh G R * is enforced by the empirical modes.
The exact error on the average stress in the region of interest is 0.1%. The map of the error estimator is shown in Figure 11. The dark grey elements in the reduced mesh (see Figure 9) are connected to the dof in set P. According to (1) by substituting the hybrid reduced basis for * , the first finite element residuals are null, for i in {1, . . . card( )}. Hence the error estimator ( , * ) accounts partially for errors in finite element equilibrium equations. As shown in [26], these errors explain the discrepancy between the hyperreduced prediction and the finite element prediction of the stress.

Conclusions
The proposed reduced order modeling is related to very huge parameter space of dimension twelve millions, mainly due to the input image of the loading environment. The accuracy of the stress prediction is satisfactory to assess the quality of the process with mechanical considerations, even if the region of interest is hidden by the experimental setup. It is also reasonably fast in order to be inserted into a manufacturing process, aiming for part-specific decisions.
The output of the proposed workflow has a high spatial resolution. This is achieved by coupling a PCA, a clustering and a convolutional neural network. A local error estimator aims to indicate the discrepancy between the output and the stress that a finite element simulation would give corresponding to the loading environment recognized by the convolutional neural network. But this error indicator does not evaluate recognition errors, neither error on the mechanical behaviour of the observed material. So, the hyperreduced order model may not be the best that the available data could give.
In this paper, the inputs of the reduced order model are nonparametric loading conditions. They are defined solely by images of the loading environment. Since digital colour images are third order tensors, we expect a possible generalization of the workflow to more complex thermomechanical loading environments and more complex variations for the geometry of the observed parts.
Here, no Big-Data is required to train the proposed reduced order modeling via computer vision. The training starts with a nonsupervised machine learning by using a noncentred PCA and a clustering procedure, both on simulation data. Then, the CNN is trained on digital images    by supervised machine learning upon the classes defined by the clustering procedure. Obviously, this approach can be implemented with larger sets of data.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.