The expert segmentations were discretized by overlaying the fundus image with a grid and counting the number of lesion pixels in each cell. An example of a 10 × 10 grid overlaid to one of the images in the IDRiD dataset is given in
Figure 2.
The pixel count was weighted by the lesion types to deal with severe pixel count imbalance between lesion types: in the expert segmentations of the IDRiD dataset 1% of the pixels indicated as lesions by the experts correspond to microaneurysms, 8% correspond to soft exudates, 44% correspond to hard exudates and 47% correspond to hemorrhages. Not taking this imbalance into account would lead to microaneurysms barely contributing to the agreement score, although they are crucial for identifying early stages of DR diagnosis.
34 We denote the segmentation of hemorrhages as a matrix as
\(HE \in {\mathbb R}^{N\times N}\), with
HEi,j = 1 if the expert indicated the presence of a hemorrhage at that pixel and
HEi,j = 0 otherwise. Similarly,
MA describes microaneurysms,
EX hard exudates and
SE soft exudates. The discretized expert segmentation
DE combines these four matrices into one by taking weighted sums of these segmentation matrices in grid cells. For an
S ×
S grid we computed
DEi,j for
i,
j ∈ 1...
S of the discretized expert segmentation as follows:
\begin{eqnarray*}
\begin{array}{@{}l@{}} D{E_{i,j}} = {w_{HE}}\mathop \sum \limits_{p\; = {\rm{\;}}id}^{\left( {i + 1} \right)d - 1} \mathop \sum \limits_{q\; = {\rm{\;}}jd}^{\left( {j + 1} \right)d - 1} H{E_{p,q}} + {w_{MA}}\mathop \sum \limits_{p\; = {\rm{\;}}id}^{\left( {i + 1} \right)d - 1} \mathop \sum \limits_{q\; = {\rm{\;}}jd}^{\left( {j + 1} \right)d - 1} M{A_{p,q}}\\ \\ \qquad + {\rm{\;}}{w_{SE}}\mathop \sum \limits_{p\; = {\rm{\;}}id}^{\left( {i + 1} \right)d - 1} \mathop \sum \limits_{q\; = {\rm{\;}}jd}^{\left( {j + 1} \right)d - 1} S{E_{p,q}} + {w_{EX}}\mathop \sum \limits_{p\; = {\rm{\;}}id}^{\left( {i + 1} \right)d - 1} \mathop \sum \limits_{q\; = {\rm{\;}}jd}^{\left( {j + 1} \right)d - 1} E{X_{p,q}}{\rm{\;\;}} \end{array}\end{eqnarray*}
with
\(d = \frac{N}{S}\) the width/height of a cell, and
wHE,
wMA,
wSE, and
wEX the weights for hemorrhages, microaneurysms, soft exudates, and hard exudates. We determined the weight for each lesion type by its pixel count over all training images, relative to the pixel count of the most frequently occurring lesion type. This led to the following weights for the IDRiD dataset:
wHE = 1,
wEX = 1.05,
wSE = 5.77 and
wMA = 46.97.
The heatmap discretization was computed in a similar manner but without weighting, as heatmaps do not distinguish between different lesion types. For a heatmap
H ∈
RN × xN entry
DHi,j for i,j ∈ 1..S of the discretized heatmap
DH ∈
RS × xS was computed as follows:
\begin{eqnarray*}D{H_{i,j}} = \mathop \sum \limits_{p\; = {\rm{\;}}id}^{\left( {i + 1} \right)d - 1} \mathop \sum \limits_{q\; = {\rm{\;}}jd}^{\left( {j + 1} \right)d - 1} {H_{p,q}}{\rm{\;}}\end{eqnarray*}