# Music Similarity Detection Through Comparative Imagery Data
## 4 Experimental Results: Model Training, Validation, and Testing
### Testing with AI-Generated Music  
The increasing prevalence of generative AI models has raised concerns over copyright infringement. In this work, we used Google Magenta 2.1.2 [24] to create a music dataset for testing our trained models, and in particular, the ensemble model. Google Magenta has two generative AI models, MusicVAE and Music Transformer. At the moment, it is the only generative music tool whose source code, specifically the Transformer model, is available in the public domain. Both models were trained using a classical music dataset called Maestro, which contains virtuosic piano performances of piano pieces by famous composers throughout history. This dataset was created by [PERSON] et al. [25]. [PERSON] et al. [26; 27; 28] discussed the originality of the music generated by their model trained using the source code of Google Magenta and the Maestro dataset (1275 music pieces, around 200 h) [25]. They found some cases of chunks of music being copied from the training data in the generated music. The dataset by [PERSON] et al. is referred to as the CPI dataset and can be found at their website [29]. We trained two generative AI models, VAE and Transformer, using the source code of Google Magenta, the CPI dataset by [PERSON] et al. [25], and the same hyperparameters  
Figure 13: The ensemble output can be validated and explained using the individual feature maps of the songs “Under Pressure” and “Ice Ice Baby”. (**a**) Unprocessed ensemble output. (**b**) Ensemble similarity mask. (**c**) Melodic interval histogram. (**d**) Folded fifths pitch class histogram. (**e**) Vertical interval histogram. (**f**) Distance between two most common vertical intervals heatmap. used by [PERSON] et al. [26; 27; 28] in training their model. We applied our similarity detection model to a number of excerpts generated by the VAE and Transformer models. These excerpts are labeled as V-CPI-# or T-CPI-#, indicating the generative AI model (V for VAE or T for Transformer) trained by us and the training dataset CPI by [PERSON] et al. [26; 27; 28] Figure 14 shows eight examples of music pieces generated using the Transformer and VAE with four examples from each, which were tested against all 1275 music pieces in the CPI dataset. We can observe bright patterns in these heatmaps, indicating the possible similarity regions. The heatmaps enable humans to focus on these regions without much effort, demonstrating the informativeness and the effectiveness of data visualization in aiding humans in their processes of evaluating, scrutinizing, and interpreting model outputs. Let us examine one particular case closely. Figure 15 shows two testing results after comparing an AI-generated music piece using the Transformer model. Our similarity detection model found a few pieces in the training data, i.e., the CPI dataset. Two of these pieces, both by [PERSON], were examined closely. When comparing with T-CPI-1 with the 1275 pieces in the CPI dataset, the ensemble model scored both pieces with the highest similarity score of 0.92, which correspond to the brightest regions in the heatmaps as shown in Figure 15a,b. The repeating bright regions have almost identical musical properties and are repeated in [PERSON]'s pieces. An interesting finding is that the highlighted regions correspond to approximately the same part of the AI-generated piece. This may be partly because T-CPI-1 is a relatively short piece and does not contain many repeated musical  
Figure 14: Applying the trained ensemble model (with four sub-models) to compare eight AI-generated music pieces with 1275 pieces of music in the CPI database. For each reference piece (vertical), the heatmap has a top-matched piece (horizontal) in the CPI database. (**a**) V-CPI-2 vs. Prelude and Nocturre for Left Hand, Op. 9 by [PERSON]. (**b**) V-CPI-3 vs. Fantasies, Op. 116 No. 7 by [PERSON]. (**c**) V-CPI-9 vs. Scherzo No. 2 in B-flat Major, Op. 31 by [PERSON]. (**d**) V-CPI-13 vs. Sonetto 123 del Petracrax by [PERSON]. (**e**) T-CPI-2 vs. Variations and Fugue in E-flat Major, Op.