1. Introduction
The last few decades have brought significant advancements in the field of nanotechnology at various levels. Several areas of research have greatly benefited from these improvements, with the study of materials at their nanoscale being substantially leveraged. Atomic force microscopy (AFM) is one of the main techniques responsible for these studies [
1]. Urging from the need for visualizing and manipulating materials at their lower scale, this method was established in the late 20th century, following the concept of scanning probe microscopy [
2]. It is based on a small probe, usually consisting of a cantilever with a tip that can have several geometries attached to its end. From the interaction of the probe with the sampled surface, whether involving contact or not, the target properties can be inferred [
3,
4,
5]. Despite being a well-established method, there are still some challenges associated with AFM, particularly those arising from the contact between probe and sample. It has been shown that uncontrolled forces in constant-height contact mode can be reduced by magnetic actuation [
6], while difficulties in determining the shape of the tip can be overcome using blind tip reconstruction methods [
7,
8]. Correctly identifying the contact point also remains one of the main challenges in AFM, prompting the development of diverse methods to refine this process [
9,
10].
High-resolution and three-dimensional images of the surface topography at the nanoscale can be generated by measuring the topographic height through the probe-sample interaction [
11]. The height measurements not only allow for the reproduction of such images but they are also the basis for obtaining the roughness and other surface characterization parameters [
12]. Furthermore, due to its wide range of operating modes, one can obtain nanomechanical properties that contribute to understanding the behaviour of materials at increasingly smaller scales. This is the case of AFM nanoindentations, which consist in approaching the probe towards the sample and indenting it for a defined threshold, followed by withdrawing the probe until it detaches from the sample or reaches its original position.
Along this ramp cycle, the deflection of the probe cantilever is recorded as a function of the probe’s displacement, which can later be translated into force–indentation (F-I) curves. By fitting these curves with appropriate contact models, the target material properties are finally obtained. Furthermore, if there is knowledge about the location in the sample where each F-I curve was obtained, it is possible to create surface maps for each measured property [
13,
14,
15].
Regarding approach curves, they play a crucial role in inferring the elastic modulus of the sample and can be fitted with the models developed by Hertz [
16] or Sneddon [
17]. On the other hand, retraction data offer essential insights on its adhesion properties [
18,
19,
20], which are particularly relevant in low-stiffness materials, such as biological cells, where they play a major role in processes such as cell proliferation and migration, and sudden changes in these properties can lead to diseases such as cancer [
21,
22] or osteoporosis [
23,
24]. Since during the retraction stage, adhesion forces between both surfaces are predicted to have a higher impact in the experiments, an Hertzian-based analysis is no longer precise enough, so other models must be employed. Amongst them are JKR (Johnson–Kendall–Roberts) and DMT (Derjaguin–Muller–Toporov) [
25,
26], which represent two extreme cases in adhesive interaction: while DMT is valid for hard samples, large tip radius and low adhesion forces, JKR meets the specific features of this work, since it is applicable for soft samples, small tip radius and high adhesion forces [
27].
Another field that has witnessed remarkable advancements in recent times is artificial intelligence (AI) and its subset of machine learning (ML), taking advantage of the exponential increase in computational power. Being able to adapt to different sorts of data allows ML to be applied across various fields, from medicine and engineering to finance or marketing. So, it only makes sense that it can also be used to boost techniques such as AFM, mainly in the postprocessing stage.
Although contact mechanics models have proven to be great tools for the study of surface properties from AFM nanoindentations, particularly in the domain of soft biological tissues, this traditional approach can be a time-consuming task. Hence, new strategies have been explored to overcome this limitation. Physics-informed ML models represent an alternative capable of taking advantage of contact mechanics theories to guide their development. By splitting AFM F-I curves in their two ramp cycle stages—approach and withdraw—and selecting an appropriate contact theory for each, it is expected that the synthetically generated data will have a fair resemblance of experimental curves. Another drawback associated with many contact models is their assumption of linear elastic behaviour. This limitation can also be addressed by employing ML models, which can easily capture material nonlinearity.
In recent years, several works have introduced different approaches that utilize ML methods to assist in diverse types of AFM analyses. A ML approach based on artificial neural networks (ANNs) is used in [
28] to classify bladder cancer cells into different grades, based on cellular mechanical properties obtained with AFM. For an application more related to AFM intrinsic properties, Convolutional neural network (CNN) models have been developed to determine the tip sharpness directly from indentation images [
29]. A different study [
30] has presented a quasi-recurrent neural network to identify the coupling of vibrating modes in dynamic AFM (intermittent contact between probe and sample). At last, ML regression models were used to predict the elastic modulus based on nanoindentation curves, without having to fit them with a contact model, in the work presented in [
31], where the ML models were trained with experimental F-I curves from AFM analyses. This last work shares some similarities with the current project, in the sense that they both focus on determining the sample’s stiffness without contact model fitting. Nevertheless, the work in [
31] does not cover the development of deep learning strategies and it requires experimental data to train the models, unlike the current framework.
Despite the several ML applications in the AFM field, there is not yet a deep learning-based approach to determine surface properties related to the elastic modulus and to the sample’s adhesion, from both the approach and retraction curves, without requiring the model to be trained on actual data from AFM experiments. This study aims to address this gap by examining the effectiveness of a similar method. This is performed by training the models only on synthetically generated data and then analysing if they can accurately predict surface properties from AFM-studied samples.
2. Methods
2.1. Hertzian and JKR Contact Models
Foundations of contact mechanics can be traced back to the work of Hertz [
16], where the contact between two perfectly elastic solids or surfaces was described, disregarding friction or adhesion. Considering two spherical bodies, the force obtained from such contact was derived as
where
accounts for the radii of curvature of both solids and
is the contact displacement, corresponding to the indentation value in AFM studies. The effective modulus
is defined with the elastic modulus (
E) and Poisson ratio (
) of each solid:
In the case of AFM nanoindentations with a spherical tip (), the sample can be often regarded as an elastic half-space (), so the radius of curvature is simplified to . When the sample is a soft biological tissue, the tip may be treated as a rigid body, such that the effective modulus will only depend on the sample’s properties ( and ): .
Many works [
17,
32,
33,
34,
35] have been developed to achieve an accurate relation between applied force and indentation depth, supported on Hertzian principles, for a wide range of AFM tip shapes. Despite other accurate approaches for determining this relation, a closed-form solution will be implemented, based on applying a correction factor to Expression (
1):
with
Z, as suggested in [
36], being approximated by
These relations will allow for the generation of curves for the approach stage of AFM nanoindentations, just by defining the tip radius and material properties for each sample. Regarding the withdraw stage, JKR contact theory translates the effect of adhesion energy
(in units of energy per area) upon adhesion force and contact size, reaching the following expression for the normal force of contact:
in which
and
stands for the contact radius, which is a function of indentation depth and normal force itself, so it does not provide an explicit formulation relating force and indentation. One way to tackle this problem is by approximating the contact radius as
[
37], so that a simpler closed-form solution is obtained:
where
. Accordingly, to obtain F-I withdraw curves, the tip radius must be defined, in addition to the material properties, comprising the Poisson ratio, Young’s modulus and adhesion energy.
2.2. AFM Experimental Data
Surface properties of a given sample can be extracted through the analysis of AFM nanoindentation data. In this work, the Young’s modulus and adhesion energy will be the main focus. To transform raw AFM data into force–indentation (F-I) curves, specific procedural steps must be followed. As depicted in
Figure 1, while the probe approaches and withdraws from the sample, a photodetector records the voltage as a function of piezo position,
(vertical displacement of the cantilever).
By knowing the system sensitivity, the voltage can be translated into cantilever displacement,
. The tip-sample force is calculated with the cantilever stiffness,
k, applying Hooke’s law:
The indentation depth,
, relates to the cantilever deflection,
position and the piezo position at contact point,
, by
We used available experimental AFM F-I data from primary non-epithelial vaginal cells, isolated from vaginal tissue harvested below the cervix from nulliparous LOXL1 knockout and wild-type mice (refer to [
38] for detailed methodology). For all approach curves, the corresponding Young’s modulus (apparent elastic modulus) had been obtained by Hertz contact model fitting. As for retraction curves, no surface properties were accessible from them, leading to the exclusive use of approach data for testing the developed machine learning models.
The accuracy of each fitting from the original approach curve dataset was evaluated using the
metric (
) to compare the experimental force,
, with the predicted force by the contact model,
, for each indentation value. Instances with an
were removed from the analysis, due to their likelihood of exhibiting experimental anomalies or simply not being suitable to be fitted with Hertzian theory. Some of these instances presented negative forces for high indentation values, while others even presented an unphysical negative Young’s modulus resulting from the fitting procedure. Then, all the curves with a maximum indentation lower than 150 nm (the maximum indentation defined for our synthetic dataset) were dropped and force–indentation points were uniformly removed from each curve until they reached a final value of 50 points, thus enabling their application as inputs for the ML models. Following these restrictions, a total of
curves were obtained, with the apparent elastic modulus distribution being presented in
Figure 2a, while examples of individual F-I curves are shown in
Figure 2b.
2.3. Synthetic Nanoindentation Curves
Before starting the development of a machine learning model, a suitable synthetic dataset must be defined, representing the underlying patterns of a real dataset obtained from experimental AFM nanoindentations in soft biological samples, for both approach and retraction stages. Hertzian theory-based Equation (
3) was the foundation to compute the force for the approach stage, while Equation (
6) was used for the withdraw phase. It is thus important to define what the fundamental variables are that will affect the forces for each step (
and
), so it can be written that
and
Therefore, all these variables must be defined to reach the final curves. The Poisson ratio and the tip radius will be the same for all instances, while the other parameters are unique for a specific curve. Thus, each indentation vector will have material parameters assigned to it, and jointly with R and will allow tone to compute the force for all indentation values in the vector. Knowing the force and indentation for each point, the curves can be obtained.
Starting with the Poisson ratio, as the targets of this model are soft tissues, they can be approximated as incompressible due to their high water content [
39], so a Poisson ratio of 0.5 was assigned. The tip radius value, presented in
Table 1, was chosen according to the probe that was used to produce the experimental nanoindentations [
38] that will be later used to test the developed models, and it is within a common range of values for spherical tip radii.
Regarding indentation depth vectors, their length and the maximum indentation value must be defined, so that the inputs to the ML models are consistent. Only the contact region () was considered, since negative indentation values do not yield any information on surface properties according to the contact models chosen.
In order for the indentation vectors to resemble real data more closely and to have a greater impact on the ML models, they cannot all be composed of the same evenly spaced indentation values, so different instances are associated to different indentation values, always keeping the maximum indentation at 150 nm.
After specifying the Poisson ratio, tip radius and a set of displacement vectors, the only remaining parameters are the material properties
E and
, which must also be comprised in a typical range of values for soft tissues. This work focuses on studying a specific subset of soft tissues, with surface properties compatible with the available experimental data. However, if a broader range of materials was being analysed, standardizing the units of the physical quantities could potentially be helpful to improve the model’s behaviour. For the Young’s modulus, its values commonly fluctuate between the orders of magnitude of
to
kPa, reaching the hundreds of kPa in more specific scenarios [
27,
40,
41,
42]. Taking also into account the Young’s moduli of the samples in the experimental data available, a minimum
E of 0.2 kPa and a maximum of 10 kPa were fixed, using a triangular distribution function with the mode as 1.8 kPa, so that the ML models could be trained more thoroughly on the most frequent range of values for the Young’s modulus of biological cells or hydrogels.
On the other hand, the same dataset does not contain any information about adhesion energy, since the available retraction curves are scarce and the corresponding samples did not necessarily exhibit strong adhesion properties. Hence, its range of values was searched in existing literature regarding biological samples [
18,
43,
44,
45]. The values found go from a few
J/m
2 to dozens of mJ/m
2, making it difficult to establish a shorter interval. In addition, the samples in the available experimental dataset did not necessarily all have adhesive properties with high values, as the ones in the works mentioned. Thus, we sought to obtain a range of values that would somehow illustrate the relationship between the approach and retraction curves, considering the Young’s moduli range found in the dataset. Hence, this parameter was studied with an uniform distribution in a lower range of 1–3
J/m
2.
Figure 3 summarizes the relation between approach and retraction curves of the synthetic dataset.
At last, the dataset size must be carefully chosen. This will play a critical role in the development of our models, as insufficient data can lead to poor model performance and overfitting. In contrast, if the dataset is too extensive, its computational complexity increases, leading to much higher training times. In addition, there is also the chance of the model overfitting to noise in the data. In common ML applications, the number of instances in a dataset usually goes from a few thousand to hundreds of thousands, and it is no different when applied to AFM frameworks [
31,
46]. Thus, to ensure a robust initial model without excessively compromising computational costs, an initial dataset consisting of
curves was created.
2.4. Development of the Fully Connected Neural Networks
Given the absence of a definitive indication on whether analysing these curves demands a craftier model architecture, fully connected neural networks (FCNNs) were employed, with all the hyperparameters having undergone a thorough optimization process. Two deep learning models were developed: the first aiming to predict the Young’s modulus based on the approach stage of AFM F-I curves, and the second one taking the retraction curves as inputs and forecasting both the Young’s modulus and adhesion energy parameters. Hence, each model receives 100 inputs, corresponding to the indentation and force values for the 50 points in each curve. These models are referred to as the Hertz FCNN (one output—
E) and JKR FCNN (two outputs—
E and
), respectively, aligning with the contact theories employed in generating the respective training data. PyTorch 2.0 [
47] was used to implement and run the models.
Despite the models being trained and evaluated based on loss functions, to obtain a better understanding of the scale of the loss values and their real meaning in the comparison of predicted () and actual () surface properties, the mean absolute percentage error will be employed, with being the percentage error for each instance: .
Baseline hyperparameter configurations were set for both Hertz and JKR FCNNs, and a subsequent hyperparameter tuning process was conducted using Optuna [
48], a Python package that expedites this procedure by leveraging the performance history during the training process. Prior to this implementation, a brief study involved exploring diverse combinations of loss and activation functions. The evaluation encompassed potential loss functions as mean squared error (MSE), mean absolute error (MAE) and Huber loss, alongside an exploration of activation functions, including ReLU and leaky ReLU.
Further optimization required the use of Optuna, with the adopted workflow being schematised in
Figure 4. Each hyperparameter analysis in this package is referred to as a “study”, composed of a predefined number of trials. Within each trial, it is first necessary to choose the range of hyperparameters under analysis and to set an objective function, which in this case is to minimize the validation loss. A pruning-based approach was implemented, so that unpromising trials would be discontinued, based on the median validation loss of the previous trials at a given epoch.
In addition to the models’ width and depth, the learning rate, number of epochs, optimizer and batch size were the hyperparameters tuned. A study on the batch size is represented in
Figure 5a, clearly indicating that a batch size of 16 is a better fit for training the model, as the lower losses were achieved with that value, in addition to a lower median loss across all trials. Four optimization stages were executed for each model. After a preliminary model evaluation in which the search region for each hyperparameter was refined, we evaluated the overall architecture and defined the model’s width.
Figure 5b illustrates a study focusing on the final layer of the Hertz FCNN, with 16 and 32 neurons being the most frequent values chosen in the provided search region. Despite the loss median being slightly higher for 16 neurons, using 32 neurons in this layer generated at least 4 trials with a lower loss than the other configuration, hence being more likely to reach a better local minimum. At last, the most suitable learning rate was determined.
From the complete synthetic dataset (N = 40,000), 15% of the curves were reserved for testing, while the remaining dataset was evenly divided into six folds for cross-validation, where each fold was consecutively used for validation, while the remaining were employed for training. All the splits, including the one for the synthetic test set, factored in the stratification of the target variables (surface properties E and ). Throughout the following section, the MAPE () and the percentage error () were commonly used as evaluation metrics.
3. Results and Discussion
The final hyperparameters and model architecture obtained through the optimization process are presented in
Table 2. Regarding the evaluation metric of the models, despite being easy to understand what is the impact of a certain relative error in the values of both target properties, it is not that intuitive to realize what its consequences are in an AFM F-I approach curve. To bridge this gap, regarding the Hertz FCNN, graphs presented in
Figure 6a,b depict a comparison between the actual synthetic curves and the curves that would be produced with the predicted stiffness for that instance, obtained for different models developed along this work, with relative errors of
,
and higher than
. For the JKR FCNN, it is also important to infer if one of the material parameters has a higher influence than the other.
Figure 6c,d show that for the same F-I curves with similar relative error values for the Young’s modulus and adhesion energy, the first parameter has a higher impact on the predicted curves; hence, if we would have to prioritize the improvement on the prediction of one property, it would be the Young’s modulus.
3.1. Hertz Regressor
For each of the six data splits in the cross-validation procedure for the Hertz FCNN, optimal models were selected based on validation error and subsequently evaluated on both synthetic and experimental test sets.
Figure 7 illustrates the distribution of percentage error values for the best model in each split. As expected, due to the strong affinity between testing and training data, predictions exhibit notably higher accuracy in synthetic data, with an average percentage error of
. This outcome aligns with expectations, considering that synthetic data closely mirrors the instances on which the models were trained. Nevertheless, the results obtained on experimental test sets are also noteworthy, indicating the potential for predicting surface properties from nanoindentation curves obtained in real-world scenarios. The mean percentage error across all splits is
, emphasizing the capability of models trained and validated without the inclusion of real data inputs. This underscores the effectiveness of the proposed approach in predicting surface properties using only synthetic data during the model training and validation phases.
It is worth noting that the model exhibiting the lowest accuracy on synthetic data among the six evaluated models (model from Split 1: and ) also demonstrated the poorest performance on real curves. This observation suggests an alignment between the accuracy on synthetic and experimental data. However, this correlation is not consistently observed across all splits. For the remaining splits, where the MAPE for synthetic curves consistently remained below 1%, no clear relationship emerged. Despite achieving high accuracy on synthetic data, variations in the accuracy of experimental predictions were observed in both positive and negative directions. This means that while a model’s accuracy on synthetic data may offer some insights, it does not consistently guarantee a good performance on experimental data across all scenarios, as the complex nature of the experiments may introduce additional factors influencing predictive outcomes, such as AFM artifacts, often related to parameters as the probe shape and laser interference, or even the nonlinear nature of the sample at the indentation depth being studied.
To obtain a better insight into the predictions made by our models,
Figure 8 provides a detailed description of the results obtained with the best model on experimental data (from Split 3,
). For synthetic data, the predicted Young’s modulus values closely align with their true labels across the entire domain studied (
Figure 8a). This results in 93.5% of the curves in the synthetic test set being predicted with a percentage error below 2.5%, with 66.2% of the instances exhibiting an error lower than 1% (
Figure 8c). These highly accurate predictions confirm that the simple FCNN architecture adopted for the ML model development is well-suited for the problem at hand. While not reaching the precision observed in synthetic data, experimental predictions remain closely aligned with the real values. There is a slight tendency to overestimate the elastic modulus for curves with
kPa (
Figure 8b). Employing the chosen model, 85.9% of the 24,304 experimental nanoindentation curves were predicted with an error lower than 10% (
Figure 8d).
3.2. JKR Regressor
Due to the absence of fitted experimental retraction curves, the evaluation of JKR FCNNs was confined to synthetic data.
Figure 9 illustrates the error distribution for the best model in each of the six splits, focusing on surface properties
E and
. A notable observation is that predictions of Young’s modulus were consistently more accurate than those of adhesion energy across all splits. However, both parameters exhibited highly satisfactory results, achieving average errors of
and
across all folds. The selected architecture and optimized hyperparameters contributed to a uniform performance across all splits and for both material parameters. The exception was Split 6, where error values were notably higher compared to the remaining splits, yet still within the range of acceptable predictions.
Once again, we delve into a detailed analysis of the predictions made by our best model, as elucidated in
Figure 10. This time, the selected model strikes a balance between the predictive capabilities for the two surface properties. We specifically opted for the model from the fifth split, which exhibited the most favourable results for the stiffness variable (
). Although this model ranks second in predicting adhesion energy (
compared to
in the model from Split 3), the substantial difference in Young’s modulus prediction errors (
) justifies the preference for the model from Split 5. The predictions of the selected model for both material parameters indicate that, for Young’s modulus, they closely align with the true values across the entire domain. In contrast, the accuracy for adhesion energy is comparatively lower, with the number of observations deviating from ideal predictions increasing with the rise in
(see
Figure 10a,b).
Taking as a reference a residual error of 2.5% in surface properties, which holds little significance in the comparison between real curves and those obtained with predicted outputs, we observe that 97.9% of synthetic test set curves had an elastic modulus prediction below that threshold. However, this value decreases to 86.5% for adhesion energy predictions (see
Figure 10c,d).
3.3. Discussion
The results presented for the Hertz FCNN validate its application in the postprocessing of AFM nanoindentation data of soft tissues. These findings are particularly significant, as certain curves may exhibit irregular shapes or be unsuitable for fitting with Hertzian mechanics due to their nonlinear nature or potential influence from AFM artifacts. Moreover, the FCNN provides predictions for indentation ranges up to 150 nm, surpassing the typical threshold analysed in classic model fitting approaches. Given that the models were trained on instances with a shared maximum indentation depth, their performance on curves with smaller indentations will not match the presented results. Nonetheless, a similar approach could be applied to train models using curves with varying indentation ranges. This would necessitate a substantially larger dataset to establish a robust and precise framework.
Regarding the JKR regressor, not having any experimental data to verify the behaviour of these models in a real application is certainly a downsize, which leaves space to question if they would be able to generalize to experimental curves. Nonetheless, it has been shown that a deep learning approach is able to easily capture the shape of a force–indentation curve generated through JKR theory. By ensuring that these synthetic curves are good representations of nanoindentation retraction curves, this all indicates that this is a promising framework to study the adhesion energy of a wide range of samples, whose research is much more scarce than that of the elastic modulus.
Despite the significance of the results presented, there remains considerable potential for further exploration in employing ML models to the field of AFM. Throughout this work, synthetic instances consistently shared the same tip radius and Poisson ratio. Nevertheless, these parameters could also be included as output variables, enabling models to be applicable across a broader range of experiments. To accommodate these variables, new models would need to incorporate them into the list of instance labels alongside the surface properties. Another challenge in AFM involves precisely identifying contact and detachment points. While an ML-based approach could be promising for addressing these difficulties, an effective model training may require experimental data with the location of these points precisely identified.
4. Conclusions
Throughout this work, two FCNN models were designed from scratch, with the goal of predicting the Young’s modulus and adhesion energy from AFM nanoindentation curves. These models were trained exclusively from synthetic F-I curves, previously generated using Hertz and JKR contact theories. As a proof of concept, such F-I generation was made in the domain of our available experimental data. A fine hyperparameter optimization technique was then applied to select the best model.
To evaluate the models’ performance, cross-validation was conducted for the optimized Hertz and JKR FCNN architectures. For every split, we assessed the model with the minimum validation error on both synthetic and experimental (limited to the Hertz FCNN) test sets. Concerning the Hertz FCNN, designed to predict the Young’s modulus from AFM nanoindentation approach curves, we achieved a mean absolute percentage error (MAPE) of 0.67% for the synthetic set and 6.14% for the experimental set, considering all the splits. As for the JKR FCNN, its assessment relied exclusively on synthetic data due to the unavailability of experimental curves. The model was designed to predict both elastic modulus and adhesion energy from AFM nanoindentation retraction curves, and it effectively fulfilled its objective, yielding low mean absolute percentage error values for both surface properties: and . However, its future validation on real data is still required, such as future adjustments on how to define the detachment point on retraction curves creation to increase their affinity with experimental curves.
This study showcases the potential of improving the postprocessing of AFM nanoindentation curves through the application of straightforward deep learning architectures, dismissing the need for experimental data in model training. Exploring similar methodologies could be relevant to other AFM-related problems, such as determining the location of the contact and detachment points or generalizing the current framework for a wider spectrum of tip radii.