# Normalizing Flows for Out-of-Distribution Detection: Application to Coronary Artery Segmentation
## 2 Methods
### NF Architectures
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Stage** & **Block** & **No. Filters** & \multicolumn{2}{c}{**Cumulative Receptive Field**} \\ \hline \multirow{2}{*}{1} & Conv3D with 3 \(\times\) 3 \(\times\) 3 kernel, stride 1, padding 1; BatchNorm; LeakyReLU & \multirow{2}{*}{64} & \multirow{2}{*}{\(3\times 3\times 3\)} \\ \hline \multirow{2}{*}{2} & Conv3D with 1 \(\times\) 1 \(\times\) 1 kernel, stride 1, padding 0; BatchNorm; LeakyReLU; Dropout & \multirow{2}{*}{64} & \multirow{2}{*}{\(3\times 3\times 3\)} \\ \hline \multirow{2}{*}{3} & Conv3D with 3 \(\times\) 3 \(\times\) 3 kernel, stride 1, padding 1; BatchNorm; LeakyReLU; Dropout & \multirow{2}{*}{64} & \multirow{2}{*}{\(5\times 5\times 5\)} \\ \hline \multirow{2}{*}{4 \(-s\)} & Conv3D with 1 \(\times\) 1 \(\times\) 1 kernel, stride 1, padding 0 & \multirow{2}{*}{As many as \(x\)’s channels for checkerboard masking or half for channel masking} & \multirow{2}{*}{\(5\times 5\times 5\)} \\ \cline{1-1} \cline{2-5} \(4-t\) & Conv3D with 1 \(\times\) 1 \(\times\) 1 kernel, stride 1, padding 0 & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: \(s\) and \(t\) network architecture. Figure 1: Baseline model architecture. Activation norm not depicted. leading to larger final log-probabilities. Therefore, stacks of affine coupling layers are incentivized to guess local pixel values by exploiting texture correlations and information feed-forward by bypassing the masks, instead of building features increasing in complexity and expressivity as it is happening for classical stacks of convolutional layers. Semantic features can describe higher level characteristics of the modeled objects, such as global shapes (e.g., the relatively circular shape of the lumen with its spatial continuity between slices), global appearance (e.g., how distinguishable is the lumen from the background) and object correlations (e.g., the mask's spatial alignment to the lumen; calcifications, if present, should be around the lumen, etc.). [PERSON] et al. [21] shows that by constraining a general-purpose residual network [22] to be bi-Lipschitz, it can be used as a NF architecture. The expressive power of ResNets is shown to be preserved even with this constraint. On a classification task the invertible ResNet performed better while on a density modeling task it performed similar to affine-coupling networks. However, sampling from a NF consisting of a ResNet is an iterative process at each residual layer and training/inference involves approximating the logDet at each layer through a power series truncation. Therefore, such ResNet-based models are not that straight-forward in their operation as, e.g., Glow-based models. Ref. [23; 24] tackle the problem of conditional probability modelling through the use of NF. In coupling layers, instead of using only the passed-through portion of the layer input to compute \(s\) and \(t\), an additional embedding (dependent on the conditioning variable) is also employed. In addition, several layers such as Activation Norm (ActNorm) and invertible \(1\times 1\) Convolutions no longer have constant (but trainable) parameters for all inputs/samples, but instead their weights are computed based on the conditional embedding, therefore tailoring their effect for each particular pair of (condition, sample). Inspired by the above research, we propose the use of a novel type of coupling layer, one which can operate efficiently for both NF directions, does not focus on local pixel correlations and has an inductive bias similar to conventional CNNs. The layer resembles a standard Glow-like sequence of \(1\times 1\) Invertible Convolution, channel masking, affine coupling layer. However, the last step is replaced with a \(1\times 1\) convolution (with applied bias) whose parameters are computed based on the passed-through channels, as in [25].