11institutetext: CentraleSupélec, Université Paris-Saclay, Inria. Gif-sur-
Yvette, France 11email<EMAIL_ADDRESS>
# Binary Multi Channel Morphological Neural Network

Theodore Aouad 11 Hugues Talbot 11

###### Abstract

Neural networks and particularly Deep learning have been comparatively little
studied from the theoretical point of view. Conversely, Mathematical
Morphology is a discipline with solid theoretical foundations. We combine
these domains to propose a new type of neural architecture that is
theoretically more explainable. We introduce a Binary Morphological Neural
Network (BiMoNN) built upon the convolutional neural network. We design it for
learning morphological networks with binary inputs and outputs. We demonstrate
an equivalence between BiMoNNs and morphological operators that we can use to
binarize entire networks. These can learn classical morphological operators
and show promising results on a medical imaging application.

###### Keywords:

Binary morphology deep learning binarized neural networks

##  1 Introduction

While demonstrating considerable success in applications, there are few
theoretical results in Deep Learning. Many elements are not well understood,
with networks operating as black boxes, hindering critical applications such
as medical imaging or robotics. Conversely, Mathematical Morphology (MM) is a
computer vision discipline with solid theoretical foundations. In this
article, we propose to combine ideas from the two domains to construct a new
type of neural architecture that is theoretically more justified and
explainable. As argued in [1] combining the two fields is promising, as MM can
se used to construct simpler and more understandable deep neural networks.
Using MM is more natural than convolutional neural networks (ConvNets) for
some specific tasks. For example, ConvNets are not designed to deal with
binary images, while MM is constructed on set-representation of images. Also,
as stated in [9], designing a correct sequence of morphological operators can
be complicated and time-consuming.

Past researchers have proposed to learn both operators and structuring
elements, e.g using the max-plus definition of dilations and erosion [12, 4].
Other approaches introduce differentiable approximations of the max and min
operators, such as the adaptive morphological layer [14], the PConv layer
[10], and the most recent $\mathcal{L}Morph$ and $\mathcal{S}Morph$ layers
[9]. However, these methods deal with grey-scale morphology and grey-scale
images.

We introduces the Binary Morphological Neural Network (BiMoNN), a learnable
morphological network with binary inputs and output, inspired by the structure
of ConvNets. We replace the convolution by elementary operations from the set
of erosions, dilations, anti-erosions, and anti-dilations: we can learn the
type of operation and its associated structuring element as well as any
intersection/union of these elementary operations. we show equivalence
properties between our neural network and morphological operators. They can be
used both as explainable results or as a way to binarize the network: once
these equivalences are respected, the morphological operation can replace the
neural network. Booleans weights can replace real-valued weights, improving
the inference’s computing efficiency [6, 7, 15]. We demonstrate how we managed
to learn some classical morphological operators as well as an intermediate
step of a challenging medical imaging problem. A preliminary version of our
work is available at [2]. Our code is publicly available online at
https://github.com/TheodoreAouad/Bimonn_DGMM2022.

##  2 Method

###  2.1 Notations

Let $\mathbb{N}^{*}$ be the set of non zero natural integers. Let
$d\in\mathbb{N}^{*}$ the dimension of the image (usually $d=2$ or $d=3$). If
$a\leq b\in\mathbb{Z}$, we denote the discrete interval as
$[\\![a,b]\\!]=[a,b]\cap\mathbb{Z}$. Let $N_{I}\in\mathbb{N}^{*}$ and
$\Omega_{I}=[\\![-N_{I},N_{I}]\\!]^{d}$ be the support of binary images
$I\subset\Omega_{I}$. Let $\Omega_{S}=[\\![-N_{S},N_{S}]\\!]^{d}$ be the
support of structuring elements (short: SE) $S\subset\Omega_{S}$. If
$X\subset\mathbb{Z}^{d}$, we denote $\check{X}=\\{-x\leavevmode\nobreak\
|\leavevmode\nobreak\ x\in X\\}$ the symmetric of $X$ with respect to the
origin. For a binary image $I\subset\Omega_{I}$, we define its complementation
$I^{C}=\Omega_{I}\leavevmode\nobreak\ \backslash\leavevmode\nobreak\ I$. For a
SE $S\subset\Omega_{S}$, if there is no ambiguity, we define its
complementation as $S^{C}=\Omega_{S}\leavevmode\nobreak\
\backslash\leavevmode\nobreak\ S$. For a set $X\subset\mathbb{Z}^{d}$, we
denote its indicator function
$\mathbbm{1}_{X}:\mathbb{Z}^{d}\mapsto\mathbb{R}$ such that
$\mathbbm{1}_{X}(x)=1$ if $x\in X$, else $\mathbbm{1}_{X}(x)=0$. If
$\mathbbm{1}_{I}\in\mathbb{R}^{\Omega_{I}}$ and
$\mathbbm{1}_{S}\in\mathbb{R}^{\Omega_{S}}$ we denote the convolutional
product
$\mathbbm{1}_{I}\circledast\mathbbm{1}_{S}:k\in\Omega_{I}\mapsto\sum_{i\in\Omega_{S}|k-i\in\Omega_{I}}(\mathbbm{1}_{I}(k-i)\mathbbm{1}_{S}(i)))$.

###### Definition 1

Let $S\subset\Omega_{S}$ be a SE. Let $I\subset\Omega_{I}$ be a binary image.
We define the following morphological operators.

the dilation by S $\displaystyle\delta_{S}(I)=I\oplus S=\bigcup_{s\in
S}{(I+s)}$ (1) the erosion by S
$\displaystyle\varepsilon_{S}(I)=I\ominus\check{S}=\bigcap_{s\in S}(I-s)$ (2)
the anti-dilation by S $\displaystyle\delta_{S}(I)^{C}$ (3) the anti-erosion
by S $\displaystyle\varepsilon_{S}(I)^{C}$ (4) the opening by S $\displaystyle
I\circ S=(I\ominus\check{S})\oplus S$ (5) the closing by S $\displaystyle
I\bullet S=(I\oplus S)\ominus\check{S}$ (6) the black top-hat by S
$\displaystyle T_{b}(I,S)=(I\bullet S)\leavevmode\nobreak\
\backslash\leavevmode\nobreak\ I=(I\bullet S)\cap I^{C}$ (7) the white top-hat
by S $\displaystyle T_{w}(I,S)=I\leavevmode\nobreak\
\backslash\leavevmode\nobreak\ (I\circ S)=I\cap(I\circ S)^{C}$ (8)

While not exhaustive, this list is representative of many useful morphological
operators. These operators are obtained through composition and intersection
or union of dilations, erosions, anti-dilations, and anti-erosions. Therefore,
it is enough to learn these elementary operations, their SEs, and their
aggregation.

###  2.2 Binary Structuring Element Neuron

First, we design a single neuron that replaces the convolution operation: it
can learn the dilation, erosion, anti-dilation, anti-erosion, and their SEs.

####  2.2.1 Definition

#####

Proposition 1 shows that we can express a dilation and erosion exactly using a
thresholded convolution.

######  Proposition 1 (Morphological operators from convolution)

Let $S\subset\Omega_{S}$ be a binary SE and $X\subset\Omega_{I}$ be a binary
image.

$\displaystyle X\oplus S$
$\displaystyle=\bigg{(}\mathbbm{1}_{X}\circledast\mathbbm{1}_{S}\geq
1\bigg{)}=\bigg{(}\mathbbm{1}_{X}\circledast\mathbbm{1}_{S}-1\geq 0\bigg{)}$
(9) $\displaystyle X\ominus S$
$\displaystyle=\bigg{(}\mathbbm{1}_{X}\circledast\mathbbm{1}_{S}\geq|S|\bigg{)}=\bigg{(}\mathbbm{1}_{X}\circledast\mathbbm{1}_{S}-|S|\geq
0\bigg{)}$ (10)

We stress that the dilations and erosions only differ by a scalar, $1$ for the
dilation and $|S|$ for the erosion. Given $S$, we can learn the operation
using only this scalar. Taking inspiration from these expressions, we relax
$S$ into real weights $W\in\mathbb{R}^{\Omega_{S}}$. We denote the softplus
function by $f^{+}:x\in\mathbb{R}\mapsto\ln(1+\exp(x))$. Let
$\xi:\mathbb{R}\mapsto[0,1]$ be a smooth increasing function such that
$\xi(x)\rightarrow_{x\rightarrow-\infty}0$ and
$\xi(x)\rightarrow_{x\rightarrow+\infty}1$. In practice,
$\xi(x)=\frac{1}{2}\tanh(x)+\frac{1}{2}$.

######  Definition 2 (BiSE neuron)

Let $W\in\mathbb{R}^{\Omega_{S}}$ be a weight matrix, $b\in\mathbb{R}$ a bias
and $p\in\mathbb{R}$ a scaling number. We define a BiSE (Binary Structuring
Element) neuron as follow:

$\epsilon^{W,b,p}:x\in[0,1]^{\mathbb{Z}^{d}}\mapsto\xi(p[x\circledast
f^{+}(W)-f^{+}(b)])\in[0,1]^{\mathbb{Z}^{d}}$ (11)

This expression approximates the thresholded convolution of proposition 1.
Indeed, we apply the convolution and subtract a bias. If this expression is
negative, we want the result to be $0$, else we want the result to be $1$.
Therefore, we multiply it by a scaling factor and threshold it. The higher
$|p|$ is, the closer the output is to $0$ or $1$. We enforce the weights and
bias to be positive: we will explain that later.

The BiSE neuron is a convolution layer with the weights and bias forced to be
positive, with a smooth thresholding function as activation. In practice, all
the operations are differentiable with real inputs and outputs, not binary.
Thus, we define almost binary images, with pixels value either close to $0$ or
close to $1$.

######  Definition 3 (Almost Binary Image)

We say an image $I\in[0,1]^{\Omega_{S}}$ is almost binary if there exists
$u<v\in[0,1]$ such that $I(\Omega_{S})\cap]u,v[=\emptyset$. We denote this set
$\mathcal{I}(u,v)$.

####  2.2.2 Morphological equivalence

#####

The following Theorem states the conditions ensuring that the BiSE neuron is
equivalent to a morphological operator. We denote
$\epsilon^{W,b,+\infty}:x\in[0,1]^{\Omega_{I}}\mapsto(x\circledast
W>b)\in\Omega_{I}$ and
$\epsilon^{W,b,-\infty}:x\in[0,1]^{\Omega_{I}}\mapsto(x\circledast
W<b)\in\Omega_{I}$.

######  Theorem 2.1 (Dilation / Erosion Equivalence)

Let $W\in\mathbb{R}^{\Omega_{S}}$ be a set of weights, $b\in\mathbb{R}$ a bias
and $p\in\mathbb{R}$ a scaling factor. Let $S\subset\Omega_{S}$ be a candidate
SE. Given an almost binary input in $\mathcal{I}(u,v)$

  * •

$\epsilon_{W,b,+\infty}$ is a dilation by $S$ if and only if
$\epsilon_{W,b,-\infty}$ is an anti-dilation by $S$ if and only if

$\sum_{i\in S^{C}\leavevmode\nobreak\ ,\leavevmode\nobreak\ w_{i}\geq
0}{w_{i}}+u\sum_{i\in S\leavevmode\nobreak\ ,\leavevmode\nobreak\ w_{i}\geq
0}{w_{i}}\leq b<v\min_{i\in S}{w_{i}}+\sum_{i\in\Omega\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\leq 0}{w_{i}}$ (12)

  * •

$\epsilon_{W,b,+\infty}$ is an erosion by $S$ if and only if
$\epsilon_{W,b,-\infty}$ is an anti-erosion by $S$ if and only if

$\sum_{i\in\Omega\leavevmode\nobreak\ ,\leavevmode\nobreak\ w_{i}\geq
0}{w_{i}}-(1-u)\min_{i\in S}{w_{i}}\leq b<v\sum_{i\in S\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\geq 0}{w_{i}}+\sum_{i\in\Omega\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\leq 0}{w_{i}}$ (13)

If one of these expressions is fulfilled, we say that the BiSE neuron is
activated. Then we have $\forall i\in S\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\geq 0$ and $b\geq 0$, and the output of the BiSE
$\epsilon_{W,b,p}$ is almost binary.

Equations 12 and 13 check if a candidate $S\subset\Omega_{S}$ activates the
BiSE or not. If the BiSE is activated, given an almost binary input, the
output is almost binary. Therefore, applying a BiSE on an almost binary image
is the same as applying the morphological operator to the binary image.
Finally, we can replace the entire BiSE neuron with the associated
morphological operation in the activation case. The sign of $p$ determines if
complementation is applied or not.

Theorem 2.1 justifies a posteriori our enforcing of the weights and bias to be
positive in the BiSE definition 2: the goal is to achieve activation, which is
only possible for positive parameters.

The BiSE can only be activated by at most one $S\subset\Omega_{S}$
simultaneously. We can recover this $S$ with proposition 2.

######  Proposition 2 (Linear Check)

Let us assume the BiSE is activated for almost binary images in
$\mathcal{I}(u,v)$. Let $b\in\mathbb{R}$ be the BiSE bias, let
$W\in\mathbb{R}^{\Omega_{S}}$ be the weights. Then there exists
$\tau\in\mathbb{R}$ such that $S=\\{i\in\Omega\leavevmode\nobreak\
|\leavevmode\nobreak\ W(i)\geq\tau\\}$.

  * •

If the BiSE is a dilation / anti-dilation

$\tau=\frac{1}{v}\big{(}b-\sum_{i\in S^{C}\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\leq 0}{w_{i}}\big{)}$ (14)

  * •

If the BiSE is an erosion / anti-erosion

$\tau=\frac{1}{1-u}\big{(}\sum_{i\in\Omega\leavevmode\nobreak\
,\leavevmode\nobreak\ w_{i}\geq 0}{w_{i}}-b\big{)}$ (15)

We can check the two SEs associated with each threshold to recover the
activation operation. If none works, then by contraposition, the BiSE is not
activated. This is done in $\mathcal{O}(|\Omega|)$ operations.

####  2.2.3 Binarization

##### Formalism

The purpose of binarization is to replace the real parameters $(W,b,p)$ with
binary parameters to improve inference efficiency [15]. If the activation
inequalities of Theorem 2.1 are respected, we saw that we could replace the
BiSE with the morphological operation. That is a form of binarization:
floating point numbers are no longer required. However, these inequalities are
not necessarily respected. How to binarize the BiSE neuron in this case? We
want to find the closest morphological operation. Let
$(W^{*},b^{*},p^{*})\in\mathbb{R}^{\Omega_{S}}\times\mathbb{R}_{+}\times\mathbb{R}$
be the learned parameters. Let
$A:(S,op)\in\mathcal{P}(\Omega_{S})\times\\{\text{dilation},\text{erosion}\\}\mapsto
A(S,op)=\\{(W,b)\in\mathbb{R}^{|\Omega_{S}|+1}\leavevmode\nobreak\
|\leavevmode\nobreak\ f_{S}^{op}(W)\leq b<g_{S}^{op}(W)\\}$, with $f_{S}^{op}$
and $g_{S}^{op}$ the bounds defined in Theorem 2.1. We want to define a
dissimilarity function
$d:(S,op),(W,b)\in(\mathcal{P}(\Omega_{S})\times\\{\text{dilation},\text{erosion}\\})\times(\mathbb{R}^{|\Omega_{S}|}\times\mathbb{R})\mapsto
d(A(S,op),(W,b))$, and we want to find

$\underset{(S,op)\in\mathcal{P}(\Omega_{S})\times\\{\text{dilation},\text{erosion}\\}}{\text{argmin}}\text{
}{d(A(S,op),(W^{*},b^{*}))}$ (16)

##### Choice of dissimilarity

A first choice is to use:

$d(A(S,op),(W,b))=\max\Big{(}0,f_{S}^{op}(W)-b,b-g_{S}^{op}(W)\Big{)}$ (17)

The search for
$(S,op)\in\mathcal{P}(\Omega_{S})\times\\{\text{dilation},\text{erosion}\\}$
has exponential complexity $\mathcal{O}(2^{|\Omega_{S}|}$). To simplify this
search, we take inspiration from proposition 2: if the BiSE is activated, we
know that $S=\\{i\leavevmode\nobreak\ |\leavevmode\nobreak\ w_{i}\geq\tau\\}$
for a certain $\tau$. Therefore, we reduce the search to all $S$ of this
thresholded form, with $\tau\in\\{w_{i}\leavevmode\nobreak\
|\leavevmode\nobreak\ i\in\Omega_{S}\\}$. This reduces the complexity to
$\mathcal{O}(|\Omega_{S}|)$.

###  2.3 Binary Structuring Element Layer

One strength of ConvNets is their ability to learn multiple filters per layer,
which we also want to ensure. In a convolutional layer, each final channel is
a sum of one filter per input channel. In our case, the final result is either
a union or an intersection of the elementary operators (dilation, erosion,
anti-dilation, anti-erosion). Therefore, we want a layer that can learn the
union or intersection of any combination of inputs. Let us consider $n$ binary
images $x_{1},...,x_{n}\subset\Omega$. Let $\mathcal{C}\subset[\\![1,n]\\!]$.
Then the intersection and union are given as:

$\displaystyle\mathbbm{1}_{\bigcap_{i\in\mathcal{C}}{x_{i}}}$
$\displaystyle=\Big{(}\sum_{i\in\mathcal{C}}{\mathbbm{1}_{x_{i}}}\geq|\mathcal{C}|\Big{)}$
(18) $\displaystyle\mathbbm{1}_{\bigcup_{i\in\mathcal{C}}{x_{i}}}$
$\displaystyle=\Big{(}\sum_{i\in\mathcal{C}}{\mathbbm{1}_{x_{i}}}\geq
1\Big{)}$ (19)

As with the BiSE, we can use a single scalar to discriminate between the union
or the intersection. To learn the set $\mathcal{C}$, we can use a parameter
$\beta_{i}$ for each image. The following definition ensues:

######  Definition 4 (LUI)

Let $\beta=(\beta_{1},...,\beta_{c})\in\mathbb{R}^{c}$. Let $b\in\mathbb{R}$
be a bias and $p\in\mathbb{R}$ a scaling factor. We define the LUI (Layer
Intersection Union) as a thresholded linear combination:

$\text{LUI}^{\beta,b,p}:x\in(\mathbb{Z}^{d})^{c}\mapsto\xi\bigg{(}p\Big{(}\sum_{i=1}^{c}{f^{+}(\beta_{i})x_{i}}-f^{+}(b)\Big{)}\bigg{)}\in\mathbb{Z}^{d}$
(20)

A LUI layer can learn any intersection or union of any number of almost binary
inputs. It is a particular case of BiSE layer. In this case, the SE support
would be $\Omega_{lui}=\\{0\\}^{d}\times[\\![1,n]\\!]$. Learning the
intersection is equivalent to learning an erosion, and learning the union is
equivalent to learning a dilation. Then, we can deduce the following Theorem,
by using the BiSE Theorem 2.1. We denote by
$\mathcal{I}=\bigtimes_{k=1}^{n}{\mathcal{I}(u_{k},v_{k})}$ the set of images
with $n$ almost binary channels.

######  Theorem 2.2 (LUI intersection / union equivalence)

Let $n\in\mathbb{N}^{*}$ and $\mathcal{C}\subset[\\![1,n]\\!]$. Let
$b\in\mathbb{R}$. Let $(u_{i}<v_{i})\in[0,1]^{2n}$. Let
$\beta\in\mathbb{R}^{n}$.

  * •

$\text{LUI}^{\beta,b,+\infty}$ is an intersection by $\mathcal{C}$ if and only
if

$\sum_{k=1\leavevmode\nobreak\ ,\leavevmode\nobreak\ \beta_{k}\geq
0}^{n}{\beta_{k}}-\min_{k\in\mathcal{C}}{\Big{[}(1-u_{k})\beta_{k}\Big{]}}\leq
b<\sum_{k\in\mathcal{C}\leavevmode\nobreak\ ,\leavevmode\nobreak\
\beta_{k}\geq 0}{\beta_{k}v_{k}}+\sum_{k=1\leavevmode\nobreak\
,\leavevmode\nobreak\ \beta_{k}\leq 0}^{n}{\beta_{k}}$ (21)

  * •

$\text{LUI}^{\beta,b,+\infty}$ is a union by $\mathcal{C}$ if and only if

$\sum_{k\in\mathcal{C}\leavevmode\nobreak\ ,\leavevmode\nobreak\ \beta_{k}\geq
0}{\beta_{k}u_{k}}+\sum_{k\in[\\![1,n]\\!]\leavevmode\nobreak\
\backslash\leavevmode\nobreak\ \mathcal{C}\leavevmode\nobreak\
,\leavevmode\nobreak\ \beta_{k}\geq 0}{\beta_{k}}\leq
b<\min_{k\in\mathcal{C}}(\beta_{k}v_{k})+\sum_{k=1\leavevmode\nobreak\
,\leavevmode\nobreak\ \beta_{k}\leq 0}^{n}{\beta_{k}}$ (22)

If one of these inequalities is respected, we say that the LUI is activated.
Then, we have $\forall k\in\mathcal{C}\leavevmode\nobreak\
,\leavevmode\nobreak\ \beta_{k}\geq 0$ and $b\geq 0$ and the output of the LUI
is almost binary.

As for the BiSE, if the LUI is activated, the set $\mathcal{C}$ can be found
by thresholding the $(\beta_{k})_{k}$ for a specific value. If the LUI is not
activated, it is still possible to binarize with the same method described for
the BiSE in section 2.2.3.

We combine the BiSE neurons and the LUI in order to be able to learn the
morphological operators and aggregate them as unions or intersections.

######  Definition 5 (BiSEL)

A BiSEL (BiSE Layer) is the combination of multiple BiSE and multiple LUI. Let
$(\epsilon_{n,k})$ be $N*K$ BiSE and $(\text{LUI}_{k})_{k}$ be $K$ LUI. Then
we define a BiSEL as:

$\phi:x\in(\mathbb{Z}^{d})^{n}\mapsto\bigg{(}\text{LUI}_{k}\Big{[}\big{(}\epsilon_{n,k}(x_{n})\big{)}_{n}\Big{]}\bigg{)}_{k}\in(\mathbb{Z}^{d})^{K}$
(23)

The LUI and BiSE are called the BiSEL’s elements. If every element is
activated, we say that the BiSEL is totally activated.

If the BiSEL is activated, given almost binary inputs, the outputs of the
BiSEL are also almost binary.

The BiSEL follows the same logic as a convolutional layer. In ConvNets, at
each layer, we have $k$ filters. Each filter applies one convolution to each
channel, and then we apply a linear combination to all convoluted channels. In
BiSEL, we have $K$ filters (the number of LUI). For each filter, we apply a
morphological operation to a channel, and then we aggregate by taking the
intersection or union of any channels. A schema of BiSEL can be found in
figure 1.

Figure 1: Schema of BiSEL. Input $x$ with 3 channels. Output $\phi(x)$ with 2
channels.

Binarizing a BiSEL is equivalent to binarizing each of its element. If an
element is activated, it is easy to binarize it. For those who are not, we
must approximate them.

The parameters are the BiSE weights
$\\{W_{n,k}\\}_{n,k}\subset\mathbb{R}^{\Omega_{S}}$, the BiSE biases
$\\{b_{n,k}\\}_{n,k}\subset\mathbb{R}$, the LUI parameters
$\\{\beta_{n,k}\\}_{n,k}\subset\mathbb{R}$ and the LUI biases
$\\{b^{l}_{k}\\}_{k}\subset\mathbb{R}$. There are $N\cdot K(|\Omega_{S}|+2)+K$
parameters.

###  2.4 BiMoNN

The BiSEL is akin to a complete convolution layer with multiple filters. We
can simply stack multiple BiSELs to create a network similar to a
convolutional neural network.

######  Definition 6 (BiMoNN)

Let $\phi_{1},...,\phi_{L}$ be $L$ BiSEL. We define the Binary Morphological
Neural Network (BiMoNN) as:

$\text{BiMoNN}=\phi_{L}\circ...\circ\phi_{1}$ (24)

We say that the BiMoNN is totally activated if all the composing BiSELs are
totally activated.

The BiMoNN can learn the composition of any intersection or union of dilation,
erosion, anti-dilation, and anti-erosion. That includes but is not limited to
opening, closing, black top-hat, and white top-hat.

There are two drawbacks to our current formulation. First, the input has the
same dimension as the output. ConvNets can be combined in multi-scale
architectures, which compresses the data. Currently, we cannot solve
classification tasks with our method. Second, we can only learn predeternined
composition of operators. However, some morphological operators like
skeletonization or reconstruction need an undetermined number of iterations
before convergence. Incorporating these features is left for further work.

##### Learning phase

The BiMoNN is fully differentiable, and we learn its parameters with classical
deep learning techniques. Let
$\mathcal{L}:\Omega_{I}^{2}\rightarrow\mathbb{R}$ be a differentiable loss
function. Depending on our interpretation of the outside domain
$\mathbb{Z}^{d}\leavevmode\nobreak\ \backslash\leavevmode\nobreak\
\Omega_{I}$, the effects on the border can vary. Thus, the loss is computed by
avoiding the borders, whose size is half of the kernel size $\Omega_{S}$ in
each direction. We try classical segmentation losses: the dice loss [11], the
binary cross-entropy (BCE), and the mean squared error (MSE).

Then, given a dataset of $N$ labeled images $(X,Y)$, we minimize the error
$\frac{1}{N}\sum_{i=1}^{N}{\mathcal{L}(\text{BiMoNN}(x_{i}),y_{i})}$ using
Adam [8]. We compute the loss gradient with the backpropagation algorithm
[13]. In practice, we replace $f^{+}(b)$ by $f^{+}(b)+0.5$ to help with
training for all BiSE and LUI operators. The convolution weights $W$ follow
the kaiming uniform initialization [5], and the biases begin at
$f^{+}(2)+0.5=0.63$. We initialize The BiSE and LUI scaling factors $p$ at
$0$. That may not be optimal, as it could bias the BiSE towards some
operations and Sels. Could we find other unbiased methods toward a particular
operation or Sel ? This is left for further research.

##### Binarization

Once the training is done, we can binarize each element independently to
binarize the whole BiMoNN. Theorems 2.1 and 2.2 give activation conditions
regarding a specific set of almost binary images $\mathcal{I}(u,v)$. Given a
layer $l$, the range $[u_{l},v_{l}]$ depends on the activation of the layer
$l-1$ and only exists if all the layers $\phi_{1},...,\phi_{l-1}$ are totally
activated. This ideal situation does not occur in most cases. In practice, we
binarize the network sequentially layer by layer, from the first to the last,
and compute the almost binary range $[u_{l},v_{l}]$ along the way. If a layer
$\phi_{l}$ is not totally activated, we use the approximation described in
2.2.3: then, the next range becomes $[u_{l+1},v_{l+1}]=[0,1]$.

##  3 Experiments

###  3.1 Classical morphological operators

We will be using the three datasets described in [2]: Diskorect, a set of
custom-generated images composed of ellipses and rectangles that create as
many different situations as possible; thresholded MNIST upsized to $50\times
50$, and its complementation that we call inverted MNIST. Examples are shown
in figure 3.

##### Experiment description

We learn the following operators: dilation, erosion, opening, closing, black
top-hat, and white top-hat. The 3 SEs used can be seen on table 2. For erosion
and dilation on MNIST, we use smaller SEs of size $5\times 5$. Else for all
other operations, SEs are of size $7\times 7$. The experimental protocol is as
follows: let $\gamma$ be one of these morphological operators. The input-
output couples are $\\{(x_{i},\gamma(x_{i}))\leavevmode\nobreak\
|\leavevmode\nobreak\ x_{i}\in\text{dataset}\\}$. The hyperparameters are the
loss used, the learning rate, and the batch size. For each result, see the
code for the hyperparameters used. We measure the DICE score [3] between the
predictions and targets.

Figure 2: Target SEs

###  3.2 A real example: defining regions of interest

Axial Spondyloarthritis (axSpA) is the most common auto-immune rheumatic
disease. It is painful and debilitating if untreated or incorrectly diagnosed.
The disease can be detected using MRIs: the inflammation is located on the
sacroiliac joint. Given the sacrum and the iliac shapes, the task is to detect
this joint region. We call this task axSpA.

The dataset is composed of around 1100 images with categorical images of size
about $512\times 512$ with two values: one for the iliac and one for the
sacrum. We transform them into binary images by separating each categorical
value into one channel: final images have 2 channels. The target is defined as
the joint region. Let $S_{a}=[\\![-20,20]\\!]\times\\{0\\}$. The target
operation is $\gamma_{a}:X\in\\{0,1\\}^{512\times 512\times 2}=(X_{1}\oplus
S_{a})\cap(X_{2}\oplus S_{a})$, with $X_{i}$ the $i-$channel. The resulting
input-output couples are $\\{(x_{i},\gamma_{a}(x_{i}))\leavevmode\nobreak\
|\leavevmode\nobreak\ x_{i}\in\text{axSpA dataset}\\}$ (see figure 3(d)).

(a) Diskorect

(b) MNIST

(c) Inverted MNIST

(d) axSpA input (left) and target (right)

Figure 3: Datasets example

##  4 Discussion

Results on all operations are depicted in table 1.

Table 1: DICE Results on morphological operations. $\mathbb{R}$ means real
weights, $\mathbb{B}$ means after binarization (or approximate). Bold means
DICE $>0.8$.

Dataset | Diskorect | MNIST | Inverted MNIST
---|---|---|---
Operation $\backslash$ Sel | Disk | Stick | Cross | Disk | Stick | Cross | Disk | Stick | Cross
Dilation $\oplus$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$
Erosion $\ominus$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$
Opening $T_{w}(,)$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.99}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.99}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.99}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.93}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.98}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.99}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.90}$
Closing $T_{w}(,)$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.92}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.87}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ 0.66$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.91}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$
White tophat $T_{w}(,)$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.82}$ $\mathbb{B}\leavevmode\nobreak\ 0.28$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.97}$ $\mathbb{B}\leavevmode\nobreak\ 0.33$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.81}$ $\mathbb{B}\leavevmode\nobreak\ 0.80$ |  $\mathbb{R}\leavevmode\nobreak\ 0.00$ $\mathbb{B}\leavevmode\nobreak\ 0.40$ |  $\mathbb{R}\leavevmode\nobreak\ 0.06$ $\mathbb{B}\leavevmode\nobreak\ 0.32$ |  $\mathbb{R}\leavevmode\nobreak\ 0.78$ $\mathbb{B}\leavevmode\nobreak\ 0.65$ |  $\mathbb{R}\leavevmode\nobreak\ 0.00$ $\mathbb{B}\leavevmode\nobreak\ 0.12$ |  $\mathbb{R}\leavevmode\nobreak\ 0.13$ $\mathbb{B}\leavevmode\nobreak\ 0.14$ |  $\mathbb{R}\leavevmode\nobreak\ 0.22$ $\mathbb{B}\leavevmode\nobreak\ 0.21$
Black tophat $T_{b}(,)$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ 0.31$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{0.82}$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ \mathbf{1.00}$ |  $\mathbb{R}\leavevmode\nobreak\ 0.00$ $\mathbb{B}\leavevmode\nobreak\ 0.00$ |  $\mathbb{R}\leavevmode\nobreak\ 0.38$ $\mathbb{B}\leavevmode\nobreak\ 0.00$ |  $\mathbb{R}\leavevmode\nobreak\ 0.00$ $\mathbb{B}\leavevmode\nobreak\ 0.00$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{0.98}$ $\mathbb{B}\leavevmode\nobreak\ 0.76$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ 0.29$ |  $\mathbb{R}\leavevmode\nobreak\ \mathbf{1.00}$ $\mathbb{B}\leavevmode\nobreak\ 0.26$

###  4.1 Sequential operations

For dilation and erosion, the SEs are perfectly learned. The perfect DICE (=1)
is reached in almost all cases. Even when the BiSEs are not activated, the
approximate binarizations yield good results. Performance can decrease (see
disk erosion on inverted MNIST), or increase (see disk erosion on MNIST).

On opening and closing, we reach perfect dice for most cases. All SEs can be
seen on the code repository. We manage to recover the target SEs for most
operations except on the opening on the inverted MNIST. We want to test the
following hypothesis $\mathcal{H}$: dual operators learn similarly on dual
datasets. On Diskorect, for any image $X$ in this dataset, then $X^{C}$ is
also in it. Therefore $\mathcal{H}$ implies that opening and closing should
have similar results. Already the hypothesis is rejected if we look at the
stick opening vs. the stick closing: one succeeds and the other fails. On
MNIST, $\mathcal{H}$ implies that the closing on MNIST should behave the same
as the opening on inverted MNIST and vice versa. That is not observed and
refutes further the hypothesis. Note that the model learns two anti-dilations
for the closing, which is equivalent to learning dilation followed by erosion.

We compare our results to $\mathcal{L}Morph$ and $\mathcal{S}Morph$ [9]. They
reach almost perfect DICE for erosion and dilation, but recovering the SEs
from the learned weights is not straightforward. Moreover, on the opening and
closing, the $\mathcal{L}Morph$ presents stability issues, and the
$\mathcal{S}Morph$ fails to converge correctly to the proper operations. Those
results are not surprising as these networks were designed for grey-scale
morphology.

###  4.2 Parallel operations

In this section, we study the model’s ability to learn the complementation and
intersection with top-hat transform. We manage to learn the black top-hat for
the Diskorect and inverted MNIST. For the cross, the binarization is perfect
(see figure 4). The upper branch learns the complementation of the identity,
and the bottom branch learns the closing with two sequential anti-dilations.
The white top-hat only worked on Diskorect. The binarization decreases
performance.

(a) Weights

(b) Binarization

Figure 4: Learned model for black top-hat with cross

(a) Architecture 1

(b) Architecture 2

(c) Architecture 3

Figure 5: Architectures used for axSpA

###  4.3 AxSpA regions of interest

We attempt to learn the joint region. We want to learn the intersection of two
dilations of size $41\times 41$. We try three different architectures that can
theoretically learn this operation (see figure 5). They go from wide and
shallow to deeper and narrower. Architectures 1 and 2 learn the operation
well, reaching an excellent DICE ($1$ and $0.9$). Architecture 1’s weights are
close to the target, and the binarization yields good results (DICE=$0.98$).
On the other hand, architecture 2 learns wider dilations, and its binarization
is quite bad (DICE=$0.7$). Note that there are multiple ways for this
architecture to learn the target. Finally, the deeper network failed to learn
anything. That may be due to the initialization: the output is constant and
stuck in a zero-grad zone, which is a case of vanishing gradient. This
application is hopeful in the study of axSpA. This model could be used with
classical convolutional neural networks to improve MRI analysis by exploiting
the ROI’s detection using segmentation results.

##  5 Conclusion

We create a neural network designed to work on binary elements. It comes with
explainable results that can be used to binarize the network, improving its
embedded applicability for inference. We manage to learn the erosion,
dilation, opening, and closing of small structuring elements. We can learn
sequential operations and more complex ones that need the intersection of
multiple operators. Even with bigger structuring elements, we learn
appropriate behaviors for concrete applications in medical imaging. However,
there are still unanswered questions. Why does the training differ for dual
operations? How can we avoid vanishing gradient in deeper networks? How can we
reduce the dimension to create a classification model? Can we redesign the
model to take into account undetermined number of iterations? How can we
binarize more efficiently to preserve the performance, especially if there are
multiple channels?

## References

  * [1] Angulo, J.: Some open questions on morphological operators and representations in the deep learning era. In: International Conference on Discrete Geometry and Mathematical Morphology. pp. 3–19. Springer (2021)
  * [2] Aouad, T., Talbot, H.: Binary morphological neural network. arXiv preprint arXiv:2203.12337 (2022)
  * [3] Dice, L.R.: Measures of the amount of ecologic association between species. Ecology 26(3), 297–302 (1945)
  * [4] Franchi, G., Fehri, A., Yao, A.: Deep morphological networks. Pattern Recognition 102, 107246 (2020)
  * [5] Glorot, X., Bengio, Y.: Understanding the difficulty of training deep feedforward neural networks. In: Proceedings of the thirteenth international conference on artificial intelligence and statistics. pp. 249–256. JMLR Workshop and Conference Proceedings (2010)
  * [6] Hubara, I., Courbariaux, M., Soudry, D., El-Yaniv, R., Bengio, Y.: Binarized neural networks. Advances in neural information processing systems 29 (2016)
  * [7] Kim, M., Smaragdis, P.: Bitwise neural networks. arXiv preprint arXiv:1601.06071 (2016)
  * [8] Kingma, D.P., Ba, J.: Adam: A method for stochastic optimization (2017)
  * [9] Kirszenberg, A., Tochon, G., Puybareau, É., Angulo, J.: Going beyond p-convolutions to learn grayscale morphological operators. In: International Conference on Discrete Geometry and Mathematical Morphology. pp. 470–482. Springer (2021)
  * [10] Masci, J., Angulo, J., Schmidhuber, J.: A learning framework for morphological operators using counter–harmonic mean. In: International Symposium on Mathematical Morphology and Its Applications to Signal and Image Processing. pp. 329–340. Springer (2013)
  * [11] Milletari, F., Navab, N., Ahmadi, S.A.: V-net: Fully convolutional neural networks for volumetric medical image segmentation (2016)
  * [12] Mondal, R., Dey, M.S., Chanda, B.: Image restoration by learning morphological opening-closing network. Mathematical Morphology-Theory and Applications 4(1), 87–107 (2020)
  * [13] Rumelhart, D.E., Hinton, G.E., Williams, R.J.: Learning Representations by Back-propagating Errors. Nature 323(6088), 533–536 (1986). https://doi.org/10.1038/323533a0, http://www.nature.com/articles/323533a0
  * [14] Shen, Y., Zhong, X., Shih, F.Y.: Deep morphological neural networks. arXiv preprint arXiv:1909.01532 (2019)
  * [15] Simons, T., Lee, D.J.: A review of binarized neural networks. Electronics 8(6), 661 (2019)

Table 2: Results on erosion and dilation. DICE error ($1-\text{DICE}$) is
presented for each case: $\mathbb{R}$ before binarization, $\mathbb{B}$ after
binarization. ✓ indicates that the neuron is activated.

Dataset | Diskorect | MNIST | Inverted MNIST
---|---|---|---
Operation | Disk | Stick | Cross | Disk | Stick | Cross | Disk | Stick | Cross
Target |  |  |  |  |  |  |  |  |
Dilation $\oplus$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$
Erosion $\ominus$ |  $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.001$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.004$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.001$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.001$ |  ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$

(a) Elementary operators

(b) Corresponding architecture

Figure 6: Bernoulli Denoising Set Up Figure 7: Bernoulli Denoising Results,
weights learned Figure 8: Bernoulli Denoising Results, binarization

(a) Weights for architecture 1

(b) Binarization for architecture 1

(c) Weights for architecture 2

(d) Binarization for architecture 2

Figure 9: Resulting Sels on axSpA results Table 3: Results on opening and
closing. DICE error ($1-\text{DICE}$) is presented for each case: $\mathbb{R}$
before binarization, $\mathbb{B}$ after binarization. ✓ indicates that the
neuron is activated.

Dataset | Diskorect | MNIST | Inverted MNIST
---|---|---|---
Operation | Disk | Stick | Cross | Disk | Stick | Cross | Disk | Stick | Cross
Target |  |  |  |  |  |  |  |  |
Opening $\circ$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.007$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.012$ |  $\times$ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.006$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.066$ |  $\times$ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.001$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.018$ |  $\times$ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.014$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.096$
Closing $\bullet$ |  ✓ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.077$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.128$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.336$ |  $\times$ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ ✓ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ |  ✓ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.092$ |  $\times$ $\times$ $\mathbb{R}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.000$ $\mathbb{B}\leavevmode\nobreak\ \leavevmode\nobreak\ 0.001$