text stringlengths 0 820 |
|---|
dling of spatial interactions and leads to improved class |
separation. Multiple clstokens have also been employed |
in [11, 59]. However, while both studies use them as class |
queries inputs to a decoder module, we introduce the clsto- |
kens as an input to the encoder in order to collapse the time |
dimension and obtain class-specific features. |
3. Method |
In this section we present the TSViT architecture in de- |
tail. First, we give a brief overview of the ViT (section 3.1) |
which provided inspiration for this work. In section 3.2 we |
present our modified TSViT backbone, followed by our to- |
kenization scheme (section 3.3), encoder (section 3.4) and |
decoder (section 3.5) modules. Finally, in section 3.6, we |
discuss several considerations behind the design of our po- |
sition encoding scheme. |
3.1. Primer on ViT |
Inspired by the success of Transformers in natural lan- |
guage processing tasks [64] the ViT [13] is an application |
of the Transformer architecture to images with the fewest |
Figure 2. Backbone architectures. (a) Transformer backbone, |
(b)ViT architecture, (c)TSViT backbone employs additional cls |
tokens (red), each responsible for predicting a single class. |
possible modifications. Their framework involves the to- |
kenization of a 2D image X∈RH×W×Cto a set of |
patch tokens Z∈RN×dby splitting it into a sequence of |
N=⌊H |
h⌋⌊W |
w⌋same-size and non-overlapping patches of |
spatial extent (h×w)which are flattened into 1D tokens |
xi∈RhwCand linearly projected into ddimensions. Over- |
all, the process of token extraction is equivalent to the appli- |
cation of 2D convolution with kernel size (h×w)at strides |
(h, w)across respective dimensions. The extracted patches |
are used to construct model inputs as follows: |
Z0=concat (zcls,Z+P)∈RN+1×d(1) |
A set of learned positional encoding vectors P∈RN×d, |
added to Z, are employed to encode the absolute posi- |
tion information of each token and break the permutation |
invariance property of the subsequent Transformer layers. |
A separate learned class ( cls) token zcls∈Rd[12] is |
prepended to the linearly transformed and positionally aug- |
mented patch tokens leading to a length N+ 1 sequence |
of tokens Z0which are used as model inputs. The Trans- |
former backbone consists of Lblocks of alternating lay- |
ers of Multiheaded Self-Attention (MSA) [64] and residual |
Multi-Layer Perceptron (MLP) (Fig.2(a)). |
Yl=MSA (LN(Zl)) +Zl(2) |
Zl+1=MLP (LN(Yl)) +Yl(3) |
Prior to each layer, inputs are normalized following Layer- |
norm (LN) [4]. MLP blocks consist of two layers of linear |
projection followed by GELU non-linear activations [21]. |
In contrast to CNN architectures, in which spatial dimen- |
sions are reduced while feature dimensions increase with |
10420 |
Figure 3. SITS Tokenization . We embed each satellite image |
independently following ViT [13] |
layer depth, Transformers are isotropic in that all feature |
maps Zl∈R1+N×dhave the same shape throughout the |
network. After processing by the final layer L, all tokens |
apart from the first one (the state of the clstoken) are dis- |
carded and unormalized class probabilities are calculated by |
processing this token via a MLP. A schematic representation |
of the ViT architecture can be seen in Fig.2(b). |
3.2. Backbone architecture |
In the ViT architecture, the clstoken progressively re- |
fines information gathered from all patch tokens to reach a |
final global representation used to derive class probabilities. |
Our TSViT backbone, shown in Fig.2(c), essentially fol- |
lows from ViT, with modifications in the tokenization and |
decoder layers. More specifically, we introduce K(equal to |
the number of object classes) additional learnable clstokens |
Zcls∈RK×d, compared to ViT which uses a single token. |
Z0=concat (Zcls,Z+P)∈RN+K×d(4) |
Without deviating from ViT, all clsand positionally aug- |
mented patch tokens are concatenated and processed by the |
Llayers of a Transformer encoder. After the final layer, |
we discard all patch tokens and project each clstoken into |
a scalar value. By concatenating these values we obtain a |
length Kvector of unormalised class probabilities. This |
design choice brings the following two benefits: 1) it in- |
creases the capacity of the clstoken relative to the patch |
tokens, allowing them to store more patterns to be used by |
the MSA operation; introducing multiple clstokens can be |
seen as equivalent to increasing the dimension of a single |
clstoken to an integer multiple of the patch token dimen- |
siondcls=kdpatch and split the clstoken into kseparate |
subspaces prior to the MSA operation. In this way we can |
increase the capacity of the clstokens while avoiding is- |
sues such as the need for asymmetric MSA weight matri-ces for clsandpatch tokens, which would effectively more |
than double our model’s parameter count. 2) it allows for |
more controlled handling of the spatial interactions between |
classes. By choosing k=Kand enforcing a bijective map- |
ping from clstokens to class predictions, the state of each |
clstoken becomes more focused to a specific class with net- |
work depth. In TSViT we go a step further and explicitly |
separate clstokens by class after processing with the tempo- |
ral encoder to allow only same- cls-token interactions in the |
spatial encoder. In section 3.4 we argue why this is a very |
useful inductive bias for modelling spatial relationships in |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.