## 4 Methodology
### Staff Line Detection  
Our staff line detection algorithm aims to extract staves and their respective staff lines as a group of polylines from an input image. Each polyline is a list of points located in the original image. Our algorithm (compare Figure 3) for the staff line detection acts on the deskewed greyscale image of a full page as input and expects as parameters the number of staff lines per staves (four in the case of this paper) and the average staff line distance \(d_{\text{SL}}\) which is however approximated by the algorithm of [32; 33]. \(d_{\text{SL}}\) is used to normalise the original input to an image where \(d_{\text{SL}}\) is a fixed value of 10 px. The automatic staff line distance approximation algorithm of [33] acts on the binarised version of the input image which is computed by the OCRopus binarisation tool. The idea of the algorithm is based on run-length encoding (RLE) for each column of the binary image. RLE encodes an array of binaray black and white pixels in sequence length, for example, the sequence \(\{111001111000111010\}\) is encoded as 3, 2, 5, 3, 3, 1, 1, 1. The most common black runs represent the height of a single staff line, while the most common white runs denote the staff space, 1 and 3 in the upper example, respectively. We adapted this algorithm by constraining the staff space to be at least twice the staff line height to gain more robust results with noisy data. The actual \(d_{\text{SL}}\) is finally approximated by the sum of the staff line height and space. A preliminary experiment shows that on all available pages this algorithm  
Figure 5: GT pairs of input and target for training the FCN. The upper box shows an example for the staff line detection where the FCN acts on the full page. The staff lines in the GT are drawn as black lines in the target binary image. The symbol detection, instead, expects an image of a single line as input. The different grey levels of the target represent the symbol classes, for example the darkest level indicates a F-clef, while the brightest level marks a NC which is the start of a neume. correctly approximates \(d_{\text{SL}}\), hence all images can be normalised automatically. This normalisation step is only required for the staff line detection but not for the later symbol detection. The pre-processed and normalised image (a) is then fed into the FCN and postprocessing pipeline (compare Figure 6). The FCN, which is trained to discriminate between staff line and background pixels, predicts a probability map (b)--compare also Figure 5. A threshold of 50% corresponding to the class with the highest probability classifies each pixel (c). To prune artefacts, we then apply a horizontal RLE to drop row-wise pixel groups with a length shorter than 6 px (d). The remaining connected components (e) are then used to determine preliminary polylines by computing the vertical centre at each horizontal position for each component (f). Since the staff lines are sometimes interrupted, we apply a postprocessing step that combines polylines which are on a similar height level (g). Finally, we cluster all staff lines into staves by first computing the most common distance of staff lines \(\bar{d}_{\text{SL}}\) and then group staff lines with a distance of smaller than \(1.5\cdot\bar{d}_{\text{SL}}\) (h). We only keep staves with four lines, by what staves that might be wrongly classified noise (e.g., bleeding), text or the page margin, are dropped. The remaining grouped polylines represent the final result of the staff line detection algorithm. The FCN is trained on GT that solely contains the human annotated staff lines drawn with a thickness of 3 px. During training, we optionally augment the data by randomly rotating the image up to 2\({}^{\circ}\), flipping the image vertically or horizontally, and varying the contrast and brightness up to a  
Figure 6: Staff line detection steps including the application of the FCN and the postprocessing. The example images show the output of the respective step.