Papers
Topics
Authors
Recent
Search
2000 character limit reached

Gramian Angular Field (GAF)

Updated 4 July 2026
  • Gramian Angular Field (GAF) is a method that encodes 1D time series as 2D images by mapping normalized values to angular coordinates and assembling pairwise interactions.
  • It employs variants like GASF and GADF to preserve temporal ordering and expose structured image patterns, making it applicable in domains such as ECG, EEG, and autonomous vehicle behavior.
  • GAF integration with vision architectures—via direct substitution, channel fusion, or cross-modal fusion—offers improved classification performance, though results depend on robust preprocessing and scaling.

Gramian Angular Field (GAF) is a two-dimensional encoding of a one-dimensional ordered signal in which normalized sample values are mapped to angular coordinates, temporal indices are mapped to radii, and pairwise angular interactions are assembled into a square Gramian matrix. In the imaging-time-series formulation associated with Wang and Oates, GAF was introduced to spatially encode temporal correlations so that temporal data could be analyzed with computer-vision methods such as convolutional neural networks (Wang et al., 2015). Subsequent work has treated GAF as a representation layer for ECG, EEG, fMRI, anomalous diffusion trajectories, hyperspectral spectra, financial series, wearable gait signals, and autonomous-vehicle behavior, largely because it preserves temporal dependency while exposing structured image patterns to 2D models (Ahmad et al., 2021, You et al., 2023).

1. Concept and historical development

The original GAF program was framed as an off-line method for explicitly encoding temporal patterns spatially as images, alongside Markov Transition Fields, so that convolutional models could learn high-level features from temporal data (Wang et al., 2015). In that formulation, the attraction of GAF was not merely that it produced an image, but that the image retained an interpretable temporal geometry: time progresses from the top-left to the bottom-right, the main diagonal is special, and the resulting matrix can preserve information about the original series.

Later application papers restated the same rationale in domain-specific language. In ECG, GAF has been used as a heartbeat representation that preserves temporal correlation through angular encoding and pairwise cosine interactions, so that AlexNet or other CNNs can operate on heartbeats as images rather than on handcrafted features or raw 1D vectors (Ahmad et al., 2021). In autonomous-vehicle behavior analysis, GAF is described as capturing pairwise angular relationships between points in multivariate behavior sequences and converting those sequences into multi-channel images for Vision Transformer classification (You et al., 2023). Across these settings, the recurring conceptual role of GAF is the same: it acts as a bridge from sequential structure to spatial structure.

2. Mathematical formulation and principal variants

The canonical construction starts from a real-valued time series

X={x1,x2,,xn}.X=\{x_1,x_2,\dots,x_n\}.

A first step rescales the series into a bounded interval. The original imaging-time-series formulation gives both

x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}

for scaling to [1,1][-1,1], and

x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}

for scaling to [0,1][0,1] (Wang et al., 2015). Later implementations instantiate both choices: ECG heartbeat imaging in the IFM pipeline explicitly rescales to [0,1][0,1] before angular encoding (Ahmad et al., 2021), whereas EEG epilepsy diagnosis and inferior myocardial infarction detection use the [1,1][-1,1] form before applying arccos\arccos (Thanaraj et al., 2020, Yousuf et al., 2023).

After rescaling, the series is represented in polar form by encoding the value as an angle and the timestamp as a radius: ϕi=arccos(x~i),ri=tiN.\phi_i=\arccos(\tilde{x}_i), \qquad r_i=\frac{t_i}{N}. The two standard Gramian variants are then formed by pairwise trigonometric interactions: GASFi,j=cos(ϕi+ϕj),GADFi,j=sin(ϕiϕj).\mathrm{GASF}_{i,j}=\cos(\phi_i+\phi_j), \qquad \mathrm{GADF}_{i,j}=\sin(\phi_i-\phi_j). The original paper writes the summation-field matrix in closed form as

x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}0

and later hyperspectral work gives the same GASF and GADF identities in expanded algebraic form over normalized inputs (Wang et al., 2015, Paheding et al., 2022).

The distinction between the two variants is operationally important. GASF uses cosine of angular sums and is the form used in many ECG and trajectory papers (Ahmad et al., 2021, Garibo-i-Orts et al., 2023). GADF uses sine of angular differences and is explicit in EEG attention regression, ECG myocardial infarction detection, and some multichannel representations (Kothari et al., 2021, Yousuf et al., 2023). Several papers mention both variants conceptually but implement only one; others concatenate both as complementary image channels.

3. Representation properties and image organization

A GAF image has native size x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}1 for an input of length x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}2, because every time point is paired with every other time point. This representation preserves temporal ordering through matrix coordinates, while the main diagonal stores transformed self-information. In the summation-field case,

x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}3

and the original formulation notes that the normalized series can be approximately reconstructed from the diagonal via

x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}4

This diagonal structure is one reason GAF has been treated as more interpretable than some alternative time-series image encodings (Wang et al., 2015).

Practical systems rarely stop at a single grayscale matrix. Multivariate or multi-sensor data are commonly transformed channelwise and then stacked. In candlestick classification, four feature sequences—either OHLC or CULR—are each converted to a x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}5 GASF image and stacked into a x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}6 tensor (Chen et al., 2019). In EEG attention regression, each of 14 electrodes is transformed independently into a GADF image, and the 14 images are stacked into a single 14-channel tensor (Kothari et al., 2021). In autonomous-vehicle behavior analysis, each of the three behavior variables is transformed into both GASF and GADF, and the resulting images are concatenated into a multi-channel representation (You et al., 2023). In ECG multimodal fusion, GAF, recurrence plot, and Markov Transition Field are treated as three orthogonal channels “like three different colors in RGB image space” (Ahmad et al., 2021).

Resizing is also common, because downstream vision backbones usually expect fixed spatial dimensions. ECG heartbeats of length 187 imply a native x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}7 GAF, but AlexNet-based pipelines resize the images to x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}8 (Ahmad et al., 2021). EEG epochs of 256 samples yield x~1i=(ximax(X))+(ximin(X))max(X)min(X)\tilde{x}^{\,i}_{-1}=\frac{(x_i-\max(X))+(x_i-\min(X))}{\max(X)-\min(X)}9 GASF images that are subsequently prepared for [1,1][-1,1]0 CNN input through pseudocolor and resizing (Thanaraj et al., 2020). Inferior myocardial infarction detection converts 651-sample beats into [1,1][-1,1]1 grayscale images, although the paper does not fully specify whether resizing is applied before or after native Gramian formation (Yousuf et al., 2023).

4. Integration with learning architectures

GAF has been coupled to a wide range of vision architectures. The earliest benchmark study used Tiled CNNs with Topographic ICA pretraining and a final linear soft-margin SVM on GAF, MTF, and GAF-MTF images (Wang et al., 2015). Later biomedical work used transfer-learning style image classifiers such as AlexNet, VGG16, and VGG19 on GASF-derived EEG images, alongside a custom CNN specifically designed for those images (Thanaraj et al., 2020). In anomalous diffusion analysis, GAF images enable the use of pretrained ResNet and MobileNet backbones on short noisy trajectories (Garibo-i-Orts et al., 2023).

The representation has also been embedded in explicitly multimodal systems. GAF-FusionNet treats GAF as one of two primary modalities, pairing a GAF image branch with a raw time-series branch and fusing the resulting features through a dual-layer cross-channel split attention module; in the ablation study, the GAF-only branch slightly outperformed the time-series-only branch on MIT-BIH, while the fused system was best overall (Qin et al., 2024). In autonomous-vehicle behavior recognition, GAF-generated multichannel images are reweighted by a channel-attention module and then passed to a multi-channel Vision Transformer (You et al., 2023). In hyperspectral image classification, single-pixel spectra are converted into GASF and GADF images and then processed by a neighborhood-attention U-Net rather than by a 1D spectral model (Paheding et al., 2022).

These architectures reflect three distinct integration patterns. One is direct substitution, in which GAF simply replaces the raw sequence as the model input. Another is channelwise fusion, in which GAF is combined with other 2D encodings such as RP or MTF. A third is cross-modal fusion, in which the raw 1D sequence and the GAF image are processed in parallel and merged later. The literature now contains examples of all three.

5. Application domains and empirical record

The empirical record is broad rather than uniform. Many biomedical classification tasks report strong gains from GAF-based encodings, whereas some forecasting tasks do not.

Domain Representative finding Paper
ECG heartbeat classification GAF alone reached 97.3% accuracy on MIT-BIH and 98.4% on PTB; the fused IFM reached 98.6% and 98.4% (Ahmad et al., 2021)
Inferior MI detection from lead II ECG Best result was 99.84% accuracy with GADF after noise and baseline-wander removal (Yousuf et al., 2023)
EEG epilepsy diagnosis Custom CNN on GASF images achieved average Precision 0.885, Recall 0.92, F1-score 0.90, and AUC 0.92 (Thanaraj et al., 2020)
fMRI BOLD categorization Single CNN with GASF achieved 0.87 mean 3-class accuracy, GADF 0.85, and parallel GAF+MTF 0.94 (Kancharala et al., 2023)
Anomalous diffusion trajectories GASF/ResNet reached F1-score 0.581 and AUC 0.89; GADF/ResNet achieved MAE 0.33 for [1,1][-1,1]2 regression (Garibo-i-Orts et al., 2023)
Freezing-of-gait detection Single-axis AccV GAF achieved 96.3% accuracy and 96.3% F1 (Soumma et al., 2024)
AV driving behavior classification GAF-ViT achieved Accuracy 0.9209 and F1 0.8747 (You et al., 2023)
Pixel-wise HSI classification GAF-NAU reached OA 81.07 on Indian Pines, 91.12 on University of Pavia, and 94.59 on Salinas Valley (Paheding et al., 2022)

Financial and market applications have also used GAF successfully in some classification settings. Encoding candlesticks as multichannel GASF images yielded 90.7% average accuracy on real-world EUR/USD data and outperformed an LSTM baseline (Chen et al., 2019). By contrast, transfer learning in stock forecasting uses GAF differently: it converts source and target series into GAF images so that similarity functions such as CORAL or CMD can select more appropriate source domains before DNN or LSTM training (Long et al., 1 Apr 2025).

A clear pattern emerges from these results. GAF is repeatedly effective in classification and representation-learning settings where discriminative structure lies in morphology, temporal correlation, or pairwise dynamics. It is also effective when multichannel composition itself is informative, as in EEG electrodes, accelerometer axes, driving features, or hyperspectral bands.

6. Limitations, methodological caveats, and common misconceptions

The literature also shows substantial methodological variability. Preprocessing details are often underreported. The ECG IFM paper specifies lead II, resampling to 125 Hz, heartbeat length 187 for MIT-BIH, normalization to [1,1][-1,1]3, and resizing to [1,1][-1,1]4, but it does not describe R-peak detection, explicit heartbeat windowing, denoising, or baseline-wander removal (Ahmad et al., 2021). The inferior-MI ECG paper gives explicit beat extraction around R-peaks and explicit GASF/GADF formulas, but does not specify the interpolation or resizing step that maps 651-sample beats to [1,1][-1,1]5 images (Yousuf et al., 2023). The fMRI pilot study omits the exact GAF image size [1,1][-1,1]6, the exact subsequence lengths after splitting by dataset, and whether resizing was applied (Kancharala et al., 2023). The freezing-of-gait paper reports [1,1][-1,1]7 GAF inputs from 4-second windows at 64 Hz, but does not explicitly state how 256 samples become [1,1][-1,1]8 images (Soumma et al., 2024).

Normalization conventions are similarly heterogeneous. Some pipelines use [1,1][-1,1]9, some use x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}0, and some describe both a mean-centering or z-score stage and a later min-max stage before angular encoding (Ahmad et al., 2021, Soumma et al., 2024). This matters because x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}1 imposes a hard domain constraint, and small changes in scaling alter the image numerics even when the downstream architecture is unchanged.

Because every pixel depends on a pair of time indices, a plausible implication is quadratic native image growth with sequence length. That implication is consistent with the original reliance on Piecewise Aggregate Approximation before GAF construction and with later widespread post-encoding resizing (Wang et al., 2015). The growth is not only a memory issue; it can also alter the inductive bias of the system, because aggressive downsampling or resizing may erase the very correlations the encoding was meant to preserve.

A common misconception is that GAF is universally beneficial once a task is recast as image recognition. The bond-index forecasting study directly contradicts that view: CNN-GAF models produced uniformly negative out-of-sample x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}2 on levels, returns, and fractionally differenced series, and the authors concluded that GAF-based CNNs are better suited to pattern-based tasks than to persistence-dominated next-step prediction (Verma et al., 27 May 2026). The limitation is therefore not merely implementation noise; it is a representational mismatch in some forecasting regimes.

7. Extensions and current directions

Recent work has pushed GAF beyond its classical formulation in three directions: alternative construction rules, domain-adaptive similarity, and privacy-preserving deployment. Quantum Gramian Angular Field (QGAF) replaces explicit normalization and inverse-cosine calculation with single-qubit x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}3 rotations and measurement probabilities, and the reported stock-return experiments show average error reductions of 25% in MAE and 48% in MSE relative to classical GAF (Xu et al., 2023). This is a direct attempt to modify the encoding stage itself rather than only the downstream classifier.

Another direction treats GAF as a representation for domain comparison rather than end-task classification. In financial transfer learning, source and target time series are first converted into GAF images and then compared with similarity functions; under that protocol, Coral (GAF) for DNN and CMD (GAF) for LSTM are reported as the strongest choices across several source-selection settings (Long et al., 1 Apr 2025). Here GAF is not the final predictive modality but the basis for source-domain selection.

A third direction is deployment under decentralized or resource-constrained conditions. In federated ECG classification, 1D ECG signals are transformed locally into x~0i=ximin(X)max(X)min(X)\tilde{x}^{\,i}_{0}=\frac{x_i-\min(X)}{\max(X)-\min(X)}4 GAF images and used to train a CNN across a server, a laptop, and a Raspberry Pi 4; the multi-client setup achieved 95.18% test accuracy versus 87.30% for the single-client baseline (Elmir et al., 4 Nov 2025). That work also makes an important conceptual distinction: privacy is provided by federated learning, not by GAF itself.

Taken together, these developments indicate that GAF has evolved from a specific imaging-time-series construction into a broader representational family. The core idea remains stable—angular encoding plus pairwise temporal interaction—but current work explores where in the pipeline GAF should appear, how it should be parameterized, and when it is preferable to raw sequential modeling.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (16)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Gramian Angular Field (GAF).