1 Introduction

Corrosion is a key challenge for improving metallic material’s reliability and life cycle. The selection of alloys and metals for structural components depends largely on the physical and mechanical properties, but their corrosion resistance cannot be ignored [1, 2]. Cobalt-chromium-Molybdenum (CoCrMo) alloy is known for its remarkable corrosion resistance and hardness that is especially utilized in the fabrication of medical equipment [3]. Nevertheless, under certain circumstances, they corrode, for example, when exposed to some water pollutants or the alloy's standard chemical composition has not been met. The knee implant made up of CoCrMo alloy catches corrosion after several years of use. A little corrosion (body fluid typically containing many cations and anions) leads to metal release, prone to alter the body’s metabolism system. Therefore, corrosion control and prediction of CoCrMo alloy is necessary. Over the predicted life span of a metal, its engineering properties can be protected by controlling the corrosion [4]. Prediction and measurement of corrosion is a time-consuming process where traditional mathematical approaches are not enough to forecast such a non-linear process. At present, artificial intelligence is the simple way of analyzing the corrosion behavior in metals or non-metals in which this study intended. Classification and empirical simulation of neural networks (NN) is considered parametric non-linear structures. It may also be viewed as more versatile forms of the standard method of regression. Their versatility allows them to find more general data relationships than conventional mathematical models. Kamrunnahar et al. [5] evaluated the synergetic effects of various parameters that influenced the corrosion rate using supervised neural networks in carbon, Iron, and steel alloy. The authors proved that the developed NN model predicted corrosion rates that were consistent with the experimental sets. In a recent study, Cai et al. [6] applied a hierarchical linear modeling technique to find the effect and growth of corrosion in Zinc, Carbon, and Copper metals under different conditions that resulted in a deviation of ± 30 to 50% over the experimental results for the studied metals. In this research, we focused on the prediction of corrosion and its accuracy against the measured experimental value using Bayesian Regularization-based Artificial Neural Network (BRANN) for CoCrMo alloy.

The standard procedure for estimating the corrosion resistance for non-ferrous metals like CoCrMo alloys is that the material is subjected to electrochemical testing in the presence of 5% NaCl and KCl aqua solutions. From the readings obtained, the testing Tafel plots are drawn; and from the ECorr (Corrosion potential) and ICorr (Corrosion current) values, the corrosion resistance is calculated [7]. Many researchers have tested CoCrMo for the behavior of its corrosion [1,2,3,4,5,6, 11,12,13]. In the CoCrMo alloy, when the samples undergo heat treatment which is an integral part of the corrosion behavior of the alloy, the chromium (Cr) carbides are made. The higher Cr available produces a homogenous passive surface and improves corrosion resistance due to thermal treatment as carbon is dissolved [8]. When subjected to heat treatment, cast high-carbon CoCrMo alloys were analysed and a larger grain border size improved the anodic reaction in all solutions [9]. CoCrMo samples were obtained through additive manufacturing (that is, LENS process), indicates the process parameters (such as scan speed, powder feeding speed, and laser resistance) significantly affect the corrosion resistance [10]. The effect of solution treatment followed by aging was studied on the LENS deposited and weld deposited CoCrMo alloy samples. The researchers found that the solutionized samples without aging exhibited high corrosion resistance compared to others [11, 12]. When deposited with LENS, studies with CoCrW alloys have shown samples made using high laser strength, medium to high powder feed, and medium to high laser scanning speed, which is better for high corrosion resistance [13]. Aneja et al. [14] studied the strength characteristics of geopolymer concrete with the BRANN model under different backpropagation training algorithms and hidden layers. Their results showed that the BRANN model with ten neurons is the best model to predict the strength of geopolymers with an R2 value of 0.99. Recently, Li et al. [15] modeled the corrosion rate of carbon steel using ANN with multilayer perceptron and backpropagation. Their proposed ANN model obtained a maximum absolute relative deviation of 8.66%. Kumari et al. [16] attempted to use the Backpropagation Levenberg Marquardt algorithm to evaluate the corrosion behavior of Titanium substrate. The authors found that the developed ANN model achieved excellent accuracy when compared with experimental results in predicting the open circuit potential and Nyquist plots. Zulkifli et al. [17] analysed the corrosion rate of Aluminium Alloy 5083 using Multilayer Perceptron model with Scale conjugate gradient, Bayesian Regularization (BR) and Levenberg-Marquadt (LM) algorithms. LM is the best training algorithm for corrosion rate prediction of the studied Aluminium Alloy, with a high correlation coefficient score (R2 = 0.992), among the three training algorithms.

All the above experiment results have identified the best among the samples tested but not the best as a whole (i.e., the behavior for the process parameters that were not considered was not identified). The Artificial Neural Network (ANN) approach helps us predict corrosion resistance through interpolation or extrapolation. The tensile strength and strain hardening exponent of Austenitic Stainless Steel 304 at elevated temperatures were predicted by the researchers using a genetic algorithm and achieved good results [18]. In order to predict the corrosion behavior of samples made with 3D and pressure-less microwave sintered, a mathematical model was developed of porous iron scaffolds. With experimental findings, the built model was validated, where the authors found a maximum prediction value of a 6.97% error [19]. Bayesian Theory of Regularization provides a unifying data processing structure, with some advantages such as overfitting solvation, unique marginalization, and can be used for defining a sophisticated probabilistic model [20, 21]. In a different study, a model was built by Krivy et al. using a probabilistic approach to predict the corrosion losses due to environmental conditions such as relevant annual temperature (T) values, sulphur dioxide concentration (SO2), relative air humidity (RH), chloride deposition (Cl). Authors proved that the effect of environmental characteristics on corrosive processes could be analyzed via a probabilistic approach [22]. The residual lifetime of a pipeline has been estimated considering the corrosion's effect using mathematical modelling [23]. Fe/Cu type galvanometer sensor was used to predict the corrosion effect for 34 days, and the researchers could achieve better results through the support vector regression model [24]. Current prediction models for additive processed alloys are either complicated or built on a limited basis. As a result, in this research, BRANN's approach is preferred to create a prediction model that is compatible with the experimental data and makes optimum forecasts with models.

The present work was focused on developing a robust BRANN model to predict the corrosion behavior of CoCrMo subjected to heat treatment. The results show a good match between experimental and numerical results, which enable reducing the number of experimental trials and cost saving considerably. Further, this work can be used successfully for predicting the corrosion features of the most adopted additive manufactured CoCrMo alloys used in various human implants.

2 Methods and Materials

The experimentation is carried out in two stages. One is to conduct the samples' physical testing fabrication using specific parameters. The second stage is to run the BRANN model to predict the same for the change in parameters.

2.1 Physical Method

The CoCrMo alloy samples are processed using an Additive Manufacturing process, i.e., LENS, using gas atomized spherical powder (size 40-150 μm) to provide a supply of CoCrMo alloy content. The sample input parameters are powder rate (5 g/min), laser power (350 W), and laser scanning rate (20 mm/s), as shown in Table 1. Generally, the heat treatment on metals is carried out to enhance the hardness and other mechanical properties by heating the samples to above the recrystallization temperature, holding at the same for specified time and then cooling within air/furnace/by means of water/oil. Sudden cooling with water or oil (Solution treatment) improves hardness but to ensure the uniformity in the grains the solution treatment is followed by ageing which comprises of heating holding and cooling in furnace (slow cooling).The ageing temperature, solution and ageing times and are used as process parameters following L9 Orthogonal arrays, ensuring constancy of solving temperature (1200 °C).

Table 1 L9 Orthogonal Array of heat treatment of the CoCrMo samples

Figure 1 depicts the as-prepared sample via the LENS deposition method. All the samples are tested for their corrosion resistance using electrochemical analysis, and at least 3000 readings were collected for each sample. The data of electrochemical measurements have been used to build the proposed NN model.

Fig. 1
figure 1

Apparatus for corrosion test of LENS deposited sample

2.2 Computational Method

The experimental data gathered from previous literature work was analyzed. The inputs and outputs needed for the overall process of the ANN approach were selected accordingly. The cumulative experimental data to train, test, and validate processes were split into 60%, 20%, and 20% data sets, respectively. The proposed model was developed using MATLAB 2020 b, which is the leading mathematical software. MATLAB is a programming environment for algorithm creation, interpretation of data, modelling, and numerical computing and is widely used by engineers and researchers. The ANN was trained based on Bayesian Regularization (BR) algorithm. The purpose for selecting BR-based ANNs is—they can handle many complex datasets and can differentiate between dependent and independent variables in complex, non-linear connections. Once input and relations are known, invisible data often assess the unseen relationships in order to generalize and predict the model with unseen data. This type of technique's benefit is the capability of robustness than usual back-propagation networks and can decrease or remove the necessity for long cross-validation. Here, a neuron has a role in adding each source neuron's value in the previous column with which it is connected. Until applying this factor, the relation between the two neurons is recorded by an additional element called “weight” (w1, w2, w3). The only value that can be modified during the learning cycle was the neurons' weight at each connection. The weight values strongly play an important role in determining the output for the given input values [25]. The weights values are multiplied with input values and added with a bias to obtain the least possible error as per Eq. 1 [26]. Furthermore, the calculated total value will be added with a bias value. Finally, the neuron applies a function named “activation function” to the obtained values after all these summations. The process of these calculations with a computational rule can be seen in Fig. 2.

$$ x_{{new}} = wx + b $$
(1)
Fig. 2
figure 2

Perceptron computational rule

where,\({x}_{new}\) is new value, w is weight, and b is bias.

The coefficient of determination (R2) and mean square error (MSE) values were calculated as per Eq. 1 and 2 during the training process of Bayesian Regularization-based Artificial Neural Network (BRANN).

$$ R^{2} = 1 - \mathop \sum \limits_{{i = 1}}^{n} \left[ {\frac{{\left( {y_{p}^{i} - y_{a}^{i} } \right)^{2} }}{{(y_{{avg,a}} - y._{a}^{i} )^{2} }}} \right] $$
(2)
$$ MSE = \frac{1}{n}\sum \left( {y_{p}^{i} - y_{a}^{i} } \right)^{2} $$
(3)

where n is the no. of sample values, yp, ya and yavg are predicted, actual and average of actual values.

The models were eventually tested and validated with separated data sets. In order to further assess the new analysis, the conclusions presented for BRANN are then applied to previously conducted work. The entire workflow suggested for this analysis is presented in Fig. 3.

Fig. 3
figure 3

Workflow of BRANN approach

During the development of BRANN, the parameters such as solution time, aging time, aging temperature, and corrosion test time are considered as inputs, whereas the Ln (corrosion rate) and Ewe (stationary potential measurement for corrosion) are considered as outputs. Figure 4 represents the traditional BRANN architecture. The first layer is made of input parameters, the hidden layer is made of hidden neurons and the outgoing layers are made up of Ln and Ewe.

Fig. 4
figure 4

BRANN typical architecture

3 Results and Discussion

The findings of the LENS deposited, as well as the heat-treated CoCrMo samples, have been explained in the following section. Tafel plots have been taken as the basis to analyse both cases.

3.1 Potentiodynamic Curves

The potentiodynamic curves or Tafel plots of the samples S1 to S9, subjected to corrosion test, are shown in Fig. 5. On analysing the plots and the corresponding Corrosion current and potential, it was observed that all the samples had exhibited good corrosion resistance and all the samples have undergone pitting type of corrosion. Still, the sample S7, which was solutionized for 3600 s and atmospherically aged for 21,600 s, has shown the maximum corrosion resistance among the samples verified. Figure 5 shows the comparison of sample 7, before and after corrosion. However, the reasons for the same were already discussed elsewhere [27] by one of the authors. Now, the main focus of this study is on predicting corrosion behavior with other temperatures and times.

Fig. 5
figure 5

Comparison of Co-Cr–Mo sample S7 a before and b after Electrochemical test

3.2 Training of BRANN

The BRANN proposed is trained under the BR algorithm across a training range of inputs and outputs. For noisy datasets, this algorithm typically takes longer but can be generalised easily. It minimalizes a combination of square errors and weights and chooses to create a well-generalized network for the right combination. BR limits to a minimum the sum of square errors and weights. The linear combination is often balanced to ensure good overall values until training is finished. The ‘purlin’ and ‘tansig’ activation functions are used to determine the layer output from the network data. The ‘purelin’ and ‘tansig’ relationships are established in Eqs. 4 and 5. The variations in MSE and R2 values are recorded in train and test stages during the BRANN training process. The summary of all the MSE and R2 values recorded for all the samples is illustrated in Table 2. The representation of activation functions used in the training of BRANN is shown in Fig. 6.

$$ {\text{tansig}}\left( n \right) = \frac{2}{{1 + e - 2n}} - 1 $$
(4)
$$ {\text{Purlin }}({\text{n}}) = {\text{f}}\left( {\text{n}} \right) = {\text{n}} $$
(5)
Table 2 MSE and R2 values recorded during training of BRANN
Fig. 6
figure 6

Activation functions used during training

During the training process, the divided training dataset from the experimental data were used. The R2 values during the training process for all the nine samples, S1, S2, S3, S4, S5, S6, S7, S7, S8, and S9, are found to be satisfactory, with the values of 0.999 each. The R2 values obtained in the training stage are illustrated in Table 2. The summary of all the training R squared plots of all nine samples is shown in Fig. 7.

Fig. 7
figure 7

R squared plots in training stage for all the CoCrMo sample (S1 to S9)

The number of data sets values for each sample is equal during the training phase of a model. However, data are divided into identical proportions for the development of the model, with a ratio of 60%, 20% and 20% for training, testing, and validation stages, respectively. In the training process, the BRANN was developed for all samples using 1800 values. Figure 8S1-S9 demonstrates the training results for the BRANN proposed for each sample. Figure 8 shows that the qualified BR-based ANN is best conducted to predict real data sample values. Thus, the findings obtained indicate that the suggested approach created the least output error.

Fig. 8
figure 8

Training Performance for all the Co-Cr–Mo sample (S1 to S9)

3.3 Testing of BRANN

Upon completing the training process, the performance of the proposed BRANN is tested using the divided testing dataset. The R2 values during testing were satisfactory with the values of 0.999 for all nine samples S1—S9, respectively. The R2 values obtained in the training stage are presented in Table 2. The summary of all the testing R squared plots of all nine samples is shown in Fig. 9.

Fig. 9
figure 9

R squared plots in the Testing stage for all the Co-Cr–Mo samples (S1 to S9)

In a model’s testing process, the number of data sets values for each sample is equivalent. For all samples, the BRANN was established using 600 values during the testing process. The testing stage's performance for the suggested BRANN for each sample is shown in Fig. 10S1-S9. The simplest way to estimate actual data sample values is to use the professional BR-based ANN. The testing results thus demonstrate that the proposed solution produced the least performance error.

Fig. 10
figure 10

Testing performance for all the Co-Cr–Mo sample (S1 to S9)

3.4 Validation of BRANN

For certain random unseen values, the BRANN approach has predicted the new values truthfully. The forecasts made for all 9 samples are shown in Fig. 11S1-S9. The shifts from sample to sample can be seen. But for this experimental unsightly data collection, the proposed BRANN model estimated the new values correctly. For all the 9 samples, 25 random sets of values from the validation dataset are introduced to BRANN for predicting the outputs. It is found that the prediction has been made accurately for Ln and Ewe with a validation accuracy of 98.82 and 98.89, respectively. However, it is observed that there are some variations in error in predicting Ln and Ewe from sample to sample. Thus, the validated results demonstrate that the proposed study produced a reasonable agreement of actual dataset values against the predicted values, as shown in Fig. 11. The plot indicates the model made accurate predictions for both Ln and Ewe for given sample values. The summary of prediction accuracies for all the 9 samples is given in Table 3.

Fig. 11
figure 11

Actual and predicted values for corrosion behavior of LENS deposited samples (S1 to S9)

Table 3 Prediction accuracy for all the samples

3.5 Comparison Study

A comparison study is made after conducting experiments with BRANN to predict the corrosion behavior of CoCrMo alloy. As stated earlier in this article, few researchers have used different tools to predict different metals’ prediction behavior. A few previous articles were selected for the comparison, and the findings are shown in Table 4. The findings revealed that the existing model succeeded previous works during the comparative study, supporting robustness.

Table 4 Comparison of the corrosion predictions

4 Summary and Future Prospective

Bayesian Regularization-based Artificial Neural Network approach was proved as a corrosion prediction tool for additive manufacturing of CoCrMo Alloy. The results obtained during the training process are very satisfactory based on the R2 values for all nine samples (S1-S9). The proposed ANN provided accurate results with R2 values close to 1.0 for the given divided testing data set. Upon completing training and testing stages, the results obtained during the validation process also performed well as the error in predicting the target values is minor, with an overall prediction accuracy of 99%. Therefore, it is possible to predict with accuracy the behavior of the implant against corrosion rate, and the stationary potential can be detected successfully. The BRANN model demonstrated its robustness which can be used as a preferable tool for accurate prediction of various properties of LENS product. In otherwords, in anticipating the corrosion behavior of the CoCrMo deposited LENS, the BRANN model has an active functional significance and can in practice help the engineers in future to compare the corrosion efficiency. However, the dataset can be improved by increasing the number of training samples, a wider extent of parameters, in order to maximize the capacity for generalization. In the future, we plan more investigation on the BRANN approach considering different critical implants made of additive manufactured structural and functional materials.