# Normalizing Flows for Out-of-Distribution Detection: Application to Coronary Artery Segmentation
## 3 Results and Discussion
### Sampling from the Models  
We employed the models trained on the augmented trainset to generate novel samples. Similar to sampling procedures in [11], we employed \(\mathcal{N}(\mathbf{0},\ 0.6\cdot I)\) instead of the actual prior distribution (i.e., standard normal multivariate distribution) in order to produce samples with larger log-probs and which look more realistic. Each new sample was run back through the model in the forward direction to compute the log-probs, confirming that the sample is in fact in-distribution (the sampling procedure may seldomly generate samples of lower log-probability). Figure 14 shows samples from the two models. As already revealed in [13], the baseline model tends to focus more on textures and is unable to capture the semantics of the training data. We observed that in most of the generated samples, the segmentation mask is lacking (i.e., only zeros are generated on the mask channel). In addition, the usual round shape of the lumen is not distinguishable in the image channel. In [11], the proposed Glow model can indeed generate realistic samples. That model operates on the same spatial resolution as ours (32 \(\times\) 32) and uses the same number of 3 spatial scales (i.e., squeeze operations); however, it employs up to 48 coupling layers per scale (as opposed to ours, which only uses 3 coupling layers per scale due to runtime considerations). We hypothesize that many glow-like layers are required at each scale because of their tendency to disregard semantic content and a deep stack of such layers can approximate some semantic content as very complex textures. In contrast, the proposed architecture uses a small number of 4 (novel) coupling layers per scale and manages to capture the semantic content of a usual data point: the lumen has the typical shape in the image channel, the segmentation mask is present (with plausible pixel-values, e.g., close to either 0 or 1) and respects the shape and position of the lumen in the image channel. We argue that inspecting the generated samples is an explainability mechanism which offers insight into the learnt probability distribution, i.e., the model can provide example inputs which are very likely under the learnt density and by repeating the sampling procedure enough times, an approximation of the typical set of the learnt distribution may be constructed. If a generative model consistently produces samples with high associated log-probabilities but which have low quality under manual inspection and are implausible considering the specific topic/domain, then this is proof that the learnt probability density is not a good approximation of the true probability density and, therefore, the model cannot be reliably used for OoD detection (even if its train-time loss function encouraged the \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Metric**} &
\begin{tabular}{c} **Inter-Expert Agreement** \\ **Average [Min, Max]** \\ \end{tabular} & **Baseline Model** & **Proposed Model** \\ \hline Accuracy & 0.81 [0.79, 0.86] & 0.64 & 0.79 \\ \hline Sensitivity & 0.79 [0.70, 0.87] & 0.48 & 0.76 \\ \hline Specificity & 0.83 [0.76, 0.90] & 0.77 & 0.81 \\ \hline PPV & 0.79 [0.70, 0.87] & 0.63 & 0.76 \\ \hline NPV & 0.83 [0.76, 0.90] & 0.65 & 0.81 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Metrics on the secondary dataset for the baseline and the proposed model. The proposed model consistently outperforms the baseline and has metric values close to inter-expert agreement. separation of _some_ OoD data sets). In practice, the amount of available OoD data is usually limited and the inductive bias of the model still holds a huge importance in the quality of the distribution fitting. [PERSON] et al. [27] shows that \"even good generators can still exhibit OoD detection failures\", therefore the above condition of good/plausible sample generation is necessary, but not sufficient. It is necessary because the learnt probability density should match the underlying data probability density as closely as possible.