# A Study of OWA Operators Learned in Convolutional Neural Networks
## 4 Methods
### Feature Map Ordering Metrics  
As previously explained, our aim is to involve global image information in the feature maps generated in the convolutional part of the CNN. This is done by using OWA operators, whose ordering is given by a channel-wise metric that characterizes the whole channel (feature map). For this, we will use several ordering metrics that assign a real number to each feature map \(X\) of dimension \(I\times J\). Then, the ordering of the channels is performed by this real number, which represents to some extent the interest in the information stored in the channel. We consider the following metrics:  
* Sum, Median and Maximum of channel values. We consider first some of the more classical aggregations. These operators ignore the spatial relationships of the data but still represent the general activation level of the channel. \[\text{Sum}(X)=\sum_{i=1}^{I}\sum_{j=1}^{J}X(i,j)\,.\] (8) \[\text{Median}(X)=\text{median}(X(1,1),\dots,X(I,J))\,.\] (9) \[\text{Max}(X)=\max(X(1,1),\dots,X(I,J))\,.\] (10)
* Channel entropy. Intuitively, the entropy is a measure of disorder, of the amount of information codified in a channel. A higher value of entropy means more uniformity in the input data, while a smaller entropy value means more contrast and information in that input. For feature maps, we can argue that the entropy of the channel is a good indicator of how interesting the information in the channel is. To compute this metric, we first normalize each element \(X(i,j)\) of the channel with the softmax function: \[X^{\prime}(i,j)=\text{Softmax}(X(i,j))=\frac{e^{X(i,j)}}{\sum_{k=1}^{I}\sum_{l= 1}^{J}e^{X(k,l)}}\,.\] (11) After applying it, we have \(X^{\prime}(i,j)\in[0,1]\) and \(\sum_{i=1}^{I}\sum_{j=1}^{J}X^{\prime}(i,j)=1\). Then, we can apply the Shannon entropy [39] formula to these values by \[H(X)=-\sum_{i=1}^{I}\sum_{j=1}^{J}X^{\prime}(i,j)\log X^{\prime}(i,j)\,.\] (12)
* Spatial variation entropy. Generally speaking, the entropy of an information source depends on the codification chosen for it. As the channel values are usually spatially correlated, like an image, we can consider a codification that takes these relationships into account. To obtain the corresponding entropy value, we first compute the horizontal and vertical variations of each position \((i,j)\) of the channel, which are given, respectively, by  
\[V_{h}(X)(i,j)=|X(i,j)-X(i-1,j)|\text{ for every }i=2,\ldots,I,\ j=1,\ldots,J\,, \tag{13}\]  
and  
\[V_{v}(X)(i,j)=|X(i,j)-X(i,j-1)|\text{ for every }i=1,\ldots,I,\ j=2,\ldots,J\,. \tag{14}\]  
We flatten and concatenate all the differences together into a \(2I|-I-J\) length vector \(V\). Then, we proceed normally, applying the softmax function for every \(j\) in V:  
\[V^{\prime}(j)=\text{Softmax}(V(j))=\frac{e^{V(j)}}{\sum_{i=1}^{2 II-I-J}e^{V(i) }}\,. \tag{15}\]  
Then, we apply the Shannon entropy [39] formula to these normalized variation values by  
\[H_{s\mathcal{D}}(X)=-\sum_{i=1}^{2I|-I-J}V^{\prime}(i)\log V^{\prime}(i)\,. \tag{16}\]  
* Total variation. The Total variation (TV), as defined in [40], is a metric that conveys similar information to the entropy for spatially constrained data. It tells us how much variance there is between a pixel and its neighbors, being high for images with crisp borders, and low for uniform images. For this metric, we calculate the differences between each pixel and its horizontal and vertical neighbors and aggregate the absolute differences over the image. This is done in the following three steps:  
\[\text{TV}_{v}(X)=\sum_{i=2}^{I}\sum_{j=1}^{J}|X(i,j)-X(i-1,j)|\,, \tag{17}\]  
\[\text{TV}_{h}(X)=\sum_{i=1}^{I}\sum_{j=2}^{J}|X(i,j)-X(i,j-1)|\,, \tag{18}\]  
\[\text{TV}(X)=TV_{v}(X)+TV_{h}(X)\,. \tag{19}\]