## 4 Methods
### Learned vs. Unlearned Methods: Aggregation  
All the methods considered in the experiments (and, more generally, all local image descriptors) can be either _learned_ or _unlearned_. Methods belonging to the first group are also referred to as _a posteriori_ and those belonging to the second as _a priori_ (for a discussion on this point, see also [67; 94]). In the first group, the image-to-features mapping is the result of a preliminary learning stage aiming at generating a dictionary of visual words upon which the local features are aggregated. By contrast, unlearned methods do not require any training phase, since the image-to-feature mapping is a priori and universal.  
Aggregation  
Aggregation (also referred to as _pooling_[16]) is the process by which local image features (for instance, the output of a bank of filters or that of a layer of a convolutional network) is grouped around a dictionary of visual words in order to obtain a global feature vector suitable for being used with a classifier [95].  
The first step of the aggregation process is the definition of the dictionary, which usually consists of vector-quantizing the local features into a set of prototypes. Key factors in this phase are:  
* The dimension of the dictionary;
* The algorithm used for clustering;
* The set of images used for training.  
Figure 12: Simplified diagram of a generic convolutional neural network. For texture classification, we can either use the order-sensitive output of a fully-connected layer or the orderless, aggregated output of a convolutional layer.  
In our experiments, the dimension of the dictionary depended on the feature encoder used, as discussed below. The algorithm for clustering was always the _k-means;_ whereas for training, we followed the same approach as in [57]; i.e., we used a set of colour texture images from an external source [96]. To avoid overfitting and possibly biased results, these images were different from those contained in any of the datasets detailed in Section 3.  
For the aggregation, we considered two schemes (due to dimensionality reasons, aggregation over the DenseNet, GoogLeNet and ResNet models was limited to BoVW) [16; 95]:  
* Bag of Visual Words (BoVW);
* Vectors of Locally-Aggregated Descriptors (VLAD).  
This choice was based on recent works [16; 57] and was also the result of a trade-off between accuracy and dimensionality (recall that for a \(D\)-dimensional feature space and a dictionary with \(K\) visual words, the number of features respectively generated by BoVW and VLAD is \(K\) and \(K\times D\)).  
Convolutional networks also have built-in aggregation modules: the Fully-Connected (FC) layers. However, whereas BoVW and VLAD implement orderless aggregation (i.e., they discard the spatial configuration of the features), the aggregation provided by fully-connected layers is order-sensitive. The number of features produced by FC layers depends on the network's architecture and is therefore fixed. For a fair comparison between the three aggregation strategies (FC, BoVW and VLAD), we chose a number of visual words for BoVW and VLAD that produced a number of features as close as possible to that produced by FC.  
Post-processing involved \(L_{1}\) normalization of the BoVW features and \(L_{2}\) normalization of the individual VLAD vectors and vectors of FC features [16; 57].