Next Article in Journal
Monitoring and Prediction of Deformation and Failure of Roadway Surrounding Rock Based on Binocular Vision and Random Forest
Previous Article in Journal
Influence of Ground Conditions on Vibration Propagation and Response Under Accidental Impact Loads
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Automatic Baseline Correction of 1D Signals Using a Parameter-Free Deep Convolutional Autoencoder Algorithm

by
Łukasz Górski
and
Małgorzata Jakubowska
*
Faculty of Materials Science and Ceramics, AGH University of Krakow, al. Mickiewicza 30, 30-059 Krakow, Poland
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(22), 12069; https://doi.org/10.3390/app152212069
Submission received: 17 October 2025 / Revised: 6 November 2025 / Accepted: 10 November 2025 / Published: 13 November 2025

Abstract

Baseline correction techniques are highly applicable in analytical chemistry. Consequently, there is a constant demand for universal and automated baseline correction methods. Our new procedure, based on the Convolutional Autoencoder (ConvAuto) model and combined with an automated implementation algorithm (ApplyModel procedure), meets these expectations. The key advantage of this approach is its ability to handle 1D signals of various lengths and resolutions, which is a common limitation encountered in deep neural network models. The proposed procedure is fully automatic and does not require any parameter optimization. As our experiments show, the ApplyModel procedure can also be easily combined with other baseline correction methods that utilize deep neural networks, such as the ResUNet model, which also extends its practical applicability. The usability of our new approach was tested by implementing it for both simulated and experimental signals, ranging from 200 to 4000 points in length. For complex signals characterized by multiple peaks and a nonlinear background, the ConvAuto model achieved an RMSE of 0.0263, compared to 1.7957 for the ResUNet model. In the determination of Pb(II) in a certified reference material, a recovery of 89.6% was obtained, which was 1% higher than that achieved with the ResUNet model.

1. Introduction

Baseline correction is one of the fundamental signal processing tasks in modern analytical methods, such as spectroscopy (UV-Vis, IR, Raman, LIBS), chromatography (HPLC, GC), and electrochemical techniques (voltammetry, amperometry). Ideally, the analytical signal consists solely of useful information derived from the analyte. In practice, however, the recorded instrumental response also contains unwanted components—noise and background. Therefore, baseline correction is an essential step in data preparation, particularly in quantitative analysis. It is necessary due to instrumental and environmental interferences, including temperature changes, radiation source instability, reference potential drift, and sensor response fluctuations, which cause slow signal shifts along the intensity axis. Complex matrix components may absorb or conduct independently of the target analyte, leading to an irregular background profile. The overlap of useful signal components, in techniques where peaks or bands are broad and closely spaced, makes it difficult to separate individual signals. High levels of noise and drift, especially in long-term measurements or when using detectors with low stability, may also generate a background with variable shape and intensity.
The primary objective of baseline correction is to isolate the analytical signal from the background, allowing accurate quantification of peak intensity, area, and shape associated with individual analytes. This improves the accuracy and reproducibility of quantitative analysis, as minimizing background-induced bias enables reliable determination of analyte concentrations. Enhancing signal resolution facilitates the identification of overlapping bands, which is crucial in the analysis of mixtures. Correction that standardizes input data for computational algorithms is essential in chemometric analysis (e.g., PCA, PLS, XGBoost), where background shifts can distort the data structure and reduce the performance of supervised learning models (classification and regression). Improved visualization and interpretation of results by removing baseline drift or asymmetry also allow for clearer presentation of spectra and waveforms. In summary, appropriate correction increases the reliability of results, enhances the stability of computational models, and enables the proper interpretation of complex measurement signals.
Correction is not a trivial task, as the background can be nonlinear and time-varying, peaks often overlap (making it difficult to distinguish signal from background), and algorithms can overly aggressively remove small peaks, treating them as noise. Therefore, various numerical approaches are used in practice, as well as a combination of automated correction and manual verification by the analyst, especially for quantitative determinations.
The essential approach to baseline correction involves estimating a line using polynomials. This can be accomplished through polynomials of various degrees [1] or by using automatic iterative methods with polynomial fitting [2,3]. Similar to polynomials are splines, with particular emphasis on cubic splines [4] and cubic Hermite splines [5,6]. Among the various ideas, it is worth noting an iterative algorithm with two-stage iteratively reweighted smoothing splines with Tukey’s Bisquare weights [7], as well as a penalized spline smoothing method based on vector transformation that helps distinguish baseline regions from peaks [8]. Another procedure incorporating splines was introduced by S. He et al. [4], where a genetic algorithm was applied to select the background spectral wavenumbers and finally fit the baseline with a cubic smoothing spline. Similarly, another approach [9] involved selecting peak regions with discrete wavelet transform in combination with the spline-based background approximation in the wavelet domain. In addition to polynomial and spline techniques, other baseline correction procedures incorporating robust baseline elimination approaches with local regression [10] and community information [11], non-quadratic cost functions [12,13], or application of sparse Bayesian learning [14] have also been introduced.
Classical baseline correction methods employing mathematical and statistical principles such as polynomial fitting [2], local regression [10], splines [4,7,8], and wavelet transforms [9], form the basis of many modern procedures for analyzing spectral, chromatographic, and electrochemical signals. Their main advantages are simple implementation and low computational requirements, enabling rapid processing of large data sets without the need for advanced computing infrastructure. Furthermore, many of these methods have intuitively understandable parameters, such as the polynomial degree or window width in the iterative algorithm, that can be adjusted to the characteristics of the signal being analyzed. They also exhibit good mathematical interpretability, which favors their use in controlled laboratory conditions and in systems of limited complexity. However, these methods have significant limitations. First, they require the manual selection of numerous parameters, often dependent on the signal type, noise level, or background shape, which limits their automation and repeatability, and consequently, their versatility. For signals with an irregular or nonlinear baseline, this can lead to imprecise matching or oversmoothing of important details. Furthermore, their effectiveness decreases in the presence of high levels of noise, overlapping peaks, or nonlinear instrumental distortions, typical of real-world experimental data [3,6]. Methods based on cost functions [12,13] or Bayesian learning [14] partially mitigate these problems, but at the cost of increased computational complexity and the need for precise calibration of regularization parameters. In summary, classical baseline correction methods are effective and stable for signals with predictable background shapes, but their application in the analysis of complex, nonlinear, and heterogeneous data requires individual parameter tuning or combination with more adaptive techniques. Hence, they constitute a robust benchmark that is increasingly employed to evaluate modern algorithms.
One of the most important baseline correction methods is Penalized Least Squares (PLS), which is based on the Whittaker smoother introduced by Eilers [15]. This method has a major advantage in efficiently handling missing data points over long stretches, controlled by iteratively generated weights, with shape and smoothness adjusted mainly by a single parameter. There are several variants of PLS methods, such as Asymmetric Penalized Least Squares (AsPLS) [16,17,18,19] and adaptive iteratively reweighted Penalized Least Squares (airPLS) [20,21], focusing primarily on weight minimization to enhance baseline correction results. Particularly interesting is the asymmetrically reweighted Penalized Least Squares (arPLS) method proposed by Beak et al. [18], which incorporates a general logistic function to iteratively adjust weights according to noise levels, helping to avoid classifying a noisy baseline as small peaks. Therefore, the arPLS method is less vulnerable to noise and more effective when applied to real signals. The ML-airPLS algorithm [22] uses machine learning (specifically, the PCA-RF model) to determine the optimal parameters for airPLS baseline correction. Its operating principle involves directly predicting the optimal airPLS parameters from the input spectrum. The main advantage of the method is improved computational efficiency while maintaining high accuracy. ML-airPLS is proposed as a robust and generalizable approach for efficient baseline correction in Raman and SERS spectral analysis.
Asymmetric Least Squares (AsLS) methods, pioneered by Eilers [15,16], are one of the most commonly used algorithms for automatic baseline correction in spectroscopic, chromatographic, and electrochemical data. Their principle is based on asymmetric weighting of fitting errors, which allows the model to better distinguish the analyte signal from the background. AsLS methods and their improved variants (e.g., airPLS, arPLS, ML-airPLS) combine automaticity, flexibility, and high efficiency. Asymmetric weighting ensures that intense analytical signals do not “pull” the baseline upward. Flexible smoothness control, i.e., the smoothing parameter, allows for control of the trade-off between fit and background smoothness. Consequently, the AsLS family of algorithms is currently the standard in classical chemometrics. Their main limitations remain the selection of control parameters and the lack of local adaptation, which served as the starting point for subsequent approaches based on adaptive methods and machine learning.
Today, Deep Learning (DL) has become a method of particular interest in various fields of science and engineering, offering powerful tools for data analysis, modelling, and prediction. DL has also emerged as a transformative tool in analytical chemistry, enhancing the precision, efficiency, and scope of chemical analysis. Classification and detection are one of the analytical problems, where DL has gained significant attention. DL has been applied to the detection of blood diseases through hemoglobin concentration [23], detection of liver cancer cells [24], distinguishing seasonal changes in honey [25] and the classification of iron ore [26]. Deep Neural Networks (DNNs) are also useful for the detection of patterns and biomarkers in complex metabolomic [27] and proteomic [28] analysis involving big data. The SR-UNet algorithm [29] has been proposed for ion trap mass spectrometry to improve the resolution of low-resolution overlapping ion-peak spectra while maintaining sufficient sensitivity and analysis speed. DL methods also improve quantitative analysis, applying the DeepSpectra model for Raman spectroscopy [30] and enhance gas sensing below the limit of detection (LOD) [31]. They are also applicable in filtering signals from noise, improving the signal-to-noise ratio in NMR spectroscopy [32] and detecting false peaks and distortions in LC-MS [33].
Despite its potential, there has been limited interest in the application of DL for baseline correction compared to other signal processing methods so far. This may be due to the lack of comprehensive signal databases, which must include both signals and their true baselines, crucial for DNN model training. In one of the few solutions, Liu Y. [34] proposed application of a model incorporating adversarial networks to recognize the baseline regions in real data, called Baseline Recognition Nets (BRN). Another method introduced multiscale analysis and regression to design a CNN model with a mixed encoder–decoder architecture to generate a baseline [35]. The authors of another publication [36] used cascaded deep convolutional neural networks based on ResNet and UNet architectures, capable of fully accessing baseline-corrected and denoised Raman spectra. An intriguing approach to baseline correction was introduced by Chen T. et al. [37], utilizing a DL model that merges ResNet and UNet, known as the ResUNet model. The model was trained on simulated signals. Although the method was applied to Raman spectra, it has the potential to be incorporated into other analytical signals.
The novel baseline correction algorithm for Raman spectroscopy [38] employs a Deep Neural Network (DNN) architecture to overcome the limitations of traditional methods, such as dependence on specific datasets and the need for complex manual parameter tuning. Utilizing the powerful nonlinear curve-fitting capability of neural networks, a fully connected network model (NNFit) was specifically constructed to perform the baseline estimation task simply and rapidly. It was trained on a large simulated dataset based on a precise mathematical model of the Raman signal. The NNFit model demonstrated clear advantages over classical algorithms, effectively improving signal quality and ensuring greater accuracy of peak intensity.
The paper [39] introduces a CAE+ (Convolutional Autoencoder with a comparison function) model specifically for Raman spectra baseline correction. It is based on a convolutional autoencoder and uses a comparison function that establishes the estimated baseline as the minimum between the input spectrum X and the decoder output y, exploiting the fact that the baseline is inherently lower than the signal’s useful component. The main advantages of CAE+ are the significant improvement in the precision and consistency of the correction and the effective preservation of the original intensity, shape, and position of Raman peaks, which are common problems with traditional algorithms.
A one-dimensional Transformer (1dTrans) for baseline estimation of complex Raman spectra was described in [40]. The 1dTrans model’s operating principle is based on a self-attention mechanism, allowing it to efficiently analyze the entire spectral range simultaneously and capture long-range dependencies, avoiding the locality limitations of CNNs. The model was trained on a large dataset generated by augmenting signals based on manually annotated baselines, which proved more effective than a purely simulation-based approach.
The Interference Data Denoising Network (InDNet), designed to simultaneously remove noise and perform baseline correction of interferograms, was introduced in [41]. The InDNet architecture is based on an encoder–decoder (U-Net) structure and integrates multiscale convolutional (MSC) modules for local feature extraction and a Transformer block for global information fusion. The key principle is the use of multidimensional gradient-consistent regularization in the loss function, which enforces data consistency across interferogram columns. InDNet achieves excellent results by effectively removing baselines, providing smoother spectral profiles and more accurate Raman peak reconstruction.
Article [42] describes an innovative Raman spectral baseline correction algorithm based on a Triangular Deep Convolutional Network (Triangular DCN). The proposed approach employs asymmetric, hierarchically nested convolutional filters that effectively separate background components from low-intensity analytical signals. Owing to its adaptive architecture and deep feature extraction mechanism, the network provides improved stability and high accuracy in baseline reconstruction with minimal loss of chemical information.
Therefore, to address the limited application of DNN models in baseline correction, we have developed an original method based on the Convolutional Autoencoder (ConvAuto) model. This approach includes an automated procedure called ApplyModel, which facilitates baseline correction for 1D signals of various lengths and resolutions, representing a fundamental aspect of the proposed solution. As it turned out, this approach proved to be effective in baseline correction in both simulated and experimental signals.

2. Methodology

2.1. Convolutional Autoencoder Model

The autoencoder is a specific DNN architecture consisting of two parts: encoder and decoder. The encoder extracts features of the input signal and decomposes them into small pieces of information encoded within this part of the model. The decoder, in turn, takes those pieces of information and combines them into an output signal corresponding to the input signal. The encoder and decoder exchange information in the narrowest part of the autoencoder, called the bottleneck. Such a structure makes the autoencoder a generalization model which extracts the main features of the input signals, reconstructing them only on the basis of the most important information passing through the bottleneck. Sometimes, this structure is used to reconstruct the input signal without interference such as noise. In our solution, we did not aim to reconstruct the original signals, but rather to design an autoencoder model which, based on the input signal, generates the baseline of that signal.
Convolutional 1D layers were used as they are better suited to decompose and store the spatial information of signals (baseline shape, peaks locations and heights, etc.). Transposed convolutional 1D layers were applied to reconstruct those signals, respectively. The scheme of the proposed Convolutional Autoencoder (ConvAuto) model is presented in Figure 1. All layers produced outputs with ReLU activation and were normalized using batch normalization. To limit overfitting, dropout (0.2) was applied, and average pooling layers were introduced to improve model generalization. The model’s kernel size was not constant but varied progressively (see Figure 1), from 15 in the input (and output) layers to 3 in the bottleneck.
DNN models must also deal with the vanishing gradient problem, which occurs during the backpropagation training process. It significantly reduces the gradient, which may completely disappear if the model contains many hidden layers. This was also the case for the ConvAuto model, especially in the encoder part. Therefore, to improve the learning rate and reduce prediction error, skip connections were implemented in the model architecture. These connections also consisted of convolutional 1D (or transposed convolutional 1D) layers with kernel size 1.

2.2. Apply Model Algorithm

A significant constraint in the broader application of baseline correction DNN models is the fixed input size imposed by the model architecture and the corresponding training dataset. This means that only signals of a specific length—the same as model input size (in ConvAuto it was 512)—can be provided to such a model. Theoretically, we could imagine training as many models as needed to fit each signal length, but that is not the point. Such a solution would be a waste of time and resources, requiring a countless number of datasets to train all those models. Therefore, a simple algorithm (called ApplyModel) was developed, enabling the application of the ConvAuto model to a wide range of 1D signals. The scheme of this procedure is presented in Figure 2.
The ApplyModel procedure is primarily based on adjusting the signal length to the model input size, which essentially combines two operations: artificially increasing (or decreasing) signal resolution, and extrapolating additional points at the beginning and end of the signal. To increase signal resolution, the procedure calculates the mean of two adjacent points and uses this value to create a new point between those two adjacent points according to the following formula:
y n = y n 1 + y n + 1 2
where yn was value of the new point, yn−1 and yn+1 were the values of adjacent points. This procedure was repeated throughout the signals, effectively doubling it resolution. Similarly, to reduce signal resolution, the procedure simply discarded even point along the signal, thereby halving the resolution. These operations were repeated as many times as necessary, typically 0–3 times for a single signal. However, these modifications were never sufficient to adjust the signal length to the required model input size of 512. Therefore, further adjustments were made by polynomial extrapolation of additional points at the beginning and end of the signals. Low-degree polynomials (first or second degree) were applied, using selected points from signals to approximate the polynomial and then extrapolate the required additional points. We chose low-degree polynomials as a defensive strategy to prevent the introduction of high-frequency oscillatory artifacts at the signal boundaries. Thus, by combining these two simple operations, any signal length could be adjusted to model input size 512. Certainly, such modifications strongly influenced the signals (destroying fine peak details), but they preserved the overall shape, which was sufficient for our ConvAuto model to generate baselines. Importantly, the procedure recorded all operations performed on the original signals, which were later used to reverse all length modifications in subsequent steps.
After the length adjustments, the signals were normalized (the ConvAuto model required normalized signals), and the min-max values were saved for future operations (described below). The normalized signals were then applied to the ConvAuto model, which generated the corresponding baselines. From this point on, all subsequent operations of the ApplyModel algorithm were performed on the generated baselines in order to restore them to the original signal length. For this purpose, the data obtained during the normalization and length adjustment steps were used. Since the model returned normalized baselines, a denormalization operation was first performed using the min-max values obtained during signal normalization. Then, length adjustments were applied to the generated baselines to match the original signal length. This was done using the same methods as for signal length adjustment, but here executed in reverse order. After that operation, the baselines matched the original signal length and were ready for baseline correction.
The ApplyModel algorithm was fully automated and did not require any parameter optimization. Furthermore, the algorithm was coded in such a way that other models (such as ResUNet) could be easily used in place of ConvAuto, as demonstrated in the Section 4.

3. Model Preparation

3.1. Generation of Simulated Signals for Model Training

The process of developing and training DNN models presents significant challenges, primarily in maintaining a balance between the accuracy of the result and generalizability of the model. A fundamental aspect of this process involves the acquisition of a comprehensive training dataset. However, gathering such a dataset is time-consuming and costly, especially when large quantities of experimental signals are required. Therefore, a better approach was to generate a large number of simulated signals, which were then divided into a separated training, validation and test dataset. To facilitate this, an automated procedure for generating simulated signals was established, as illustrated in Figure 3. The algorithm combines of peak, baseline, and noise generators. The first generator employed the Gaussian function (2) to calculate peak-shaped signals:
G ( x ) = a · e x p ( x p ) 2 2 w 2
where a, p, and w represented the amplitude, position, and width of the peak, respectively. Between one and four peaks were generated in each signal. Their positions, heights, and widths were randomly selected within the defined range. The baseline generator employed four different methods to generate random baselines: cubic splines, cubic smoothing splines, second-degree polynomials and combination of two polynomials with non-integer exponents. The selection of the method was randomized each time the generator function was called, and the baseline values were constrained within the specified range. Furthermore, spline-based methods used randomly located nodes (3 to 5 nodes) to shape the baselines. The noise generator produced normally distributed noise with an amplitude ranging from 0.5 to 2% of the average peak intensity in the signal. Ultimately, the algorithm generated pairs of simulated signals together with their corresponding baselines. This process resulted in a training set of 105,000 simulated signals, as well as validation and test datasets, each consisting of 22,600 simulated signals.

3.2. Model Training Details

The model was trained on Kaggle.com platform using P100 GPU accelerator with the TensorFlow python library. The final model was applied on a MSI laptop equipped with Intel i7 processor, a Geforce 3070 RTX GPU and 16 GB of RAM. To ensure optimal memory management, all datasets were loaded and saved as TensorFlow tf.data datasets. Before saving the datasets, all signals were normalized and expanded with additional dimension (to a 3D tensor), as required for convolutional 1D layers.
The training procedure began with loading training, validation and test datasets, which were immediately prefetched and shuffled (except for the test dataset). The input size was set to 512 (training signal length), and the batch size was 100. The model was trained for 60 epochs using the Adam optimizer. The Mean Absolute Error (MAE) was employed as a loss function, and the Root Mean Square Error (RMSE) was used as the evaluation metric. The initial learning rate was set to 10−4 and after 5 epochs was decreased by the factor of exp(−0.1) ≈ 0.9 per epoch. Changes in the loss and learning rate values during model training procedure are presented in Figure 4.

3.3. Experimental Signals

In addition to the test dataset, the ConvAuto model was also evaluated using two separate sets of experimental voltammetric signals, each obtained from different measurements.
The first experiment concerned the determination of Pb(II) in samples with a certified concentration of 25.0 ± 0.1 µg·L−1 Pb(II) (CRM SPS-SW2, Polish Institute of Nuclear Chemistry and Technology, Warsaw, Poland). Measurements were carried out using the Differential Pulse Anodic Stripping Voltammetry (DPASV) technique, using a two-electrode system with a Rapidly Renewable Silver Annular Band Electrodes (RAgABE, area 0.06 cm2) [43] as the working electrode and a Silver Quasi-Reference Electrode (AgQRE, area 2 cm2) serving as both the reference and counter electrode. The CRM was tested without any pretreatment. To 0.5 mL of CRM SPS-SW2, 1 mL of the supporting electrolyte (a mixture of 0.5 mL of 0.1 M HNO3 and 0.5 mL of 0.1 M KCl) was added, and the solution was diluted with distilled water to a final volume of 5 mL. The measurements were performed without oxygen removal. The DPASV measurements procedure consisted of three steps: conditioning the RAgABE by applying the potentials Econd= −800 mV for tcond= 8 s; preconcentration by applying the potential Eacc= −700 mV for 60 s, followed by a 5 s rest period; and finally recording the voltammograms. The analysis was carried out using the standard addition method. The first signal was recorded for pure CRM sample, and the subsequent signals were obtained after successive additions of 0.75, 1.50, 2.25 and 3 µg·L−1 of Pb(II). The standard solution of 1000 mg·L−1 Pb(II) (Fluka) was of analytical grade. The remaining experimental parameters were as follows: potential step = 2 mV, pulse potential E = 30 mV, time of potential step 20 ms (10 ms waiting time and 10 ms sampling time).
The second experiment involved the registration of highly overlapping signals for the digital signal separation procedure [44]. One such example was a mixture of ferulic, syringic and vanillic acid. The voltammograms were registered using the Differential Pulse Voltammetry (DPV) technique in a conventional three-electrode system, where Boron-Doped Diamond Electrode (BDD, Windsor Scientific Ltd., Slough, UK, φ = 3 mm) was used as the working electrode, a double junction Ag/AgCl/3 M KCl electrode (filled with 2.5 M KNO3) served as the reference electrode, and a platinum rod was used as the counter electrode. All measurements were performed in 5 mL of 0.2 M H3PO4, which served as supporting electrolyte, without deaeration. All chemicals were of analytical grade. The 10 mM standard stock solution of the syringic acid was prepared by dissolving the solid acid (95%, Sigma Aldrich, St. Louis, MO, USA) in ethanol (96%, POCH S.A., Poland). Standard solutions of ferulic (99% trans-ferulic, Sigma-Aldrich) and vanillic acid (97%, Sigma Aldrich) were prepared in the same manner. Before each series of measurements, the BDD electrode was activated at Eact = 1500 mV for 5 min in the supporting electrolyte. After a few seconds of rest period, the DP voltammograms were recorded. The remaining experimental parameters were as follows: potential step = 2 mV, pulse potential E = 50 mV, time of potential step 40 ms (20 ms waiting time and 20 ms sampling time). Finally, a set of overlapping voltammograms of ferulic, syringic, and vanillic acid was recorded in the concentration ranges of 1.15–5.80, 0.60–3.00, 0.50–2.50 mg·L−1, respectively.

4. Results and Discussion

The ConvAuto model was trained using the parameters outlined in Section 3.2., and the final results are summarized in Table 1. The low loss values obtained for all three datasets (particularly for the test loss) demonstrate that the model was effectively trained and well-prepared for the baseline generation task. The observed disparity between the training loss and the other loss values can be attributed to the presence of dropout layers within the model, which affected the training process and led to an increase in training loss (also training metrics) values.
The applicability of the model was evaluated using a simulated set of signals, with selected examples presented in Figure 5. The ConvAuto model, combined with the ApplyModel procedure, proved capable of generating baselines for signals with a wide range of lengths, from 200 to 4000 data points. The baselines were produced fully automatically, without the need to adjust any parameters of the ApplyModel procedure, which represents the most important feature of our baseline correction approach. The process was performed as follows: first, the signals were adjusted to match the model input size (512 points); next, they were fed into the model, which generated the corresponding baselines. Finally, the generated baselines were rescaled to the original signal length, and the baseline correction was applied. The entire process required less than 10 s to generate several baselines, regardless of whether the signals contained 200 or 4000 data points.
Furthermore, we conducted a comparative analysis between the results produced by our ConvAuto model and those obtained from the ResUNet model. The ResUNet model was trained according to the authors’ recommendations [37], using our simulated datasets. The ApplyModel procedure was also applied here, with the ConvAuto model simply replaced by the ResUNet model, which posed no difficulties. The ApplyModel procedure was specifically designed to allow such model substitution. The comparison results are collected in Table 2. The ResUNet model generated slightly better baselines for the first two sets of simulated signals (SimSet 1 and 2). In contrast, the ConvAuto model produced more accurate baselines for SimSet 3 and significantly better ones for SimSet 4. Analysis of the generated baselines indicated that our ConvAuto model provided much smoother baseline profiles. The ResUNet introduced more noise into overall baseline, particularly in the regions under the peaks areas, as illustrated in Figure 6. This observation was confirmed by the improved reproducibility of real baseline achieved by the ConvAuto model, which obtained lower RMSE of 0.0042 compared to 0.0052 for ResUNet model. We attributed this improvement to the dropout and pooling layers implemented in ConvAuto model, which enhanced the model’s generalization capability—features that were absent in ResUNet model.
Subsequently, the model was applied to experimental voltammetric signals. The first experiment involved the determination of Pb(II) in certified reference material (CRM 25.0 ± 0.1 µg·L−1) using the standard addition method (Figure 7A). After baseline generation with our ConvAuto model, the calculated Pb(II) concentration was 22.4 µg·L−1, corresponding to recovery of 89.6%. In contrast, baseline generation with the ResUNet model resulted in a Pb(II) concentration of 22.2 µg·L−1 (recovery = 88.6%), indicating a slight advantage of our approach. The second experimental dataset consisted of a mixture of three phenolic acids (ferulic, syringic, and vanillic acid) recorded as highly overlapping signals (Figure 7B). Our automated procedure successfully generated and corrected baselines, allowing the processed signals to be further analyzed using multivariate method or peak separation techniques [44].
A thorough evaluation of the ConvAuto model also revealed some shortcomings in baseline generation. Problems sometimes manifested as noisy fragments, typically concentrated at the beginning and end of the baselines (see in Figure 8A). Occasionally, the model produced baseline fragments that underfit or overfit the true baseline (Figure 8B). These issues can be attributed to the extensive but finite size of the training dataset, which was not sufficiently diverse to encompass all conceivable baseline variations. Substantially enlarging the training dataset is expected to reduce the frequency of these errors, but this would significantly increase training costs.

5. Summary

An innovative approach for the baseline correction of 1D signals was developed using the Convolutional Autoencoder (ConvAuto) model integrated with the ApplyModel procedure. The proposed framework enabled fully automatic correction of signals of varying lengths (200–4000 points) without the need for manual parameter tuning, demonstrating high efficiency and robustness. Comparative analyses with the ResUNet model confirmed that ConvAuto achieved comparable or superior performance in baseline reconstruction for both simulated and experimental signals.
However, the study was conducted on a limited simulated dataset, which constrains the generalization capability of the model. Future research will therefore focus on extending the approach to real-world analytical signals (e.g., voltammetric or spectroscopic data) and exploring transfer learning techniques to reduce computational costs and training time. Additionally, the algorithm could be further developed to achieve adaptive baseline correction, where the model dynamically adjusts its parameters to the signal characteristics or noise level, and integrated with explainable AI techniques to better interpret the correction process in analytical applications.

Author Contributions

Conceptualization, Ł.G.; Methodology, Ł.G.; Software, Ł.G.; Validation, M.J.; Formal analysis, Ł.G.; Investigation, Ł.G.; Resources, Ł.G.; Writing—original draft, Ł.G.; Writing—review & editing, M.J.; Visualization, Ł.G.; Supervision, M.J.; Funding acquisition, M.J. All authors have read and agreed to the published version of the manuscript.

Funding

The research project was financed by a subsidy from the Ministry of Science and Higher Education of Poland for the AGH University of Krakow (project nr 16.16.160.557).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

The authors thank Wanda Sordoń from AGH University of Krakow for providing the voltammetric measurement results. During the preparation of this work the authors used Writefull (https://writefull.com) tool in order to improve the readability and language of the manuscript. After using this tool, the authors reviewed and edited the content as needed and takes full responsibility for the content of the published article.

Conflicts of Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

References

  1. Gallo, C.; Capozzi, V.; Lasalvia, M.; Perna, G. An algorithm for estimation of background signal of Raman spectra from biological cell samples using polynomial functions of different degrees. Vib. Spectrosc. 2016, 83, 132–137. [Google Scholar] [CrossRef]
  2. Gan, F.; Ruan, G.; Mo, J. Baseline correction by improved iterative polynomial fitting with automatic threshold. Chemom. Intell. Lab. Syst. 2006, 82, 59–65. [Google Scholar] [CrossRef]
  3. Górski, Ł.; Ciepiela, F.; Jakubowska, M. Automatic baseline correction in voltammetry. Electrochim. Acta 2014, 136, 195–203. [Google Scholar] [CrossRef]
  4. He, S.; Fang, S.; Liu, X.; Zhang, W.; Xie, W.; Zhang, H.; Wei, D.; Fu, W.; Pei, D. Investigation of a genetic algorithm based cubic spline smoothing for baseline correction of Raman spectra. Chemom. Intell. Lab. Syst. 2016, 152, 1–9. [Google Scholar] [CrossRef]
  5. Dong, Z.Y.; Yu, Z.H. Baseline correction using morphological and iterative local extremum (MILE). Chemom. Intell. Lab. Syst. 2023, 240, 104908. [Google Scholar] [CrossRef]
  6. Chen, H.; Shi, X.; He, Y.; Zhang, W. Automatic background correction method for laser-induced breakdown spectroscopy. Spectrochim. Acta Part B At. Spectrosc. 2023, 208, 106763. [Google Scholar] [CrossRef]
  7. Wei, J.; Zhu, C.; Zhang, Z.M.; He, P. Two-stage iteratively reweighted smoothing splines for baseline correction. Chemom. Intell. Lab. Syst. 2022, 227, 104606. [Google Scholar] [CrossRef]
  8. Cai, Y.; Yang, C.; Xu, D.; Gui, W. Baseline correction for Raman spectra using penalized spline smoothing based on vector transformation. Anal. Methods 2018, 10, 3525–3533. [Google Scholar] [CrossRef]
  9. Górski, Ł.; Ciepiela, F.; Jakubowska, M.; Kubiak, W.W. Baseline correction in standard addition voltammetry by discrete wavelet transform and splines. Electroanalysis 2011, 23, 2658–2667. [Google Scholar] [CrossRef]
  10. Ruckstuhl, A.F.; Jacobson, M.P.; Field, R.W.; Dodd, J.A. Baseline subtraction using robust local regression estimation. J. Quant. Spectrosc. Radiat. Transf. 2001, 68, 179–193. [Google Scholar] [CrossRef]
  11. Wu, Y.; Gao, Q.; Zhang, Y. A robust baseline elimination method based on community information. Digit. Signal Process. 2015, 40, 53–62. [Google Scholar] [CrossRef]
  12. Johannsen, F.; Drescher, M. Background removal from rapid-scan EPR spectra of nitroxide-based spin labels by minimizing non-quadratic cost functions. J. Magn. Reson. Open 2023, 16–17, 100121. [Google Scholar] [CrossRef]
  13. Mazet, V.; Carteret, C.; Brie, D.; Idier, J.; Humbert, B. Background removal from spectra by designing and minimising a non-quadratic cost function. Chemom. Intell. Lab. Syst. 2005, 76, 121–133. [Google Scholar] [CrossRef]
  14. Li, H.; Dai, J.; Pan, T.; Chang, C.; So, H.C. Sparse Bayesian learning approach for baseline correction. Chemom. Intell. Lab. Syst. 2020, 204, 104088. [Google Scholar] [CrossRef]
  15. Eilers, P.H.C. A perfect smoother. Anal. Chem. 2003, 75, 3631–3636. [Google Scholar] [CrossRef] [PubMed]
  16. Eilers, P.H.C.; Boelens, H.F.M. Baseline Correction with Asymmetric Least Squares Smoothing, Leiden University Medical Centre, The Netherlands. Available online: https://prod-dcd-datasets-public-files-eu-west-1.s3.eu-west-1.amazonaws.com/dd7c1919-302c-4ba0-8f88-8aa61e86bb9d (accessed on 9 November 2025).
  17. Peng, J.; Peng, S.; Jiang, A.; Wei, J.; Li, C.; Tan, J. Asymmetric least squares for multiple spectra baseline correction. Anal. Chim. Acta 2010, 683, 63–68. [Google Scholar] [CrossRef] [PubMed]
  18. Baek, S.-J.; Park, A.; Ahn, Y.-J.; Choo, J. Baseline correction using asymmetrically reweighted penalized least squares smoothing. Analyst 2015, 140, 250–257. [Google Scholar] [CrossRef]
  19. Zhang, Q.; Li, H.; Xiao, H.; Zhang, J.; Li, X.; Yang, R. An improved PD-AsLS method for baseline estimation in EDXRF analysis. Anal. Methods 2021, 13, 2037–2043. [Google Scholar] [CrossRef]
  20. Zhang, Z.M.; Chen, S.; Liang, Y.Z. Baseline correction using adaptive iteratively reweighted penalized least squares. Analyst 2010, 135, 1138–1146. [Google Scholar] [CrossRef]
  21. Zhang, F.; Tang, X.; Tong, A.; Wang, B.; Wang, J.; Lv, Y.; Tang, C.; Wang, J. Baseline correction for infrared spectra using adaptive smoothness parameter penalized least squares method. Spectrosc. Lett. 2020, 53, 222–233. [Google Scholar] [CrossRef]
  22. Cui, J.; Chen, X.; Zaho, Y. Beyond Traditional AirPLS: Improved Baseline Removal in SERS with Parameter-Focused Optimization and Prediction. Anal. Chem. 2025, 97, 16211–16218. [Google Scholar] [CrossRef]
  23. Fu, H.; Tian, Y.; Zha, G.; Xiao, X.; Zhu, H.; Zhang, Q.; Yu, C.; Sun, W.; Li, C.M.; Wei, L.; et al. Microstrip isoelectric focusing with deep learning for simultaneous screening of diabetes, anemia, and thalassemia. Anal. Chim. Acta 2024, 1312, 342696. [Google Scholar] [CrossRef]
  24. Shuyun, W.; Lin, F.; Pan, C.; Zhang, Q.; Tao, H.; Fan, M.; Xu, L.; Kong, K.V.; Chen, Y.; Lin, D.; et al. Laser tweezer Raman spectroscopy combined with deep neural networks for identification of liver cancer cells. Talanta 2023, 264, 124753. [Google Scholar] [CrossRef]
  25. Wójcik, S.; Ciepiela, F.; Baś, B.; Jakubowska, M. Deep learning assisted distinguishing of honey seasonal changes using quadruple voltammetric electrodes. Talanta 2022, 241, 123213. [Google Scholar] [CrossRef]
  26. Zhao, W.; Li, C.; Yan, C.; Min, H.; An, Y.; Liu, S. Interpretable deep learning-assisted laser-induced breakdown spectroscopy for brand classification of iron ores. Anal. Chim. Acta 2021, 1166, 338574. [Google Scholar] [CrossRef]
  27. Date, Y.; Kikuchi, J. Application of a Deep Neural Network to Metabolomics Studies and Its Performance in Determining Important Variables. Anal. Chem. 2018, 90, 1805–1810. [Google Scholar] [CrossRef] [PubMed]
  28. Lin, L.; Li, C.; Zhang, T.; Xia, C.; Bai, Q.; Jin, L.; Shen, Y. An in silico scheme for optimizing the enzymatic acquisition of natural biologically active peptides based on machine learning and virtual digestion. Anal. Chim. Acta 2024, 1298, 342419. [Google Scholar] [CrossRef]
  29. Ai, J.; Zhao, W.; Yu, Q.; Qian, X.; Zhou, J.; Huo, X.; Tang, F. SR-Unet: A Super-Resolution Algorithm for Ion Trap Mass Spectrometers Based on the Deep Neural Network. Anal. Chem. 2023, 95, 17407–17415. [Google Scholar] [CrossRef] [PubMed]
  30. Zhang, X.; Lin, T.; Xu, J.; Luo, X.; Ying, Y. DeepSpectra: An end-to-end deep learning approach for quantitative spectral analysis. Anal. Chim. Acta 2019, 1058, 48–57. [Google Scholar] [CrossRef]
  31. Cho, S.Y.; Lee, Y.; Lee, S.; Kang, H.; Kim, J.; Choi, J.; Ryu, J.; Joo, H.; Jung, H.T.; Kim, J. Finding Hidden Signals in Chemical Sensors Using Deep Learning. Anal. Chem. 2020, 92, 6529–6537. [Google Scholar] [CrossRef]
  32. Wu, K.; Luo, J.; Zeng, Q.; Dong, X.; Chen, J.; Zhan, C.; Chen, Z.; Lin, Y. Improvement in signal-to-noise ratio of liquid-state NMR spectroscopy via a deep neural network DN-Unet. Anal. Chem. 2021, 93, 1377–1382. [Google Scholar] [CrossRef]
  33. Kantz, E.D.; Tiwari, S.; Watrous, J.D.; Cheng, S.; Jain, M. Deep Neural Networks for Classification of LC-MS Spectral Peaks. Anal. Chem. 2019, 91, 12407–12413. [Google Scholar] [CrossRef] [PubMed]
  34. Liu, Y. Adversarial nets for baseline correction in spectra processing. Chemom. Intell. Lab. Syst. 2021, 213, 104317. [Google Scholar] [CrossRef]
  35. Jiao, Q.; Guo, X.; Liu, M.; Kong, L.; Hui, M.; Dong, L.; Zhao, Y. Deep learning baseline correction method via multi-scale analysis and regression. Chemom. Intell. Lab. Syst. 2023, 235, 104779. [Google Scholar] [CrossRef]
  36. Kazemzadeh, M.; Martinez-Calderon, M.; Xu, W.; Chamley, L.W.; Hisey, C.L.; Broderick, N.G.R. Cascaded Deep Convolutional Neural Networks as Improved Methods of Preprocessing Raman Spectroscopy Data. Anal. Chem. 2022, 94, 12907–12918. [Google Scholar] [CrossRef]
  37. Chen, T.; Son, Y.J.; Park, A.; Baek, S.J. Baseline correction using a deep-learning model combining ResNet and UNet. Analyst 2022, 147, 4285–4292. [Google Scholar] [CrossRef]
  38. Gao, C.; Zhao, P.; Fan, Q.; Jing, H.; Dang, R.; Sun, W.; Feng, Y.; Hu, B.; Wang, Q. Deep Neural Network: As the Novel Pipelines in Multiple Preprocessing for Raman Spectroscopy. Spectrochim. Acta—Part A Mol. Biomol. Spectrosc. 2023, 302, 123086. [Google Scholar] [CrossRef]
  39. Han, M.; Dang, Y.; Han, J. Denoising and Baseline Correction Methods for Raman Spectroscopy Based on Convolutional Autoencoder: A Unified Solution. Sensors 2024, 24, 3161. [Google Scholar] [CrossRef]
  40. Zhao, J.; Woznicki, T.; Kusnierek, K. Estimating Baselines of Raman Spectra Based on Transformer and Manually Annotated Data. Spectrochim. Acta—Part A Mol. Biomol. Spectrosc. 2025, 330, 125679. [Google Scholar] [CrossRef]
  41. Zhao, P.; Fan, Q.; Dang, R.; Cao, J.; Zhang, Y.; Feng, Y.; Hu, B.; Gao, C.; Wang, Q. Interference Data Denoising and Baseline Correction via a Multi-Scale Deep Denoising Network and Multidimensional Gradient-Consistent Regularization. Opt. Laser Technol. 2025, 192, 113849. [Google Scholar] [CrossRef]
  42. Chen, T.; Son, J.Y.; Dong, C.; Baek, S.-J. Baseline Correction of Raman Spectral Data Using Triangular Deep Convolutional Networks. Analyst 2025, 150, 2653–2660. [Google Scholar] [CrossRef]
  43. Baś, B.; Jakubowska, M.; Reczyński, W.; Ciepiela, F.; Kubiak, W.W. Rapidly renewable silver and gold annular band electrodes. Electrochim. Acta 2012, 73, 98–104. [Google Scholar] [CrossRef]
  44. Górski, Ł.; Sordoń, W.; Jakubowska, M. Voltammetric Determination of Ternary Phenolic Antioxidants Mixtures with Peaks Separation by ICA. J. Electrochem. Soc. 2017, 164, H42–H48. [Google Scholar] [CrossRef]
Figure 1. Architecture of the Convolutional Autoencoder (ConvAuto) model.
Figure 1. Architecture of the Convolutional Autoencoder (ConvAuto) model.
Applsci 15 12069 g001
Figure 2. Schematic representation of the ApplyModel procedure (green lines—additional points, orange—normalized/denormalized signal, red—background generated by ConvAuto, magenta—subtracted background).
Figure 2. Schematic representation of the ApplyModel procedure (green lines—additional points, orange—normalized/denormalized signal, red—background generated by ConvAuto, magenta—subtracted background).
Applsci 15 12069 g002
Figure 3. Procedure for generating simulated signals.
Figure 3. Procedure for generating simulated signals.
Applsci 15 12069 g003
Figure 4. Changes in loss values and learning rate during the training of the ConvAuto model.
Figure 4. Changes in loss values and learning rate during the training of the ConvAuto model.
Applsci 15 12069 g004
Figure 5. Application of the ConvAuto model to divers simulated signal sets: (A) SimSet 1 with 200 data points, (B) SimSet 2 with 2000 data points, (C) SimSet 3 with 2500 data points and (D) Simset 4 with 4000 data points (black lines—signal, red lines—background).
Figure 5. Application of the ConvAuto model to divers simulated signal sets: (A) SimSet 1 with 200 data points, (B) SimSet 2 with 2000 data points, (C) SimSet 3 with 2500 data points and (D) Simset 4 with 4000 data points (black lines—signal, red lines—background).
Applsci 15 12069 g005
Figure 6. Comparison of the baselines produced by the ConvAuto and ResUNet models.
Figure 6. Comparison of the baselines produced by the ConvAuto and ResUNet models.
Applsci 15 12069 g006
Figure 7. Baseline generation using the ConvAuto for experimental voltammetric signals corresponding to: (A) CRM 25.0 ± 0.1 µg·L−1 Pb(II) signals with additions of 0.75, 1.50, 2.25, 3.00 µg·L−1 Pb(II) and (B) ferulic, syringic, vanillic acid signals in concentration rage 1.15–5.80, 0.60–3.00, 0.50–2.50 mg·L−1, respectively.
Figure 7. Baseline generation using the ConvAuto for experimental voltammetric signals corresponding to: (A) CRM 25.0 ± 0.1 µg·L−1 Pb(II) signals with additions of 0.75, 1.50, 2.25, 3.00 µg·L−1 Pb(II) and (B) ferulic, syringic, vanillic acid signals in concentration rage 1.15–5.80, 0.60–3.00, 0.50–2.50 mg·L−1, respectively.
Applsci 15 12069 g007
Figure 8. Issues with ConvAuto baseline generation: (A) noisy fragments and (B) underfitted fragments.
Figure 8. Issues with ConvAuto baseline generation: (A) noisy fragments and (B) underfitted fragments.
Applsci 15 12069 g008
Table 1. Training results of the ConvAuto model.
Table 1. Training results of the ConvAuto model.
Loss (MAE)Metrics (RMSE)
Train0.00390.0093
Validate0.00220.0047
Test0.00220.0051
Table 2. Results of the ConvAuto model application and comparison with the ResUNet model for four simulated signal sets.
Table 2. Results of the ConvAuto model application and comparison with the ResUNet model for four simulated signal sets.
ConvAutoResUNet
MAERMSEMAERMSE
SimSet 10.00340.00450.00230.0030
SimSet 20.01920.02300.01140.0198
SimSet 30.01020.01200.01190.0224
SimSet 40.01980.02631.68391.7957
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Górski, Ł.; Jakubowska, M. Automatic Baseline Correction of 1D Signals Using a Parameter-Free Deep Convolutional Autoencoder Algorithm. Appl. Sci. 2025, 15, 12069. https://doi.org/10.3390/app152212069

AMA Style

Górski Ł, Jakubowska M. Automatic Baseline Correction of 1D Signals Using a Parameter-Free Deep Convolutional Autoencoder Algorithm. Applied Sciences. 2025; 15(22):12069. https://doi.org/10.3390/app152212069

Chicago/Turabian Style

Górski, Łukasz, and Małgorzata Jakubowska. 2025. "Automatic Baseline Correction of 1D Signals Using a Parameter-Free Deep Convolutional Autoencoder Algorithm" Applied Sciences 15, no. 22: 12069. https://doi.org/10.3390/app152212069

APA Style

Górski, Ł., & Jakubowska, M. (2025). Automatic Baseline Correction of 1D Signals Using a Parameter-Free Deep Convolutional Autoencoder Algorithm. Applied Sciences, 15(22), 12069. https://doi.org/10.3390/app152212069

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop