XGBoost automates the characterisation of reversibly actuating planar-ow-casted NiTi shape memory alloy foil

Nickel-Titanium (NiTi) shape memory alloys (SMAs) are smart materials able to recover their original shape under thermal stimulus. Near-net-shape NiTi SMA foils of 2 meters in length and width of 30 mm have been successfully produced by a planar ow casting facility at CSIRO, opening possibilities of wider applications of SMA foils. The study also focuses on establishing a fully automated experimental system for the characterisation of their reversible actuation, signicantly improving SMA foils adaptation into real applications. Articial Intelligence involving Computer Vision and Machine Learning based methods were successfully employed in the development of the automation SMA characterisation process. The study nds that an Extreme Gradient Boosting (XGBoost) Regression model based predictive system experimented with over 175,000 video samples could achieve 99% overall prediction accuracy. Generalisation capability of the proposed system makes a signicant contribution towards the ecient optimisation of the material design to produce high quality 30 mm SMA foils.


Introduction
These shape-memory special behaviours of NiTi SMAs are due to the martensitic-to-austenitic transformation and its reversion, which can be activated by increasing and decreasing its temperature, respectively. NiTi SMAs, mainly in wire, rod and plate forms, have demonstrated its actuation ability as well as other attributes, such as a high corrosion resistance, wear resistance, speci c electric resistance, good fatigue properties, and biocompatibility [1]. However, these forms have been tested in a limited number of industrial applications, that neither have restraints on size and volume, nor require a fast, reversible and precision actuation. In all the SMA applications being explored in various areas, e.g., space technology [2], automotive [3], sensing and actuating [4], and biomedical devices [5,6], the use of Ni-Ti SMAs in miniaturised sensors and actuators attracts great interests. Building a microsystem with the integration of moving mechanisms, sensors and electronics, demands further miniaturization of sensing and actuating devices [7].
Thin SMA foils have many advantages over the SMA wire, rod or plate, namely, the ability to generate a large actuation force, respond faster to thermal stimulus, compact, and low cost, which could be used in the eld of miniaturised actuators and thermo-sensor devices. A NiTi SMA component of a small dimension fabricated from the SMA foil can react fast with a predetermined response, when encountering a temperature change, making it ideal as a micro-size device integrating sensing and actuating functions in a microsystem [8].
However, manufacturing NiTi foils is di cult via the existing ingot casting and rolling route, as a result of high reactivity and poor formability of the NiTi alloy. One fabrication technology under development is socalled planar ow casting, which solidi es molten metal into solid foils directly [9]. As the intermediate processing steps are eliminated, the planar-ow-cast NiTi SMA foils are low-cost and can be produced in large volumes.
The planar ow casting is a rapid solidi cation process that quenches molten metal into solid foils at a cooling rate in a range of 103 to 107 K/s. This rapid solidi cation can form additional metastable phase [10,11], which would affect the actuating behaviours of the NiTi SMA foils. The actuating characteristics of the planar-ow-casted NiTi SMA foil was investigated in terms of phase transformation temperature, shape memory effects in terms of actuation force, response time, and degree of actuation [12][13][14].
Near-net-shape NiTi SMA foils of about 100 µm thickness, 2 meters of length and width of 30 mm have been successfully produced by a planar ow casting facility at CSIRO. Foil with a width of 30 mm can be formed into various shapes of SMA components, enabling NiTi SMA to be utilized in a wider range of applications. This advancement at CSIRO Australia creates scienti c opportunities to envisage the advantage of the unique behaviour of SMAs (see Figure 1(A) and Figure 1(B)).
With the unique advancement of the capability to produce the 30 mm wide SMA foil, there was a need to develop an automated system to rapidly characterize the performance of these foils, enabling a pathway to optimize SMA materials and high-quality control of the manufacturing process. The foils of 30 mm width could be shaped into many geometries and sizes to accommodate a wide range of applications with requirements of various degrees of freedom. The evaluation and quanti cation of the performance of a SMA foil is often determined by the achieved actuation angles and the amount of force it can generate during thermally excited actuation and recovery transitions. Hence, a system that can accurately and rapidly predict force and angle being generated by an actuating SMA foil under excitement, has evidently become essential [15][16][17][18][19][20]. Elimination of time-consuming physical testing was a major factor to increase the e ciency of the SMA material characterization and new SMA material discovery [21][22][23][24][25][26].
A system capable of predicting the potential achievable actuation angles and the amount of force that in the past can be only generated by many experiments on the SMA foil, could make the SMA material characterization signi cantly faster, hence also making the material design more e cient and optimised.
We aimed to design an automated and rapid SMA characterization system to achieve two primary objectives [27][28][29][30][31][32][33]. Firstly, we established a capability (aim A) to predict possible actuation angles achievable by a freshly manufactured foil, purely based on the dynamic maximum body temperature of the foil while under the thermal excitement. Secondly, we developed a unique capability (aim B) to predict a possible amount of force that could be generated by that foil while actuating and recovering under the thermal excitement.
In this study, a new methodology was developed, which employed infrared video imaging of the foils under excitements, conventional Computer Vision based video data analysis techniques and Machine Learning based predictive techniques to rapidly characterize the planar-ow-cast NiTi SMA foils [14][15][16][17][18][19].
After a comparative study using various ensemble machine learning techniques, we employed Extreme Gradient Boosting (XGBoost) [20][21][22][23][24][25][26][27] Regression model in the proposed methodology as the most effective predictor. A large database was generated using in-house automated testing facilities at CSIRO, Australia. The methodology was tested on a very large number of SMA foil samples to establish its overall performance accuracy and generalisation capability while predicting actuation angles and force.
The methodology was also adapted as a stand-alone predictive system to predict potential force from unknown foil samples. The system was tested using a blind validation procedure. The blind validation was highly successful showcasing the high potential and effectiveness of the new methodology in the eld of SMA foil-based applications [34][35][36][37][38][39][40].

Results
Fabrication of NiTi SMA foils A mixture of Ti and Ni metals with Ni/Ti weight ratio of 54.7/45.3 was melted and then cast into foils by a planar ow caster at CSIRO (Figure 1(A)). The planar-ow-cast NiTi SMA foils of about 100 µm thickness and 30 mm width are shown in Figure 1

Image-based data assimilation
An overview of the system for the automated experimentation is shown in Figure 2. It had two test rigs to excite and test two SMA foil samples (namely Sample A and Sample B in two insets of Figure 2) simultaneously. Each of the SMA foil was tested through 30 repeated cycles, where each cycle consisted of one actuation phase and one recovery phase. Sample A was used for possible actuation under thermal excitement, whereas Sample B was used to measure the force generated by the actuating SMA foil. An infrared camera was used to capture the video data of the actuating SMA foil (Inset box of Sample A in Figure 2), and to extract the dynamic body temperature of the SMA foils, as time series data during actuation and recovery. Body temperature data varied over a range of ~29 °C to 79 °C and were stored by the infrared camera to the central data server. The captured infrared video data were automatically processed using a live CV based processing system to extract achieved actuation angles, one actuation angle at the Body Centroid (BC) of the SMA foil and the actuation angle at the dynamically changing tip of body (Tip), the maximum stretched tip of the body on a video frame at any given time. The actuation angles were extracted as time series data as demonstrated in Figure 2.

Image-based measurement of actuation angles
During the processing of the infrared video image processing, each of the video frames were compressed into [32 X 32] pixel frames. The frames were converted into grayscale, eroded and dilated to make the actuating SMA foil only visible in a video frame. This step eliminated any background lighting noise that was recorded during large scale video capturing and simpli ed the pixel-based feature extraction. Dynamically the X and Y coordinates of the BC and the Tip were calculated from each of the video frames. The top left point of the video frame was considered as the origin, whereas the angle between the origin and the BC, and the angle between the origin and the Tip were calculated and stored as time series ( Figure 2).

Selection of signi cant video frames
The quality of the captured video was kept consistent during all experimentation in those 239,070 video frames collected from the four groups of differently shaped actuating SMA bodies. Standardizing the experimental protocol was crucial to capture data of a high quality that is consistent and completely reproducible. Selection of video frames to be included in the nal study was determined by a signi cance tolerance factor, de ned by the change in actuation angles at BC and Tip, both being greater than 1.5°, an effective minimum angular threshold used in this study. This was to eliminate the repetitive video frames (without any signi cant changes in achieved actuation) from the overall analysis and any potential bias that could be created by this type of repetition. Finally, 175,598 video samples were selected, and all the video frames were individually attened into a pixel matrix of size of [1 X 1024], to be used in the predictive analysis and the evaluation of the system.

Automated synchronization of data
The data synchronization among the force, angles, temperature and selected video frames was critical for the predictive analytics and system development. Initially, one cycle of excited actuation and recovery was recorded for each of the shapes. This one cycle curve was used to benchmark all the subsequent repeat cycles in the process of data synchronization against time. Figure 3 shows shape speci c synchronization curves for the four different shaped SMA foils, synchronized time series data mapped together, and a demonstrative example of representative video frames associated with different stages of an experimental cycle (marked as A, B, C, D, E, F, G and H, labelled with the measured force and actuation angle at the Tip, that moment in time) while using OMEGA shaped SMA foil.
Synchronized data set had 175,598 video samples along with the corresponding four recorded attributes, 'generated force', 'actuation angle at BC', 'actuation angle at Tip', and 'maximum body temperature'. The "4 BENDS" shaped foils were represented with 42843 samples, "HALF CIRCLE" shaped foils were represented with 45922 samples, "OMEGA" shaped foils were represented with 46067 samples, and "V" shaped foils were represented with 40766 samples.

Model prediction accuracy
The study nds an Extreme Gradient Boosting (XGBoost) Regression model was the best model to predict possible actuation angles (at the BC and at the Tip) with a R 2 score in a range of 0.925 -0.974, while taking the dynamic maximum body temperature as the only input to the model, achieving a mean accuracy of 95%. This result successfully benchmarked the (aim A). Figure 4 shows the schematic diagram of the actuation angles prediction capability, input and outputs of the model, and a comparative example of predicted angles against the measured angles, using an OMEGA shaped SMA foil. Table 4(A)- Table 4(E) summarises all mean R 2 score results from the comparative predictive regression analysis and quantitative selection of the XGBoost Regression model as the best predictor.
In addition to the high accuracy of predicting actuation angles, the XGBoost Regression model was also the best model to predict possible amounts of force with a R 2 score in a range of 0.99 -0.998, achieving a mean accuracy of 99.5%. This result successfully benchmarked the (aim B). In Table 5, we summarised some traditional statistical measures including standard deviation (std) and mean of all learning targets, the measured force time series. It was found that among the ve-time series, mean varied on a range of 0.64 -1.97 and std varied on a range 0.12 -1.17. The RMSE varied on a range of 0.01 -0.09, indicating a very high accuracy for the selected XGBoost regression model while predicting force purely based on infrared video of the actuating SMA foils under thermal stimulus. Figure 5 shows the schematic diagram of the infrared video data-based force prediction capability, input and outputs of the model, and the prediction results consists of mean R 2 score, Root Mean Square Error (RMSE), Error plots and Residual plots.

Blind system validation
The methodology consists of two test rigs with automated data logger, an infrared camera, a Computer Vision system for dynamically analysing video stream, coupled with the best trained XGBoost regression model was adapted as a predictive system (as shown in the Figure 2) to predict potential force from the video data collected using unknown SMA foil samples. The measured force from these samples were not used in the training and development of the model, rather kept separately for the blind validation. The overall predictive system was blind tested and validated to establish a performance accuracy and ultimate deploy ability of such a system. Results from the system blind validation are demonstrated in Figure 6, where R 2 score of predictions varied on a range of 0.981 -0.992 and predicted force was displayed on top of the video frames dynamically. Four analysed video les (named SI-1, SI-2, SI-3, and SI-4) have been included with the Supplementary Information section to showcase four examples of blind validation of the predictive system using four different SMA foils. System predicted force values were dynamically displayed on top of the video frames, with very few scenarios noisy predictive outcomes, due to presence of some insigni cant and noisy video frames which were not eliminated from the validation video data, particularly during the transition between two consecutive excitement cycles.

Comparative model selection
Five different regression models including AdaBoost Regressor, Extra Tree Regressor, Gradient Boosting Regressor, XGBoost Regressor, and Random Forest Regressor were employed to conduct a comparative analysis. Table 4(A)- Table 4(E) summarises all results from the comparative predictive regression analysis, covering results from the four differently shaped SMA foils and an additional scenario while combining all shapes together. As evident from the tables, we found that XGBoost Regressor outperformed the other four ensemble regression models in both predicting aim A and aim B.

Discussion
We aimed to achieve a complete solution as a system, novelty in each of the steps, including SMA material fabrication, digital material footprint generation, digital characterisation of a novel material, digital optimisation of material selection, and nally a working system that fully automates the whole process.
Here, we reported the new manufacturing process to achieve NiTi SMA foil of 30 mm width. This is a signi cant improvement in the eld of SMA foils, bringing a major exibility in designing the shape and the size of foils. This type of SMA foils were successfully produced by a planar ow casting facility at CSIRO, Australia. The fabrication of SMA foils is low-cost and can be produced in large volumes. This 30 mm SMA foil presents a unique possibility for a wide range of applications.
In the next phase, we used computer vision and XGBoost machine learning based Arti cial Intelligence techniques, to develop a new methodology, which can rapidly and highly accurately predict key attributes, namely, generated force and actuation angle, to characterise a large number of newly manufactured NiTi SMA foil. In summary, 95% overall accuracy was achieved when the system tried to predict possible actuation angle based on SMA foil body temperature. We also showed that 99.5% overall accuracy was achieved by the best model while predicting the possible amounts of force that could be generated by an actuating foil.
In combination with manufacturing facilities, digital imaging system, and Arti cial Intelligence techniques, we developed a fully automated stand-alone system that is uniquely capable to characterize SMA materials, signi cantly improving material selection and material adaptability for a real life application. Testing and blind validating the generalisation capability of the proposed system was an important step to be able to accept and trust such a system using Arti cial Intelligence. Results from the blind validation stage indicated the validation accuracy of 98%-99%. This shows an opportunity to adapt predictive technologies for digital manufacturing in the era of Industry 4.0.

Methods
Initial shape setting by heat treatment SMA strips of 30 mm width and 120 mm length were rstly cut out from planar-ow-cast foils. Then they were inserted into the slot of steel moulds with four different shape xtures, namely, "4 BENDS", "HALF CIRCLE", "OMEGA" and "V" (as shown in Figure 1(D)). The assemblies of the moulds and foils were placed inside a tube furnace, undergoing annealing heat treatment to set the shape. The heat treatment was conducted at 550 °C, 650 °C and 750°C, respectively, for 30 minutes under argon before quenching in water. After removal from the mould, a centre slot with a width of 4 mm and a length of 115 mm was cut out from the strip to enable an electrical current path. before creating four groups of foils according to four different selected shapes.

Phase transformation temperatures
Austenite start temperature (A s ) is the temperature at which the SMAs start to actuate when the martensitic-to-austenitic phase transformation begins. Austenite nish temperature (A f ) is the temperature when the phase transformation is nished. Similarly, when the temperature decreases, the phase transformation from austenite to martensite phase begins at martensite start temperature (M s ), and completes at martensite nish temperature (M f ). The phase transformation temperatures were measured by Differential Scanning Calorimetry (DSC, Mettler Toledo DSC3). M s , M f , A s , and A f of planarow-cast SMA foil samples annealed at different temperatures were extrapolated through the tangential line method from the DSC measurements, and are summarised in Table 1. The results in Table 1 showed that the transformation temperatures decreased with increasing heat treatment temperature. This result suggests that, instead of varying the chemistry, the heat treatment can change the phase transition temperature and thus the actuation temperature. This observation indicates a possible low-cost control over the performance of the NiTi SMA foils.
Training of two-way shape memory alloy foils All the planar-ow-cast NiTi-based strip SMA samples in the sequent training tests were annealed at 550°C . A thermomechanical treatment, known as a training process, was carried out on the SMA foils, enabling them to remember two shapes i.e., two-way actuation. An example of the training process with a foil of "V" shape is shown in Figure 1

Effect of training cycle on actuation
After the 1 st training cycle, the SMA sample started to show the 2-way shape memory behaviour -i.e., the SMA strip moved to the actuated position when the electrical current was on and shifted back to another position when the current was off. As shown in Figure 1(F), their actuation behaviour during the training cycle with the current on (stimulated) or off (un-stimulated) was photographed after 0, 1,5,10,15,20,25 and 30 training cycles of the SMA actuation taken. After the 1 st training, the current-on angle is 64° and the current-off angle is 49° with 15° difference. With more subsequent training, the angle difference increased to 30° and the current-on and current-off angles were stabilized at 134° and 102°, respectively, by 30 th cycle, with a maximum angle difference at 32°. Each of the foils used in this study went through a consistent 30 cycles of training. A comprehensive summary of the maximum and mean actuation angles achieved by the four different shaped SMA foils have been provided in Table 2.

Measurement of generated force
Force generated by the stimulated SMA foils during actuation and recovery were measured as ground truth data. The tests were carried out using an inhouse morphing tester equipped with a 20 Kg load cell. The testing system is shown in Figure 2 (Inset box of Sample B in Figure 2). Both ends of SMA sample were loaded to the tester by screws. Torque wrench was used to tighten the screws, ensuring the same clamping force is applied to both ends of the samples. Using a DC power supply (DPD3030, Manson), 7A current was applied to the SMA foil. The generated force was detected by the load cell as the two end sides of the SMA were restricted.
The maximum forces measured during actuation (current on) and recovery (current off) and the corresponding generated force calculated are tabulated in Table 3. The peak force during actuation for the planar-ow-cast material is 4.2 N and for the recovery stage is 2.7 N, while experimenting with the shape called "4 BENDS". The times needed for the four different shaped SMA bodies to actuate (TA) and recover (TR), are presented in Table 3. "V" shaped sample showed shortest actuation and recovery times, suggesting the fastest response.

XGBoost regression model
XGBoost stands for Extreme Gradient Boosting. The XGBoost regression adapts and implements the gradient boosting decision tree algorithm. It implements machine learning algorithms under the Gradient Boosting framework. XGBoost provides a parallel tree boosting (also known as GBDT, GBM) that solves many data science problems in a fast and accurate way [14][15][16][17][18][19][20]. In the Gradient boosting approach, in each step of the learning, new models are created that predict the residuals or errors of the prior models. The predictions from the new models are then added together to make the nal prediction. XGBoost is an implementation of gradient boosted decision trees designed for speed and performance.

Predictive experimental design
We tested a capability (aim A) to predict possible actuation angles achievable by a given foil, purely based on the dynamic maximum body temperature of the foil while under the thermal excitement. We utilised a multi-output mode of the XGBoost regression model to predict both actuation angles simultaneously with the single temperature input.
Training input for this modelling was the dynamic maximum body temperature of the foil, while the learning targets were the actuation angles. The XGBoost model was able to establish the correlation between temperature and actuation angles with high accuracy (as shown in Figure 4).
Secondly, utilizing the same XGBoost Regression model (separately trained), we developed a unique capability (aim B) to predict a possible amount of force that could be generated by a given foil under the thermal excitement. Training input for this modelling was the video data, while the learning target was the measured force.
This part of the predictive system was trained on the compressed and attened pixels from each of the selected video frames. All together ve different scenarios were experimented, individually, a data set related to each of the four shaped SMA foils and combining four of them as a single data set (as shown in Figure 5).

The model evaluation
In both parts of predictive modelling, the XGBoost model was trained with 80% of the data (140,478 samples) and tested and validated on the remaining 20% (35,120 samples). A random cross validation (CV) paradigm consists of 5 repeats and 10-Folds (Repeated Folds CV) was used to test the generalisation capability of the model while predicting. We also conducted a separate blind validation of the overall predictive system using unknown foil samples. This blind validation was separate from the Repeated Folds CV during the initial training-testing paradigm of the model development.
Prediction performance for each of the ve scenarios have been consistently depicted using, mean R 2 score, Root Mean Square Error (RMSE), Error plot and Residual plot. In all the Error plots on Figure 5, most of the points are on a straight line at 45° indicating the predictions exactly match the actual measured force data. In the Residual plots there is no signi cant visible pattern between the predictions and residuals. This showcases that the residuals are uncorrelated and independent. In the distribution part of the residual plots, it is veri ed that the residuals are approximately normally distributed, highlighting the robustness of the XGBoost model.

Data availability
All data are available for non-commercial, research use only upon request from the corresponding author.

Code availability
The system code is available for non-commercial, research use only upon request from the corresponding author.          Near-net-shape NiTi SMA overall automated experimental setup consists of two test rigs with automated data logger, an infrared camera with automated data logger, a Computer Vision system for dynamically analysing video stream, extracting relevant time series data and selecting signi cant video frames, to be analysed and utilised to train and develop a predictive system. Sample A of the foil was used for infrared video imaging and digitally measuring actuation angles, while the Sample B was used to measure the generated force. This was done simultaneously, to capture a large database for further system implementation.

Figure 3
This gure shows the data synchronization procedure. The force, angles, temperature time series and selected video frames were synchronized against time stamps. It also shows an example of utilization of the 1-Cycle synchronization curve for a larger data synchronization. Results of prediction for the aim A. A XGBoost regression model was the best model to predict possible actuation angles (at the BC and at the Tip) with a R2 score in a range of 0.925 -0.974, while taking the dynamic maximum body temperature as the only input to the model, achieving a mean accuracy of 95%.
An example of prediction results is depicted in the gure using an Omega shaped SMA.