Manuscript Offprint

arXiv:2609.30955

Flow-TAG: Flow-based conditional latent transport for accurate spline approximation and data compression

Roman Pavelkin, Luis A. Zavala-Mondragon, Fons van der Sommen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Robust curve fitting is essential in computer-aided design for transforming noisy, discrete data into accurate geometric models that ensure numerical stability across engineering workflows. B-spline models have become the industry standard for this task, offering a flexible and reliable framework characterized by local control and smooth shape representation. This paper presents flow-TAG—a data-driven framework based on a generative flow model with a 1D U-Net backbone capable of mapping the geometry of a curve to the optimal parametrization for cubic B-splines. By leveraging learned geometric patterns, flow-TAG exhibits superior parameterization performance, robustness to noise in the input data, and strong generalization capability to previously unseen 2D and 3D curves drawn from distinct data distributions. Flow-TAG yields fitted curves that achieve the lower root-mean-square error (55% lower on average) and Hausdorff distance (52% lower on average) relative to state-of-the-art data-driven methods. In addition, we investigate the practical applicability of our generative framework in the compression of ECG signals for wearable devices. The proposed compression setup provides a compression ratio of 13 with the signal distortion of ≈5%\approx 5\%, which is acceptable in the field.

Keywords Curve fitting · B-spline approximation optimization · flow matching · generative models · latent transport · ECG compression

1 Introduction

Robust curve fitting is crucial in Computer-Aided Design (CAD) as it underpins the creation of geometric models essential for design and manufacturing [1]. Curves are typically derived from discrete data which can suffer from noise and irregular sampling. Effective curve fitting is necessary to accurately represent shapes, ensuring smoothness and numerical stability. However, it can be noted that poor fitting can introduce errors and undermine design intent. This reliability is vital for applications in surface modeling [2], tool path generation ([3, 4]), and finite element analysis [5], making robust curve fitting methods essential for efficient engineering workflows.

Spline-based models have become a standard tool for curve approximation in CAD due to their flexibility, numerical stability, and strong theoretical foundation [2]. Among them, B-splines are particularly prominent because they provide a compact representation with desirable properties such as local support, smoothness control, and affine invariance [6]. A B-spline curve is defined by a set of control points, a polynomial degree, and a non-decreasing knot vector, which together determine the shape of the curve. The parametrization of the curve—i.e., the assignment of parameter values to data points—plays a crucial role in the quality of approximation, as it influences how the basis functions are evaluated and how geometric features are distributed along the curve. Common parametrization strategies include uniform, chord-length, and centripetal methods, each offering different trade-offs between simplicity and fidelity to the underlying geometry [7]. The combination of flexible parametrization and the inherent locality of B-spline basis functions makes spline-based approaches particularly well-suited for approximating complex shapes encountered in real-world design tasks.

Flow-TAG: Flow-based conditional latent transport for accurate spline approximation and data compression

In recent years, data-driven approaches have been increasingly explored to improve curve parametrization for B-spline fitting, addressing limitations of classical heuristic methods such as uniform or chord-length parametrization ([8, 9]). Machine learning techniques, particularly neural networks, enable the estimation of parameter values directly from data by learning underlying geometric patterns and noise characteristics [10]. These methods aim to produce parametrizations that lead to improved approximation accuracy and robustness, especially for complex or highly irregular curves. A dedicated Section 3.1 later in the manuscript provides a detailed discussion of the principal contributions on neural parametrization for B-spline fitting; therefore, we do not elaborate further on this topic at this point.

Within the scope of the stated problem, the aim of this study is to develop a data-driven framework capable of mapping the geometry of a curve to the optimal positions of spline knots by leveraging learned geometric patterns. In such a model, the knot vector serves as a latent representation of the curve being approximated.

We demonstrate how, using a generative flow-based model with a 1D U-Net backbone, it is possible to learn the geometry of 2D and 3D curves and map it into a knot vector. Ultimately, we introduce flow-TAG: flow-based Task-Aware Generative framework for conditional latent transport for accurate spline approximation. The framework combines several original design solutions, including: 1) redefining the B-spline functional via a 1D U-Net deep learning model; 2) training with the self-tuning multi-task geometry-informed loss function, which combines both the flow matching term and the curve fidelity term (task loss). As a result, flow-TAG exhibits superior parameterization performance (the resulting knot vectors produce the highest-quality spline approximation among all evaluated baseline methods), robustness to noise in the input data, and strong generalization capability to previously unseen curves drawn from distinct data distributions.

In addition to evaluating the intrinsic accuracy of the approximations of abstract curves, we also investigate the practical applicability of flow-TAG to real medical data that can be represented by splines. Specifically, we employ flow-TAG as the backbone to perform compression of ECG recordings [11]. The results of our tests clearly demonstrate the potential of using flow-TAG in the compression of ECG signals for wearable devices.

The body of the paper consists of the following parts: Section 2 includes the rigorous problem statement; Section 3 outlines the baselines of the data-driven neural B-spline curve fitting and curve compression methods; Section 4 provides the theoretical underpinning of the proposed framework, description of the dataset used in the study, and essential notes on the experiments; Section 5 contains the experimental outcomes and their discussion; lastly, in Section 6, we analyze the impact of the study, discuss the limitations of flow-TAG, and potential future research interests in this regard. The paper is accompanied by Appendices that provide additional methodological and implementation details for interested readers.

References (33)

  • Industrial geometry: recent advances and applications in CAD. Computer-Aided Design, 37(7):751–766, 2005
  • A new format for 5-axis tool path computation, using Bspline curves
  • Recent development in CNC machining of freeform surfaces: A state-of-the-art review
  • Isogeometric analysis: CAD, finite elements, NURBS, exact geometry and mesh refinement
  • Bézier and B-spline techniques, volume 6
  • The NURBS book
  • Learnt knot placement in B-spline curve approximation using support vector machines
  • A Hybrid Parametrization Method for B-Spline Curve Interpolation via Supervised Learning
  • Deep learning
  • The impact of the MIT-BIH arrhythmia database
  • Deep learning parametrization for B-spline curve approximation
  • Parameterization for polynomial curve approximation via residual deep neural networks
  • The deep neural network solver for B-spline approximation
  • B-spline curve approximation with transformer neural networks
  • SplineGen: Approximating unorganized points through generative AI. Computer-Aided Design, 178:103809, 2025
  • Spline-Based Shape Compression for Interventional Device Tracking
  • ECG compression using optimized B-spline
  • Compression of electrocardiogram signals using JPEG 2000
  • ECG compression based on empirical mode decomposition and tunable-Q wavelet transform with validation using heartbeat classification
  • ECG signal de-noising and baseline wander correction based on CEEMDAN and wavelet threshold
  • ECG signal compression based on optimization of wavelet parameters and threshold levels using evolutionary techniques
  • Electrocardiogram signal compression using adaptive tunable-Q wavelet transform and modified dead-zone quantizer
  • An efficient compression of ECG signals using deep convolutional autoencoders
  • A novel multichannel sparse convolutional autoencoder for electrocardiogram signal compression
  • U-net: Convolutional networks for biomedical image segmentation
  • A unified framework for U-Net design and analysis
  • The Principles of Diffusion Models
  • Flow Matching for Generative Modeling
  • Multi-task learning using uncertainty to weigh losses for scene geometry and semantics
  • Fast automatic knot placement method for accurate B-spline curve fitting
  • Differentiable Fast Top-K Selection for Large-Scale Recommendation (opens arXiv in a new tab)
  • The weighted diagnostic distortion (WDD) measure for ECG signal compression
  • Adam: A Method for Stochastic Optimization