Solving Large-scale Spatial Problems with Convolutional Neural Networks
Over the past decade, deep learning research has been accelerated by
increasingly powerful hardware, which facilitated rapid growth in the model
complexity and the amount of data ingested. This is becoming unsustainable and
therefore refocusing on efficiency is necessary. In this paper, we employ
transfer learning to improve training efficiency for large-scale spatial
problems. We propose that a convolutional neural network (CNN) can be trained
on small windows of signals, but evaluated on arbitrarily large signals with
little to no performance degradation, and provide a theoretical bound on the
resulting generalization error. Our proof leverages shift-equivariance of CNNs,
a property that is underexploited in transfer learning. The theoretical results
are experimentally supported in the context of mobile infrastructure on demand
(MID). The proposed approach is able to tackle MID at large scales with
hundreds of agents, which was computationally intractable prior to this work.
Damian Owerko, Charilaos I. Kanatsoulis, Alejandro Ribeiro
# Solving Large-scale Spatial Problems with Convolutional Neural Networks

###### Abstract

Over the past decade, deep learning research has been accelerated by increasingly powerful hardware, which facilitated rapid growth in the model complexity and the amount of data ingested. This is becoming unsustainable and therefore refocusing on efficiency is necessary. In this paper, we employ transfer learning to improve training efficiency for large-scale spatial problems. We propose that a convolutional neural network (CNN) can be trained on small windows of signals, but evaluated on arbitrarily large signals with little to no performance degradation, and provide a theoretical bound on the resulting generalization error. Our proof leverages shift-equivariance of CNNs, a property that is underexploited in transfer learning. The theoretical results are experimentally supported in the context of mobile infrastructure on demand (MID). The proposed approach is able to tackle MID at large scales with hundreds of agents, which was computationally intractable prior to this work.

 convolutional neural networks, transfer learning, deep learning, stationary process

## I Introduction

Over the past decade, there has been a rapid advancement in machine learning (ML), particularly in deep learning, which has produced state-of-the-art results in a wide range of applications [1, 2, 3]. This progress has been fueled by increasingly powerful hardware [1, 2] that has enabled the processing of larger datasets [4] and the training of deep learning models with more parameters. Theoretical evidence [5, 6] and empirical evidence [7, 8] suggest that using overparametrized models and larger datasets benefits neural network training. Large language models, such as GPT-3, with 175 billion parameters trained on a dataset of approximately 374 billion words, represent a new extreme in this trend [9, 10, 11, 12]. However, the trend of increasing model complexity and dataset size is not sustainable in the long term due to diminishing returns on costs of computation and data acquisition [13, 14]. Moreover, some applications lack data availability, making this strategy impossible. Therefore, it is necessary to refocus on efficiency and explore more sustainable ML approaches.

Transfer learning [15, 16, 17, 18] is a powerful tool for efficient and sustainable ML. It refers to a set of methodologies to apply knowledge learned from a source domain to a different target domain. For example, in [19] the authors demonstrate that it is consistently beneficial to pre-train a convolutional neural network (CNN) on ImageNet before fine-tuning on medical images. In this case, transfer learning is especially beneficial because of the unavailability of large medical image datasets.

CNNs are one of the most popular deep learning architectures [2], especially for image classification [20]. Although initially used for image processing, they have proven useful for a wide variety of other signals such as text, audio, weather, ECG data, traffic data and many others [2, 21, 22]. Shift-equivariance is an interesting property of CNNs. When there are no dilations, any translation of the input to the CNN will also translate the output by the same amount. Previous works focus on leveraging this property to achieve translation invariant image classification [23, 24]. However, it is difficult to exploit shift-equivariance for small images with deep architectures [25, 26]. Nevertheless, our work shows that shift-equivariance is fundamental for efficient large-scale image-to-image regression tasks, as we explain below.

In this paper, we use CNNs and transfer learning to tackle large-scale spatial problems. In particular, we leverage the shift-equivariance property of CNNs to efficiently train when the input-output signals are jointly stationary. Our analysis uses stochastic process theory to provide a bound on the generalization error of CNNs. The derived bound implies that a CNN can be trained on small signal windows, yet evaluated on arbitrarily large windows with minimal performance loss. Following, our theoretical result, we propose to recast spatial problems as image-to-image prediction tasks and use CNNs to solve them on a large scale. The proposed framework is applied to mobile infrastructure on demand (MID) tasks [27]. Our experimental results showcase that transfer learning with CNNs can tackle MID at scales that were previously considered intractable. Our main contributions are summarized as follows.

1. Provide a bound on CNN generalization error after training on a small window and executing on arbitrarily large signals.
2. Propose how to reinterpret large-scale spatial problems as image-to-image tasks.
3. Demonstrate the proposed method by solving the MID problem at scale.

**Notation:** We denote a stochastic process as \(\{X(t)\}_{t}\) where
each \(X(t)\) is a random variable. Correspondingly, \(X\) denotes a random signal - a random element in a function space. Sets \(\mathcal{X}\) are denoted by calligraphic letters. Lowercase boldface symbols \(\mathbf{x}\) are vectors while uppercase ones \(\mathbf{X}\) are matrices with \(\mathbf{X}_{ij}\) being their elements. \(\mathbf{\Phi}\) is an exception that symbolizes an ML model by convention.

## II Learning to process stationary signals

Commonly in ML the task is to find a model \(\mathbf{\Phi}(\cdot)\) which minimizes the expected mean squared error (MSE) between an input \(X\) and a desired output \(Y\). Let \(\mathbf{\Phi}(X)(t)\) be the output of the model at time \(t\) given the signal \(X\).

\[\min_{\mathbf{\Phi}}\mathbb{E}\left[\lim_{T\to\infty}\frac{1}{T}\int_{-T/2}^{T /2}|\mathbf{\Phi}(X)(t)-Y(t)|^{2}dt\right] \tag{1}\]

(1) expresses this mean squared error minimization problem in general, where the input-output signals can be infinitely wide. In practice, solving this directly when the signals are very wide is typically computationally intractable.

Instead, we propose an approximate solution to (1) by considering small windows over the signals. To evaluate this analytically, we model \(X,\ Y\) as stationary random signals and assume the model \(\mathbf{\Phi}\) is a CNN. Note that if \(X\) is a random signal, then the model's output \(\mathbf{\Phi}(X)\) is another random signal. In Section III we provide a bound on the MSE in (1) when \(\mathbf{\Phi}\) is a CNN trained on small windows of the input-output signals. To facilitate this analysis we first define stochastic processes, stationarity, and CNNs.

### _Stationary Stochastic Processes_

A stochastic process [28, 29, 30] is a family of random variables \(\{X(t):\Omega\to S\}_{t\in\mathcal{I}}\) parametrized by an index set \(\mathcal{I}\). Each element in this family is a map from a sample space \(\Omega\) onto a measurable space \(S\). Equivalently, we can describe the process as a map \(X(t,\omega):\mathcal{I}\times\Omega\to S\) from the cartesian product of the index set and the sample space onto the measurable space. In this context, a random signal is the corresponding random function, \(X:=X(\cdot,\omega)\). For our purposes, these three representations are equivalent and we use them interchangeably.

We limit our discussion to real continuous stationary stochastic processes. In particular, consider two stochastic processes \(X:\mathbb{R}\times\Omega\to\mathbb{R}\) and \(Y:\mathbb{R}\times\Omega\to\mathbb{R}\). We assume that \(X\) and \(Y\) are jointly stationary, following definition 1. Simply put, two continuous random signals \(X\) and \(Y\) are jointly stationary if and only if all their finite joint distributions are shift-invariant.

**Definition 1**.: _Consider two real continuous stochastic processes \(\{X(t)\}_{t\in\mathbb{R}}\) and \(\{Y(t)\}_{t\in\mathbb{R}}\). The two processes are jointly stationary if and only if they satisfy (2) for any shift \(\tau\in\mathbb{R}\), non-negative \(n,m\in\mathbb{N}_{0}\), indices \(t_{i},s_{i}\in\mathbb{R}\), and Borel sets of the real line \(A_{i},B_{i}\in\mathcal{B}\)._

\[\begin{split}& P(X(t_{1})\in A_{1},...,X(t_{n})\in A_{n},...,Y(s_{m}) \in B_{m})\\ &=P(...,X(t_{n}+\tau)\in A_{n},...,Y(s_{m}+\tau)\in B_{m})\end{split} \tag{2}\]

Following (1), we interpret \(X\) as a quantity that we can observe, while \(Y\) as something that we want to estimate. Numerous signals of interest such as financial [31], weather [32] and multi-agent systems [33] data can be represented by stationary or quasi-stationary processes. Therefore, it is clear that characterizing the performance of ML models for stationary signals of paramount interest. In particular, we consider CNNs which themselves exhibit the same translational symmetries as stationary signals. Such analysis will allow us to further demystify their performance and provide guidelines on how to efficiently train CNNs.

### _Convolutional Neural Networks_

CNNs are powerful architectures and oftentimes the tool of choice to approach the problem in (1). The convolution operation is the cornerstone of the CNN architecture. Convolutions are shift-equivariant, which allows them to exploit stationarity in the signals. In its simplest form, a CNN is a cascade of layers, where the output of the \(l^{\text{th}}\) layer can be described by (3).

\[x_{l}(t)=\sigma\left(\int h_{l}(s)x_{l-1}(t-s)ds\right) \tag{3}\]

The output \(x_{l}\) at the \(l^{\text{th}}\) layer is obtained by convolving the input \(x_{l-1}\) by a filter \(h_{l-1}\) and applying a pointwise nonlinearity \(\sigma_{l}\). Each filter is a continuous real function and we assume that it has finite support.

Let \(\mathbf{\Phi}(X;\mathcal{H})(t):=x_{L}(t)\) be the output of a CNN with \(L\) layers, input \(x_{0}(t):=X(t)\), and a set of filters \(\mathcal{H}=\{h_{1},...,h_{L}\}\) as described by (3). Thus, the problem in (1) can be reformulated as finding a set of filters \(\mathcal{H}\) that minimizes \(\mathcal{L}_{\infty}(\mathcal{H})\), the expected average squared error.

\[\mathcal{L}_{\infty}(\mathcal{H})=\mathbb{E}\left[\lim_{T\to\infty}\frac{1}{T} \int_{-T/2}^{T/2}|\mathbf{\Phi}(X;\mathcal{H})(t)-Y(t)|^{2}dt\right] \tag{4}\]

Evaluating (4) is challenging since it requires data processing over all real numbers. Although real-world signals typically have finite support, in many applications the signals are too wide to realistically collect data or evaluate (4). For example, in Section V, we consider an optimization problem involving a large multi-agent system.

## III Training on a window

To overcome the aforementioned challenges we propose a transfer learning approach, where we train over small windows and execute the trained network in larger settings. Instead of minimizing (4) directly, we can solve a simpler problem where we window the input-output signals \(X,\ Y\). In this section, we summarize our theoretical result. It provides an upper bound for \(\mathcal{L}_{\infty}\) as described by (4) in terms of the cost \(\mathcal{L}_{\sqcap}(\mathcal{H})\) associated with (5), which is easier to evaluate.

To characterize the behavior of CNNs in this context, we consider windows over the input and output signals of width \(A\) and \(B\), respectively; we restrict our attention to the case when \(A\geq B\). Denote a square pulse of width \(s\in\mathbb{R}_{+}\) by \(\sqcap_{s}\)
so that \(\sqcap_{\mathrm{s}}(t)=1\) whenever \(t\in[-s/2,s/2]\). (5) defines a new cost function.

\[\mathcal{L}_{\sqcap}(\mathcal{H})=\frac{1}{B}\mathbb{E}\left[\int_{-B/2}^{B/2}| \mathbf{\Phi}(\sqcap_{A}X;\mathcal{H})(t)-Y(t)|^{2}dt\right] \tag{5}\]

Unlike (4), this can be readily computed since the signals involved are time-limited, especially when \(A,B\) are small. Therefore optimizing the set of parameters \(\mathcal{H}\) with respect to \(\mathcal{L}_{\sqcap}\) is possible in practice. Our theoretical result quantifies the performance degradation when training on a small window, but evaluating on the whole signal. In particular, let \(\tilde{\mathcal{H}}\) be a candidate obtained by minimizing (5). Given the following assumptions, we show that \(\tilde{\mathcal{H}}\) is an almost equally good solution (4).

**Assumption 1**.: _The random signals \(X\) and \(Y\) are jointly stationary following definition 1._

This is the main assumption of our analysis. As mentioned earlier we analyze the performance of CNNs, since various data in high-impact domains are exactly or approximately stationary, and also such an analysis will also allow us to demystify the 'black-box' architecture of CNNs. The remaining assumptions are very-mild and also typical for model analysis.

**Assumption 2**.: _The stochastic processes \(X\) and \(Y\) are bounded so that \(|X(t)|<\infty\) and \(|Y(t)|<\infty\) for all \(t\)._

Boundedness of the signals is a sufficient condition for the existence and finiteness of some limits needed for the proof. However, the magnitude of the bound does not matter for the final result.

**Assumption 3**.: _The filters \(h_{l}\in\mathcal{H}\) are continuous with a finite width \(K\). That is \(h_{l}(t)=0\) for all \(t\notin[K/2,K/2]\)._

**Assumption 4**.: _The filters have finite L1 norms \(||h_{l}||_{1}\leq\infty\) for all \(h_{l}\in\mathcal{H}\)._

Assumptions 3 and 4 are going to be satisfied in a typical implementation of a CNN which represents the filters as vectors - or tensors when the signals are multi-dimensional.

**Assumption 5**.: _The nonlinearities \(\sigma_{l}(\cdot)\) are normalized Lipschitz continuous (the Lipshitz constant is equal to 1)._

Note that the majority of pointwise nonlinear functions used in deep learning, e.g., ReLU, Leaky ReLU, hyperbolic tangent, are normalized Lipshitz for numerical stability.

Theorem 1 quantifies the difference between the mean squared error of a CNN trained according to (4), and executed on larger settings, according to (5).

**Theorem 1**.: _Let \(\tilde{\mathcal{H}}\) be a set of filters which achieves a cost of \(\mathcal{L}_{\sqcap}(\tilde{\mathcal{H}})\) on the windowed problem as defined by (5) with an input window of width \(A\) and an output window width \(B\). Then the associated cost \(\mathcal{L}_{\infty}(\tilde{\mathcal{H}})\) on the original problem as defined by (4) is bounded by the following._

\[\mathcal{L}_{\infty}(\tilde{\mathcal{H}})\leq\mathcal{L}_{\sqcap}(\tilde{ \mathcal{H}})+H\frac{B+LK-A}{B}\text{var}(X) \tag{6}\]

_In (6), \(H=\prod_{l}^{L}||h_{l}||_{1}\) is the product of all the L1 norms of the CNNs filters, \(L\) is the number of layers, and \(K\) is the width of the filters._

The proof of Theorem 1 is deferred to the journal version due to space limitations. Theorem 1 leverages the shift-equivariance property of CNNs to justify that CNNs are the suitable architecture for transfer learning. Since shift-equivariance is equivalent to joint stationarity of random signals, CNNs are able to exploit hidden regularities and translational symmetries in signals. In a nutshell, Theorem 1 shows that the difference between the squared error of a CNN trained on a small setting and executed on a larger setting is bounded by a quantity that is affected by the variance of the input signal, number of layers, filter widths, and the size of the input and output windows. When \(A=B+LK\), (6) reduces to \(\mathcal{L}_{\infty}(\tilde{\mathcal{H}})\leq\mathcal{L}_{\sqcap}(\tilde{ \mathcal{H}})\). This special case occurs because for \(A=B+LK\) there is no zero-padding at the intermediate CNN layers, eliminating border effects.

## IV Representing spatial problems as images

In this section, we explain how we represent spatial problems as images. Consider a machine learning task where the input is a set of positions \(\mathcal{X}=\{\mathbf{x}_{n}\mid\mathbf{x}\in\mathbb{R}^{2}\}\) and the output is another set of positions \(\mathcal{Y}=\{\mathbf{y}_{n}\mid\mathbf{x}\in\mathbb{R}^{2}\}\). Our goal here is to represent these sets by images \(\mathbf{X},\mathbf{Y}\in\mathbb{R}^{N\times N}\). After doing so, we can learn a mapping from \(\mathbf{X}\) to \(\mathbf{Y}\) using a CNN and take advantage of Theorem 1.

We represent \(\mathcal{X}\) by a superposition of Gaussian pulses with variance \(\sigma_{x}^{2}\). There is one pulse for each position \(\mathbf{x}_{i}\in\mathcal{X}\). (7) defines a real function that maps a position \(\mathbf{x}\in\mathbb{R}^{2}\) to a real value, given the set of positions \(\mathcal{X}\).

\[X(\mathbf{x};\mathcal{X}):=\sum_{i=1}^{|\mathcal{X}|}(2\pi\sigma_{x}^{2})^{-1} \exp(-\frac{1}{2\sigma_{x}^{2}}||\mathbf{x}-\mathbf{x}_{i}||_{2}^{2}) \tag{7}\]

Next, we apply a square window of width \(A\) to \(X(\cdot;\mathcal{X})\) and sample with a spatial resolution \(\rho\) to obtain the matrix \(\mathbf{X}\).

\[\mathbf{X}_{ij}=X(\left[\rho i,\rho j\right];\mathcal{X}) \tag{8}\]

(8) describes how the \(i,j\)th pixel of \(\mathbf{X}\) is sampled for for \(i,j\in\{1,...,N\}\). The image width is rounded down to \(N=\lfloor\rho A\rfloor\). The images in the top row of Figure 1 are example input images \(\mathbf{X}\) at different scales. Similarly, we can construct an image \(\mathbf{Y}\) with a width of \(B\) meters from the set \(\mathcal{Y}\).

## V Experimental results

In this section, we test the performance of the proposed framework for mobile infrastructure on demand (MID). The primary goal in MID is to find the positions of a team of _communication agents_ that maximize wireless connectivity between a team of _task agents_. The work in [27] formulated a convex optimization problem to find the optimal positions of the communication agents. However, this approach becomes computationally intractable as the number of agents grows. Instead, [34] proposed a data-driven approach, where a CNN is trained to imitate a convex optimization solution.
The authors of [34] represented the task and communication agent positions as images, following the procedure similar to Section IV. Hence, they were able to train a CNN with a fully convolutional encoder-decoder architecture on examples for two to six task agents uniformly distributed within a 320m window. The final model provided close to optimal configurations of communication agents. However, larger window sizes of task teams were never considered, which is what we focus on in this section.

Motivated by Theorem 1, we utilize a CNN to perform MID in large-scale settings. Specifically, we present our experimental results on zero-shot performance of the model proposed in [34] on MID tasks with up to 125 task agents and 562 communication agents, covering windows of up to 1600m.

We consider varying window widths of \(A=\) 320, 640, 960, 1280, and 1600 meters with \(|\mathcal{X}|=\) 5, 20, 45, 80, and 125 task agents respectively. The number of task agents is proportional to the window area. We use the trained model provided by [34] from the associated GitHub repository, which was trained using a window size of \(A=\)320m. We perform no additional training or fine-tuning since we are only interested in evaluating the zero-shot performance.

At each window width \(A\) we evaluate the performance for 100 different random task agent configurations. The positions of the task agents are sampled uniformly within the square window to obtain a set \(\mathcal{X}\). Using the procedure outlined in Section IV we represent the set of positions as an image \(\mathbf{X}\in\mathbb{R}^{N\times N}\) where \(N=\lfloor\rho A\rfloor\). We use a spatial resolution of \(\rho=1.25\) meters per pixel and Gaussian kernel standard deviation \(\sigma_{x}=6.4\). The corresponding output of the CNN \(\mathbf{\Phi(X;\mathcal{H})}\in\mathbb{R}^{N\times N}\) is another image of the same size that represents the estimated optimal positions of the communication agents. Examples of the resulting CNN output images are shown in Figure 1. Qualitatively, the proposed transfer learning approach shows excellent performance in positioning the communication agents.

To quantify the performance of the proposed approach, we extract the set of the CNN estimated positions of the communication agents \(\hat{\mathcal{Y}}\) using Lloyd's algorithm as described by [34]. Then, we use Equation (9) to calculate the power required to maintain a minimum communication rate between any two agents, assuming a path loss channel model [35]. If two agents are separated by \(d\) meters, (9) relates the power \(P(d)\) in mili-watts required for them to directly communicate at an expected communication rate \(R\). The rate is normalized to be a fraction of the total bitrate across the channel.

\[P(d)=[\text{erf}^{-1}(R)]^{2}\frac{P_{N_{0}}d^{n}}{K} \tag{9}\]

In (9) \(P_{N_{0}}\) is the noise power level in mili-watts, \(K\) is a constant based on the physics of the receivers, and \(n\) is known as the path loss exponent. In our simulations we use \(R=0.5\), \(P_{N_{0}}=1\times 10^{-7}\), \(K=5\times 10^{-6}\) and \(n=2.52\). Notice that \(P(d)\) is defined for every pair of agents and therefore defines a fully connected weighted graph between all agents. Consider the minimum spanning tree of this graph. The average edge weight of the tree is the per-edge power needed for communication.

At each window width \(A\) we compute the power needed for each sampled of task agent configuration and the corresponding CNN prediction. As Table I shows, there is a modest increase of 10.24% in the power needed from \(A=320\) to \(A=640\) meters, but the power needed does not increase further after that. In fact, there is only an 8.61% increase in power from \(A=320\) to \(A=1280\) meters. This suggests that further increases in the scale of the task, will not increase the needed power further.

Fig. 1: Example inputs and outputs to the CNN for the MID task at different window widths \(A=320,650,960,1280,1600\) but with a constant spatial resolution of \(\rho=1.25\) meters per pixel. The top row images represent the positions of the task agents. The bottom row images represent the estimated optimal positions of the communication agents by the CNN. Additionally, the task agent positions are marked in red on the bottom images.
Looking at Figure 2, the variance in the average power per edge decreases with the width. Partially, this is a consequence of the Central Limit Theorem, because in Figure 2 we plot the distribution of an average over the edges in the minimum spanning tree. However, this is only part of the story, because the variance decreases faster than the square root of the number of edges. We think this is because border effects due to padding in the CNN have less impact at higher scales.

To summarize, the CNN gives us a good solution to the MID problem with linear time complexity respective to the area. In contrast, the convex optimization approach has polynomial complexity [34] as the number of agents is proportional to the area, which makes it computationally intractable for a large number of agents. Finally, the high performance of the CNN on the task is aligned with our derived theoretical bound.

## VI Conclusions

This paper explores the use of CNNs to solve big spatial problems, which are too large to solve directly and to obtain training data. We present a novel theoretical result that expands our understanding of the link between shift-equivariance and CNN performance. Motivated by these results, we propose an approach to efficiently train a CNN to solve such tasks. Specifically, a CNN can be trained on a small window of the signal and deployed on arbitrarily large windows, without a large loss in performance. We provide conditions that theoretically guarantee no loss of performance when using this method. To demonstrate this approach experimentally, we recast the MID problem as an image-to-image prediction task. In fact, the proposed approach is able to solve the MID problem for hundreds of agents, which was previously computationally intractable.
