# Full-Scale Piano Score Recognition
## 3 Method
### Find Dynamics via YOLOv8  
Before training the CRNN on sheet music, it is crucial to detect and remove dynamics symbols, as their presence can negatively impact the accuracy of note recognition. As outlined in the data augmentation section, the positions and ranges of the dynamics  
Figure 3: The structure of the OMR Processing Block.  
Figure 2: The structure of the proposed model.  
symbols are extracted from the SVG file, while their types and sequences are derived from the KERN file.  
The training dataset comprises 43,105 image samples, with 5389 samples designated for both testing and validation. The dataset includes 12 categories of dynamics symbols: \(f\), \(p\), \(m\)f, \(mp\), \(fp\), \(f\), \(pp\), \(sf\), \(ce\), \(dec\), \(cre\_word\), and \(dec\_word\). For YOLOv8 training, these categories are mapped to numerical labels ranging from 0 to 11. Specifically, the symbols \(cre\), \(dec\), \(cre\_word\), and \(dec\_word\) correspond to the top-left, top-right, bottom-left, and bottom-right symbols in Figure 4, respectively. Each symbol is enclosed within a bounding box to support YOLOv8 training.  
Before training the YOLOv8 model, certain parameters must be modified to disable the image-flipping function. By default, YOLO applies image mirroring during training; however, flipping the \(cre\) and \(dec\) symbols would entirely alter their meanings.  
Compared to other models, YOLOv8 achieves faster convergence during training while maintaining high accuracy in various object detection tasks. As a result, utilizing the YOLOv8 model not only enhances performance but also provides greater flexibility for future research developments.  
This paper [15] mentions that in image segmentation tasks, YOLOv8 outperforms Mask R-CNN in terms of both accuracy (Precision and Recall) and inference time. Therefore, we consider YOLOv8 to be a more scalable and adaptable choice. According to the YOLO documentation (available at [[https://docs.ultralytics.com/zh/models/yolov8/#supported-tasks-and-modes](https://docs.ultralytics.com/zh/models/yolov8/#supported-tasks-and-modes)]([https://docs.ultralytics.com/zh/models/yolov8/#supported-tasks-and-modes](https://docs.ultralytics.com/zh/models/yolov8/#supported-tasks-and-modes)), accessed on 17 July 2024), a performance comparison of different YOLO model versions is provided. The results indicate that YOLOv8 exhibits significantly higher accuracy and lower latency compared to other models, including YOLOv7, YOLOv6-2.0, and YOLOv5-7.0.  
In this study, most parameters of YOLOv8 remained unchanged, except for two key modifications:  
1. Dropout: This parameter was set to 0.2 (default: 0), meaning that in each neural network layer, there is a 20% probability of randomly deactivating neurons, which helps reduce overfitting.
2. flipud, fliplr: These parameters control the probability of YOLOv8 flipping images either upside down (flipud) or left-right (fliplr) during training. Since sheet music images contain sequential information, flipping them would disrupt the reading order, leading to a complete alteration of musical content. To preserve the integrity of the data, both parameters were set to 0.0.  
After YOLOv8 detects the positions and ranges of the dynamics symbols, they are removed from the sheet music images. This is accomplished using the Python PIL package (accessible at [[https://pypi.org/project/pillow/](https://pypi.org/project/pillow/)]([https://pypi.org/project/pillow/](https://pypi.org/project/pillow/)), accessed on 17 July 2024) by replacing all pixels within the bounding box regions with white.  
Figure 4: Examples of \(crescendo\) and \(decrescendo\) symbols are presented as follows: (**Top left**) Crescendo symbol. (**Top right**) Decrescendo symbol. (**Bottom left**) Crescendo symbol represented in textual form. (**Bottom right**) Decrescendo symbol represented in textual form.