{'fraction_non_alphanumeric': 0.03045579390188784, 'fraction_numerical': 0.011021103501025623, 'mean_word_length': 4.753950790158032, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The Little W-Net That Could: State-of-the-Art Retinal Vessel Segmentation with Minimalistic Models

The segmentation of the retinal vasculature from eye fundus images represents one of the most fundamental tasks in retinal image analysis. Over recent years, increasingly complex approaches based on sophisticated Convolutional Neural Network architectures have been slowly pushing performance on well-established benchmark datasets. In this paper, we take a step back and analyze the real need of such complexity. Specifically, we demonstrate that a minimalistic version of a standard U-Net with several orders of magnitude less parameters, carefully trained and rigorously evaluated, closely approximates the performance of current best techniques. In addition, we propose a simple extension, dubbed W-Net, which reaches outstanding performance on several popular datasets, still using orders of magnitude less learnable weights than any previously published approach. Furthermore, we provide the most comprehensive cross-dataset performance analysis to date, involving up to 10 different databases. Our analysis demonstrates that the retinal vessel segmentation problem is far from solved when considering test images that differ substantially from the training data, and that this task represents an ideal scenario for the exploration of domain adaptation techniques. In this context, we experiment with a simple self-labeling strategy that allows us to moderately enhance cross-dataset performance, indicating that there is still much room for improvement in this area. Finally, we also test our approach on the Artery/Vein segmentation problem, where we again achieve results well-aligned with the state-of-the-art, at a fraction of the model complexity in recent literature. All the code to reproduce the results in this paper is released.


Introduction and Related Work
Retinal vessel segmentation is one of the first and most important tasks in for the computational analysis of eye fundus images. It represents a stepping stone for more advanced applications like artery/vein ratio computation [11], blood flow analysis [5], image quality assessment [12], retinal image registration [13], or retinal image synthesis [14].
Initial approaches to retinal vessel segmentation were fully unsupervised and relied on conventional image processing operations like mathematical morphology [15,16] or adapted edge detection operations [17]. The idea behind these methods is to apply some kind of transformation to a retinal image so that vessel intensities are emphasized, and then threshold the result to achieve a segmentation. Although research on advanced filtering techniques for retinal vessel segmentation has continued over more recent years [6,18], these kind of techniques consistently reach lower performance on established benchmarks, likely due to their inability to handle images with pathological structures and generalizing to images with different appearances and resolutions.  Figure 1: This work provides the most comprehensive cross-dataset performance study on vessel segmentation to date. A representative image from each of the 10 databases considered in this paper: DRIVE [1], CHASE-DB 1 [2], HRF [3], STARE [4], LES-AV [5], IOSTAR [6], DR HAGIS [7], AV-WIDE [8], DRIDB [9], UoA-DR [10]. A detailed description of each database is given in Table 2.
In contrast, early learning-based approaches quickly showed more promising results and better performance than their image processing counterparts [1,[19][20][21][22]. The common strategy of these techniques consisted on the extraction of specifically designed local descriptors that were later passed to a relatively simple classifier, and the focus became to derive the most discriminative visual features for the task at hand.
This predominance of machine learning techniques was reinforced with the emergence of deep neural networks. After initial realization that Convolutional Neural Networks (CNNs) could outperform previous methods, bypassing any manual feature engineering and directly learning from raw data [23,24], a constant stream of publications has kept appearing on this topic, up to the point that almost any new competitive vessel segmentation technique is based now on this approach.
Standard CNN approaches to retinal vessel segmentation are based on the sequential application of a stack of convolutional layers that subsequently downsample and upsample input images to reach a probabilistic prediction of vessel locations. The weights of the network are then iteratively updated to improve those predictions by means of the minimization of a given miss-classification loss, e.g. cross-entropy. Either processing small image patches [23] or the entire image [24], these approaches can succeed in segmenting the retinal vasculature with few annotated training data.
Extensions to the above paradigm tend to involve complex operations, like specifically designed network lay-  [28]. Other custom convolutional blocks and layers based on domain knowledge have been explored in several recent works [29,30].
Non-standard losses have also been proposed in recent years. Yan et al. [31] trained a U-Net architecture [32] by minimizing a joint-loss that receives output predictions from two separate network branches, one with a pixel-level and one with a segment-wise loss. The same authors introduced a similar segment-level approach in [33] [44]. Their proposed M2U-Net architecture leverages an ImageNet-pretrained MobileNet model [45] and achieves results slightly inferior to the state-of-the-art.

Goals and Contributions
The goal of this paper is to show that 1) as recently shown in other computer vision problems [46,47], there is no need of designing complex CNN architectures to outperform most current techniques on the task of retinal vessel segmentation, and 2) when a state-of-the-art model is trained on a particular dataset and tested on images from different data sources, it can result in poor performance. On our way to establish these two facts, we make several contributions: 1. We introduce a simple extension of the standard U-Net architecture, named W-Net, which allows us to achieve outstanding performance on wellestablished datasets.
2. We establish a rigorous evaluation protocol, aiming to correct previous pitfalls in the area.
3. We test our approach in a large collection of retinal datasets, consisting of 10 different databases showing a wide range of characteristics, as illustrated in Fig. 1.

4.
Our cross-dataset experiments reveal that domain shift can induce performance degradation in this problem. We propose a simple strategy to address this challenge, which is shown to recover part of the lost performance.
5. Finally, we also apply our technique to the related problem of Artery/Vein segmentation from retinal fundus images, matching the performance of previous approaches with models that contain much fewer parameters.
We believe that our results open the door to a more systematic study of new domain adaptation techniques in the area of retinal image analysis: since training one of our models to reach superior performance takes approximately 20 minutes in a single consumer GPU, our work can serve as a first step for quick design and experimentation with improved approaches that can eventually bridge the generalization gap across different data sources revealed by our experiments. To favor research in this direction, we release the code and data to reproduce our results at github.com/agaldran/lwnet.

Baseline U-Net: structure and complexity
One of the main goals of this work is to explore the lower limits in model complexity for the task of retinal vessel segmentation. Accordingly, we consider one of the simplest and most popular architectures in the field of medical image segmentation, namely the U-Net [32]. A standard U-Net is a convolutional autoencoder built of a downsampling CNN that progressively applies a set of filters to the input data while reducing its spatial resolution, followed by an upsampling path that recovers the original size. U-Nets typically contain skip connections that link activation volumes from the downsampling path to the upsampling path via concatenation or addition in order to recover higher resolution information and facilitate gradient flow during training.
Let us parametrize a U-Net architecture φ by the number of times the resolution is downscaled/upscaled k, and the number of filters applied in each of these depth levels, f k .
To simplify our analysis, we will only consider filters of size 3 × 3, and we double the amount of filters each time we increase k -this is a common pattern in U-Net designs. Therefore, in this work a U-Net is fully specified by a pair of numbers (k, f 0 ), and we denote it by φ k,f0 . In addition, we assume that Batch-Norm layers are inserted after each convolutional operation and that extra skip connections are added within each block. An example of such design pattern is shown in the left hand side of Fig. 2. In the remaining of this work, we will consider. the φ 3,8 architecture, which contains approximately 34, 000 parameters. It is important to stress that this represents 1-3 orders of magnitude less than previously proposed CNNs for the task or retinal vessel segmentation.

The W-Net architecture
We also introduce a modification of the U-Net architecture, that we refer to as W-Net. The idea behind a W-Net, denoted by Φ, is straightforward: for an input image x, the result of forward-passing it through a standard U-Net φ 1 (x) is concatenated to x, and passed again through a second U-Net, which would be represented as: In practice, φ 1 generates a first prediction of vessels localization that can then be used by φ 2 as a sort of attention map to focus more on interesting areas of the image, as shown in Fig. 2. Of course a W-Net Φ contains twice the amount of learnable parameters as a standard U-Net. However, since the base U-Nets φ 1 3,8 , φ 2 3,8 involved in its definition contain only 34, 000 each, the W-Net considered in this paper will have around 68, 000 weights, which is still one order of magnitude below the simplest architecture proposed to date for vessel segmentation, and three orders of magnitude smaller than state-of-the-art architectures.  Figure 2: Representation of the WNet architecture. The left-hand-side part of the architecture corresponds to a standard minimal U-Net φ 3,8 with ∼34K parameters, and it achieves performance on-par with the state-of-the-art. The full W-Net, defined by eq. (1), is composed of two consecutive U-Nets; it outperforms all previous approaches with just around 70k parameters: 1-3 orders of magnitude less than previously proposed CNNs.

Training Protocol
In all the experiments reported in this paper, the training strategy remains the same. Specifically, we minimize a standard cross-entropy loss between the predictions of the model on an image x and the actual labels y. It is worth mentioning that in the W-Net case, an auxiliary loss is computed for the output of the first network and linearly combined with the loss computed for the second network: The loss is backpropagated and minimized by means of the Adam optimization technique. The learning rate is initially set to λ = 10 −2 , and cyclically annealed following a cosine law until it reaches λ = 10 −8 . Each cycle runs for 50 epochs, and we adjust the amount of cycles (based on the size of each training set) so that we reach 4000 iterations in every experiment.
Images are all resized to a common resolution and processed with standard data augmentation techniques, and the batch size is set to 4 in all experiments. During training, at the end of each cycle the Area Under the ROC curve is computed on a separate validation set, and the best performing model is kept. Test-Time-Augmentations (horizontal and vertical image flips) are applied during inference in all our experiments.

A simple Baseline for Domain Adaptation
One of the main goals in this paper is to show that, even if simple approaches can outperform much more complex current techniques, the problem of retinal vessel segmentation is not as trivial as we may extrapolate from this. The reason is that models trained on a given dataset do not reach the same level of performance when tested on retinal images sampled from markedly different distributions, as we quantitatively show in section 3.3. A relevant drop of performance appears when a model trained on a given source dataset S is used to generate segmentations on a substantially different target dataset T .  Figure 3: Domain Adaptation strategy employed in this work: A model trained on source data is used to generate pseudo-labels on a target dataset. The original source data and the target data with the pseudo-labels are used to fine-tune that model and produce better predictions.

Pseudo-Labels
Attempting to close such performance gap is a task falling within the area of Domain Adaptation, which has been subject of intensive research in the computer vision community for the last years [48]. Here we explore a simple solution to address this challenge in the context of retinal vessel segmentation. Namely, given a model U S trained on S we proceed by first generating probabilistic segmentations for each image x ∈ T . We then merge the source dataset labels y S with the target dataset segmentations {U S (x) | x ∈ T }, which we treat as pseudo-labels. Lastly, we fine-tune U S in this new dataset, starting from the weights of the model trained on S, with a learning rate reduced by a factor of 100, for 10 extra epochs. During training, we monitor the AUC computed in the training set (including both source labels and target pseudo-labels) as a criterion for selecting the best model. It is worth stressing that pseudo-labels U S (x) remain with probabilistic values in [0, 1], rather than binary, with the goal of informing the model about the uncertainty present on them.
The rationale behind this is to force the new model to learn from segmentations in S with confident annotations, while at the same time exposing it to images from T before testing on them. A graphical overview of this strategy is shown in Fig. 3.

Evaluation Protocol
Unfortunately, a rigorous evaluation protocol for retinal vessel segmentation is missing in the literature due to several issues: differences in train/test splits in common benchmarks, or wrongly computed performance metrics.
Below we outline what we understand as a correct evaluation procedure: 1. All performance metrics are computed at native image resolution and excluding pixels outside the retinal area, which are trivially predicted as having zero probability of being part of a vessel.
2. Whenever an official train/test split exists, we follow it. When there is none, we follow the least "favorable" split we could find in previous works, i.e. the one assigning less images for training. We make this decision based on the low difficulty of the vessel segmentation task; this is in contrast with other works that employ leave-one-out cross-validation, which can use up to 95% of the data for training [31,49].
3. We first accumulate all probabilities and labels across the training set, then perform AUC analysis and derive an optimal threshold (maximizing the Dice score) to binarize predictions. We then apply the same procedure on the test set, now using the pre-computed threshold to binarize test segmentations. This stands opposed to computing metrics per-image and reporting the mean performance [50], or using a different threshold on each test image for binarizing probabilistic predictions [51].
4. Cross-dataset experiments are reported in a variety of different datasets. No pre-processing or hyper-parameters are re-adjusted when changing datasets, since this heavily undermines the utility of a method. This is a typical shortcoming of unsupervised approaches, which tend to modify certain parameters to account for different vessel calibers [6]. Also, the threshold to binarize predictions on different datasets is the one derived from the original training set, without using test data to readjust it.
5. We do not report accuracy, since this is a highly imbalanced problem; the Dice score is a more suitable figure of merit. We also report Matthews Correlation Coefficient (MCC), as it is better suited for imbalanced problems [52]. Sensitivity and specificity computed at a particular cut-off value are avoided, as they are useless when comparing the performance of different models.

Experimental Results
In this section we provide a comprehensive performance analysis of the methodology introduced above.

Datasets Description
A key aspect of this work is our performance analysis of a wide range of data sources. For each of the considered models, we train them on three different datasets, namely DRIVE [1], CHASE-DB [2] and HRF [3]. The train/validation/test splits for DRIVE are provided by the authors, but there is no official split in the other two cases. We decide to adopt the most restrictive splits we could find in the literature [44]: only 8 of the 22 images in CHASE-DB, and 15 of the 45 images in HRF are used for training and validation.
After training, we test our models on the corresponding test sets. In section 3.3, we also consider another seven different datasets for cross-datasets and domain adaptation evaluation. These include a variety of different image qualities, resolutions, pathologies, and even image modalities. Further details of each of these databases are given in Table 1.
It is also worth mentioning that, for training, all images from DRIVE, CHASEDB, and HRF are downsampled to a 512 × 512, 512 × 512, and 1024 × 1024 resolution respectively, whereas evaluation is carried out at native resolution for all datasets. No pre-processing (nor postprocessing) was applied.

Performance Evaluation
For evaluating our approach, we follow the procedure outlined in section 2.5, and report AUC, DICE, and MCC values in Table 2. For comparison purposes, we select a large set of 20 vessel segmentation techniques published in the last years in relevant venues. We also report the performance of a standard U-Net φ 3,8 , which contains around 34, 000 parameters, and our proposed W-Net (with twice as many parameters), referred to as Little U-Net/W-Net. OD-centered images, highly varying illumination 11 healthy and 11 glaucomatous patients Table 1: Description of each of the ten datasets considered in this paper in terms of image and population characteristics.
As discussed above, not all techniques were trained on the same data splits for the CHASE-DB and HRF datasets. Our splits correspond to those used in [44], which is a model specifically designed to be efficient, and therefore contains a minimal amount of learnable parameters. Surprisingly, we see that the Little U-Net model already surpasses the performance of [44] in all datasets, even if it has 16 times less weights. The performance of the Little U-Net is overall impressive, achieving a performance on-par or superior to most of the compared techniques.
When we analyze the performance of the Little W-Net model, we observe that it surpasses by a wide margin, both in terms of AUC and DICE score, the numbers obtained by all the other techniques. This is specially remarkable when considering that the Little W-Net is a far less complex model than any other approach (excluding Little U-Net). The only dataset where Little W-Net fails to reach the highest performance is HRF, which we attribute to the mismatch in training and test resolutions. The work in [26] , which achieves the state-of-the-art in this dataset, was trained on image patches, and it is therefore less susceptible to such mismatch. Nevertheless, the Little W-Net achieves the second best ranking in this dataset, within a short distance from [26].

Cross-dataset experiments and Domain Adapation
From the above analysis, one could be tempted to conclude that the task of segmenting the vasculature from retinal images is relatively trivial. Nevertheless, the usefulness of these models remains questionable if they are not tested on data coming from sources different than the training data. In order to exhaustively explore this aspect of the problem, we select the W-net model trained on DRIVE images and generate predictions on up to ten different datasets (including the DRIVE test set). We then carry out a performance analysis similar to the one described in section 2.5, and report the results in the first row of Table 3. We can see how the great performance of this model on the DRIVE test set is only maintained on the STARE dataset, which is quite similar in terms of resolution and quality. However, for data arising from different distributions, this performance is rapidly degraded. In terms of AUC, the four worst results correspond to: 1) HRF, which has images of a much greater resolution than DRIVE, 2) LES-AV, where images are centered in the optic disc instead of in the macula, 3) AV-WIDE, which contains ultra-wield field images of markedly different aspect, and 4) UoA-DR, which has mostly pathological images of different resolutions.
We then apply the strategy described in section 2  erate segmentations that we use as pseudo-labels to retrain the same model in an attempt to close the performance gap. Results of this series of experiments are displayed in the second row of Table 3, where it can be seen that in almost all cases this results in an increased performance in terms of AUC, DICE score, and MCC, albeit relatively modest in some datasets. In any case, this implies that the retrained models have a better ability to predict vessel locations on new data. Figure 4 illustrates this for two images sampled from the CHASE-DB and the LES-AV datasets. Note that DRIVE does not contain optic-disc centered images. For the CHASE-DB example, we see that some broken vessels, probably due to the strong central reflex in this image, are recovered with the adapted model. In the LES-AV case, we see how an image with an uneven illumination field results in the DRIVE model missing much of the vessel pixels in the bottom area. Again, part of this vessels are successfully recovered by the adapted model.

Artery/Vein Segmentation
We also provide results for the related problem of Artery/Vein segmentation. It should be stressed that this is a different task than A/V classification, where the the vessel tree is assumed to be available, and the goal is to classify each vessel pixel among the two classes. In this case, we aim to classify each pixel in the entire image as artery, vein, or background. In order to account for the greater difficulty of the problem, we consider a bigger W-Net composed of two U-Nets φ 4,8 , which still contains far less weights than current A/V segmentation models [61,62]. In addition, we double the number of training cycles, and train with 4 classes having into account uncertain pixels, as it has been proven beneficial for this task [61]. Table 4 shows the results of our W-Net, compared with two recent A/V segmentation techniques. In this section, we train our model on DRIVE and HRF, following the data splits provided in [62]. We also show results of a cross-dataset experiment in which a model trained on DRIVE is tested on the LES-AV dataset.
A similar trend as in Section 3.2 can be observed: other models designed for the same task contain orders of magnitude more parameters than our approach, but we observe an excellent performance of the W-Net architecture: it seems competitive with the compared methods, ranking even higher than [62] in terms of Dice score and higher than [61] in terms of MCC, at a fraction of computational cost. Some qualitative results of the W-Net trained on DRIVE and tested on LES-AV are shown in Fig. 5.

Ablation Study: W-Net vs U-Net
As shown in Section 3.2, the iterative structure of the W-Net architecture helps in achieving a better performance when compared to the standard U-Net. However, it should  Table 3: Our domain adaptation strategy improves results in a wide range of external test sets. First row: W-Net trained on DRIVE, second row (pseudo-l): same model fine-tuned using the strategy illustrated in Fig. 3. Best metric marked bold. be noted that W-Net contains twice as many weights as the considered Little U-Net. Since these are two relatively small models, it might be that U-Net is simply underfitting, and all the benefits observed in Table 2 just come from doubling the parameters and not from any algorithmic improvement.
In view of this, it is worth investigating the question of whether W-Net brings a significant improvement over a standard U-Net architecture. For this, we consider a larger U-Net φ 3,12 , which actually contains more parameters than the above W-Net ( 76K vs 68K). To determine statistically significant differences in AUC and DICE between these two models, we train them under the exact same conditions as in Section 3.2, and after generating the corresponding predicted segmentations on each of the three test sets, we apply the bootstrap procedure as in [63,64]. This is, each test set is randomly sampled with replacement 100 times so that each new set of sampled data contains the same number of examples as the original set, in the same proportion of vessel/background pixels. For both models, we calculate the differences in AUCs and dice scores. Resampling 100 times results in 100 values for performance differences. P-values are defined as the fraction of values that are negative or zero, corresponding to cases in which the better model in each dataset performed worse or equally than the other model. The statistical significance level is set to 5% and, thus, performance differences are considered statistically sig-nificant if p < 0.05. The resulting performance differences are reported in Table 5, were we refer to the U-Net φ 3,12 as "Big U-Net". We see that, in all cases, the larger U-Net's results are slightly better than the smaller U-Net in Table 2, but the performance of the W-Net is still significantly higher, even if it has approximately 10% less weights.

Computational and Memory Requirements
The reduced complexity of the models proposed in this paper enhance their suitability for resource-constrained scenarios, both in terms of training them and of deploying them in, e.g., portable devices. Training a little U-Net and a little W-Net to reach the performance shown in Table 2 is feasible even without a GPU. When training on a single GPU (GeForce RTX 2080 Ti), the training time of a little U-Net on the datasets shown in Table 2 Table 4: Performance Comparison for the artery/vein segmentation task. For DRIVE, performance is reported on the entire image domain | on a ring-shaped region around the Optic Disc [62]. Performance is computed using the predictions and code provided by [62]. * Predictions on LES-AV are generated from models trained on DRIVE. in embedded/portable devices. It must be noted, however, that in both cases the inference time was slightly slower when compare to other efficient approaches, partly due to implementation of Test-Time Augmentation.

Conclusions
This paper reflects on the need of constructing algorithmically complex methodologies for the task of retinal vessel segmentation. In a quest for squeezing an extra drop of performance on public benchmark datasets and adding certain novelty, recent works on this topic show a trend to develop overcomplicated pipelines that may not be necessary for this task. The first conclusion to be drawn from our work is that sometimes Occam's razor works best: minimalistic models, properly trained, can attain results that do not significantly differ from what one can achieve with more complex approaches.
Another point worth stressing is the need of rigor in evaluating retinal vessel segmentation techniques. Employing overly favorable train/test splits or incorrectly computing performance leads to reporting inflated metrics, which in turn saturate public benchmarks and provides a false sensation in the community that the retinal vessel segmentation problem is solved. Our experiments on a wide range of datasets reveal that this is not the case, and that retinal vessel segmentation is indeed an ideal area for experimenting with domain adaptation techniques. This is so because a) performance of models trained on a source dataset rapidly degrades when testing on a different kind   Table 6: Parameters and memory requirements vs performance for several retinal vessel segmentation models.
of data, and b) training models to achieve high performance is cheap and fast, which enables fast experimentation of new ideas.