A light curve, an electrocardiogram, and a vibration signal can all be stored as an ordered sequence of measurements. They can also be drawn as images. This creates a tempting question: if a convolutional neural network can recognize patterns in an image, should we turn every time series into a picture before classifying it?
A 1D CNN slides filters along the numerical sequence. A 2D CNN slides filters across a raster representation of that sequence. Both can recognize curve morphology, but they encode different assumptions about which patterns should be easy to learn.
The useful comparison combines three things: what information reaches the classifier, how much computation the chosen architecture performs, and how well a trained model generalizes. We can prove statements about the first two and measure parts of the third. Keeping their logical roles clear prevents a fast implementation from being mistaken for an accuracy theorem.
The calculations below culminate in two synthetic classification experiments, an exact numerical equivalence check, and a rasterization counterexample. The complete Python code, raw results, and original figures accompany this draft.
What does “more efficient” mean?
There are several reasonable objectives, and they need not favor the same model.
| Objective | Quantity to compare |
|---|---|
| Classification quality | Error, macro-F1, or another task-appropriate metric on unseen series |
| Statistical efficiency | Number of independent labeled series needed for a target error |
| Inference efficiency | Arithmetic, latency, throughput, and memory per prediction |
| Training efficiency | Total cost of reaching a target validation quality |
| Representation efficiency | Cost and fidelity of preprocessing, storage, and transfer |
In particular, equal epoch counts do not imply equal computation. Equal parameter counts do not imply equal arithmetic. Equal information in the inputs does not imply that two restricted CNNs can express the same decision rules.
This post studies ordinary dense convolutions on numerical samples and controlled pixel plots. A spectrogram, recurrence plot, or wavelet map is a different representation with a different geometric structure; conclusions about ordinary curve plots should not automatically be transferred to those encodings.
One classification problem, two representations
Let
for the image produced by a fixed, label-independent renderer. All information used by the renderer, including timestamps if applicable, must be included in
Define the Bayes errors
The infima range over all measurable classifiers, without restricting their architecture. Every image classifier can be evaluated from the original measurements by computing
If a decoder
An associated information-theoretic bound, with information measured in nats, is
Small loss of class information bounds the increase in optimal classification error [1]. Evaluating that information loss from finite high-dimensional data is itself difficult.
An image can still help a finite model. It rearranges the problem into geometric features that may fit that model's inductive bias. Empirically, ordinary line-plot CNNs have been competitive on some time-series datasets: Rodrigues and collaborators investigated this directly [2]. Such results motivate experiments; they do not establish a universal ordering of 1D and 2D architectures.
A pixel plot that is exactly reversible
To compare the networks without changing the information available to them, first quantize each measured amplitude using the same fixed range
Assume the observations are within range; otherwise clipping introduces an additional error. Construct an
The decoder is explicit:
Thus the quantized numerical sequence and its pixel plot are information-equivalent. Quantization may discard information relative to the original measurements, but it does so equally for both CNN inputs. One time column per observation avoids temporal compression, and a fixed amplitude scale avoids silently removing mean level or variability amplitude.
Figure 1. The controlled representation used below. The 1D model receives the blue quantized samples. The 2D model receives exactly their pixel encoding. These images contain no axes, labels, color coding, connecting line segments, or other metadata.
This construction is deliberately simpler than a plotting-library screenshot. It lets us isolate information equivalence before studying the effects of line thickness, resizing, antialiasing, and per-plot scaling.
An exact 2D implementation of a 1D CNN
There is also a useful equivalence at the network level. Take a conventional 1D CNN
The pixel decoder can be implemented by a fixed 2D convolution with an
The resulting image network
The equality holds in exact arithmetic. Predictions and training objectives coincide, as do corresponding parameter gradients wherever the derivatives are defined, with matching conventions at nondifferentiable activations. The fixed decoder adds no trainable parameters.
With a straightforward dense decoder, the additional arithmetic is
This proves that a 2D implementation can simulate the 1D classifier. It does not say that every 2D model must pay this decoding overhead, or that a model retaining a nontrivial image height has the same hypothesis class.
The accompanying code compares the decoder, logits, and gradients for a random model and a batch of 16 series. The executed float32 check produced:
| Numerical check | Maximum absolute difference |
|---|---|
| Decoded samples versus quantized samples | 0.0e+00 |
| Logits of 1D model versus exact 2D simulation | 0.0e+00 |
| Corresponding parameter gradients | 0.0e+00 |
All predicted labels agreed. Zero difference in this execution is a numerical observation; equivalent implementations can differ by floating-point roundoff on other backends.
Counting arithmetic, parameters, and activations
Now consider architectures that retain a genuine two-dimensional feature map. For a standard dense convolution, excluding bias additions, the multiply–accumulate counts per series are
Here
If corresponding layers share channel counts, temporal widths, and temporal output lengths, so
Summing convolutional layers gives a weighted average:
and therefore the bounds
These are arithmetic bounds for the specified dense layer evaluations, rather than lower bounds for all algorithms computing those functions. They exclude pooling, activations, and the head, whose costs can be counted separately.
Ignoring biases, the corresponding kernel parameter counts are
If
Resolution can impose a classification floor
Suppose two equally likely constant series have amplitudes just below and just above a threshold inside one quantization cell. Their original numerical values determine the labels perfectly, but their pixel plots are identical. No image classifier can distinguish them:
The same floor applies to a numerical classifier if it receives those quantized values. The failure belongs to the encoding, rather than to convolution dimensionality.
Figure 2. An exact two-point counterexample, also checked in the Python script. With
A regularity assumption permits a more useful resolution bound. For binary classification, let
For unclipped cell-center quantization,
Since the best classifier on the quantized representation is at least as good as this hypothetical one,
This elementary plug-in argument is related to the broader theory of classification under regularity and margin assumptions [4]. It is conditional on the stated Lipschitz property, whose constant is generally unknown. The sharp-threshold counterexample violates that property. If clipping occurs with probability
Increasing
The numerical experiment
The experiments use two balanced binary tasks, each with
Oscillations. The observations follow
Transients. Class 0 contains one Gaussian peak of width 0.06. Class 1 contains two peaks of width 0.025, displaced by
For each task, independent generation seeds produce 512 training, 128 validation, and 512 test series, balanced within each split. No generated observation exceeds
Each network has three convolution–ReLU–max-pooling blocks with 8, 16, and 24 channels. The 1D kernels have width 5; the 2D kernels have shape
Both use Adam with learning rate 0.003, batch size 64, and 25 epochs. The checkpoint with minimum validation cross-entropy is evaluated once on the test split. Training configurations are run in a reproducibly shuffled order. The procedure deliberately matches channel counts and training updates, not parameter count or computational budget. It is a controlled illustration, not an architecture-selection contest.
Arithmetic and measured latency
The counted model resources are:
| Input and model | Trainable parameters | MACs / series | Float32 input bytes |
|---|---|---|---|
| 1D, N = 128 | 2,698 | 107,568 | 512 |
| 2D, H = 16, W = 128 | 7,898 | 1,966,128 | 8,192 |
| 2D, H = 32, W = 128 | 7,898 | 3,932,208 | 16,384 |
| 2D, H = 64, W = 128 | 7,898 | 7,864,368 | 32,768 |
MAC totals include the convolutional layers and linear head, but exclude pooling, ReLU, and preprocessing. Input bytes assume float32 tensors; they are not total process or peak training memory. The implementation records layer shapes, parameter bytes, and convolution-output tensor sizes separately.
For the
The actual CPU timings were obtained using Python 3.12.14, NumPy 2.3.5, PyTorch 2.5.1+cpu, float32 tensors, and two PyTorch compute threads on an AMD EPYC 9V45 96-Core Processor. This is a shared execution environment, not a dedicated workstation benchmark.
Inference runs in evaluation and inference modes. Eight explicit warm-up calls precede torch.utils.benchmark.Timer.blocked_autorange, with the thread count set explicitly and a minimum measurement duration of 0.4 seconds. The benchmark utility performs additional adaptive warm-up and repeated measurements [5]. Model initialization, preprocessing, training, and compilation are outside these timings; no graph compilation is enabled.
| Model | Batch-1 median (ms) | Batch-1 IQR width (ms) | Batch-64 median / 64 (ms per series) |
|---|---|---|---|
| 1D | 0.0479 | 0.0031 | 0.0033 |
| 2D, H = 16 | 0.1169 | 0.0076 | 0.0514 |
| 2D, H = 32 | 0.1970 | 0.0034 | 0.1020 |
| 2D, H = 64 | 0.3351 | 0.0248 | 0.3161 |
IQR is the interquartile-range width of repeated timing measurements, not a statistical confidence interval for generalization. Batch-64 time divided by 64 measures amortized processing cost; it is not the latency experienced by a single request waiting for a batch to form.
Figure 3. Analytical convolution counts and measured inference medians. The 1D baseline is dashed. The image-model arithmetic grows with height, while the timing ratios depend on batching and implementation.
At
Preprocessing is inexpensive in this particular in-memory encoder but is still measurable. For the 512 oscillation training curves, median quantization took 0.081 ms, and allocating and filling the additional image tensors took 0.271 ms. These medians come from nine calls. They exclude disk I/O, transfer to an accelerator, and any plotting-library screenshot rendering.
What the classifiers learned
| Task | Model | Test accuracy, mean ± SD | Macro-F1, mean ± SD | Training seconds, mean ± SD |
|---|---|---|---|---|
| Oscillations | 1D | 100.00 ± 0.00% | 1.000 ± 0.000 | 0.290 ± 0.007 |
| Oscillations | 2D | 100.00 ± 0.00% | 1.000 ± 0.000 | 3.228 ± 0.081 |
| Transients | 1D | 100.00 ± 0.00% | 1.000 ± 0.000 | 0.303 ± 0.014 |
| Transients | 2D | 80.53 ± 26.77% | 0.750 ± 0.363 | 2.923 ± 0.086 |
The dispersions are sample standard deviations across three training seeds on one fixed data split. They are not confidence intervals over new datasets. Training seconds cover all 25 optimization epochs, including batch indexing and gradient updates, but exclude validation, initialization, and representation construction. Training-plus-validation times are also retained in the raw JSON and CSV.
Figure 4. Bars show means, error bars show sample standard deviations, and black points show individual training seeds. The synthetic tasks are intentionally small. Zero observed test errors do not establish zero population error.
Both models reached perfect observed test accuracy on oscillations under this recipe. On transients, all three 1D runs reached 100%, while the 2D runs reached 100%, 91.60%, and 50%. The validation histories show substantial optimization variability in the image model:
Figure 5. Individual validation trajectories. The chance-level image run remains near 50% through the allocated training budget. Other image runs learn the same task, demonstrating why a failed optimization run cannot establish an information-theoretic limitation.
The selected checkpoint was epoch 25 in every run. The experiment shows that the numerical architecture was faster and more reliable under these particular settings. It does not show that every 2D CNN is worse on transients, or that the learning rate and width choices were equally suitable for both architectures.
The timing and accuracy comparisons answer different questions. A checkpoint selected from 25 equal-budget epochs describes one training procedure. A comparison of the cheapest models reaching the same accuracy would need an additional search over architectures and optimization settings, with the search costs recorded.
Accuracy at a computational budget
For fixed model families and a stated cost measure, one useful theoretical quantity is
An empty feasible set has value
A comparison of
For a fitted classifier frozen before inspecting an independent test set, Hoeffding's inequality gives a simple computable certificate. For
simultaneously with probability at least
A confidence interval for a trained classifier still does not bound the optimal error of its entire architecture family. This is why benchmark outcomes and analytical lower bounds should be presented as different kinds of evidence.
Reproducing and extending the comparison
The companion files contain experiments.py, build_figures.py, raw JSON and CSV results, per-seed predictions, and the original SVG and PNG figures. On a compatible Python environment, the CPU reproduction commands are:
python -m pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu
python -m pip install -r requirements.txt
python experiments.py --epochs 25 --threads 2 --seeds 42 43 44
python build_figures.py
python build_post.py
The package records the tested dependency versions. Other hardware or library versions may change timings and floating-point training trajectories. The mathematical decoder identity and arithmetic counts do not depend on a particular runtime measurement.
The central encoder is short enough to inspect directly:
step = (high - low) / height
codes = np.floor((x - low) / step).astype(np.int64)
quantized = low + (codes + 0.5) * step
image = np.zeros((len(x), 1, height, x.shape[-1]), np.float32)
image[np.arange(len(x))[:, None], 0, codes,
np.arange(x.shape[-1])[None, :]] = 1.0
Here the inputs must already be within the fixed range. The full implementation validates the generated data and handles index bounds explicitly.
For a broader study, the next experiments would compare equal-parameter and equal-computation budgets, repeat independently generated datasets, and sweep learning rate, width, and image resolution using validation data. Pretrained image models would constitute an additional regime because external training data change the comparison. Strong temporal baselines such as InceptionTime should also be included before making a practical architecture recommendation [6].
Astronomical light curves add another requirement: preserving observation times, uncertainties, and missingness consistently. Feeding only flux values to a standard 1D CNN while a plot encodes irregular timestamps creates an information mismatch. Likewise, normalizing each curve independently can remove an amplitude or offset that the scientific classification depends on.
In this controlled experiment, numerical convolution avoids substantial image-processing work while retaining the same quantized observations. The general mathematical result is narrower: the specified dense architectures have calculable resource ratios, reversible encodings preserve optimal classification error, and lossy rendering can impose an irreducible floor. Whether a different image representation earns back its cost through a better learning bias remains a task-specific question that can be tested with the same discipline.
References
- Györfi, L., Linder, T., and Walk, H. (2023). Lossless Transformations and Excess Risk Bounds in Statistical Inference. Entropy 25, 1394. Article and proofs.
- Rodrigues, N. M., Batista, J. E., Trujillo, L., Duarte, B., Giacobini, M., Vanneschi, L., and Silva, S. (2021). Plotting time: On the usage of CNNs for time series classification. arXiv:2102.04179.
- PyTorch documentation. Conv1d and Conv2d. These document the convolution definitions; the arithmetic counts in this post are derived by counting their dense evaluations.
- Audibert, J.-Y., and Tsybakov, A. B. (2007). Fast learning rates for plug-in classifiers. Annals of Statistics 35, 608–633. Author-hosted paper. The elementary quantization lemma above is derived explicitly here; no minimax rate from this paper is asserted for the numerical experiments.
- PyTorch documentation. Benchmark utilities and benchmarking tutorial.
- Ismail Fawaz, H., and collaborators (2020). InceptionTime: Finding AlexNet for Time Series Classification. Data Mining and Knowledge Discovery 34, 1936–1962. Paper.