Update README.md
Browse files
README.md
CHANGED
|
@@ -4,4 +4,63 @@ datasets:
|
|
| 4 |
- amaai-lab/melodySim
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
- amaai-lab/melodySim
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# MelodySim: Measuring Melody-aware Music Similarity for Plagiarism Detection
|
| 8 |
+
|
| 9 |
+
[Github](https://github.com/AMAAI-Lab/MelodySim) | [Paper](https://arxiv.org/abs/2505.20979) | [Dataset](https://huggingface.co/datasets/amaai-lab/melodySim)
|
| 10 |
+
|
| 11 |
+
This is a checkpoint for [MelodySim](https://github.com/AMAAI-Lab/MelodySim), a MERT-based music audio similarity model which can be used for plagiarism detection. This checkpoint contains pre-trained weights of ```m-a-p/MERT-v1-95M```.
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
1. Clone the MelodySim github repo
|
| 16 |
+
```bash
|
| 17 |
+
git clone https://github.com/AMAAI-Lab/MelodySim.git
|
| 18 |
+
cd MelodySim
|
| 19 |
+
pip install -r requirements.txt
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
2. Download model checkpoint
|
| 23 |
+
```python
|
| 24 |
+
from huggingface_hub import hf_hub_download
|
| 25 |
+
|
| 26 |
+
repo_id = "amaai-lab/MelodySim"
|
| 27 |
+
model_path = hf_hub_download(repo_id=repo_id, filename="siamese_net_20250328.ckpt")
|
| 28 |
+
```
|
| 29 |
+
or using wget in linux ```wget https://huggingface.co/amaai-lab/MelodySim/resolve/main/siamese_net_20250328.ckpt```
|
| 30 |
+
|
| 31 |
+
3. Run inference
|
| 32 |
+
Try out ```inference.py``` to run the model on two audio files, analyzing their similarity and reaching a decesion on whether or not they are the same song. We provide a positive pair and a negative pair as examples. Try out
|
| 33 |
+
```
|
| 34 |
+
python inference.py -audio-path1 ./data/example_wavs/Track01968_original.mp3 -audio-path2 ./data/example_wavs/Track01976_original.mp3 -ckpt-path path/to/checkpoint.ckpt
|
| 35 |
+
python inference.py -audio-path1 ./data/example_wavs/Track01976_original.mp3 -audio-path2 ./data/example_wavs/Track01976_version1.mp3 -ckpt-path path/to/checkpoint.ckpt
|
| 36 |
+
```
|
| 37 |
+
Feel free to play around the hyperparameters
|
| 38 |
+
- ```-window-len-sec```, ```-hop-len-sec``` (the way segmenting the input audios);
|
| 39 |
+
- ```--proportion-thres``` (how many similar segments should we consider the two pieces to be the same);
|
| 40 |
+
- ```--decision-thres``` (between 0 and 1, the smallest similarity value that we consider to be the same);
|
| 41 |
+
- ```--min-hits``` (for each window in piece1, the minimum number of similar windows in piece2 to assign that window to be plagiarized).
|
| 42 |
+
|
| 43 |
+
4. Training and testing details are summarized in [MelodySim Github](https://github.com/AMAAI-Lab/MelodySim). You may need the [MelodySim](https://huggingface.co/datasets/amaai-lab/melodySim) dataset, containing 1,710 valid synthesized pieces originated from Slakh2100 dataset, each having 4 different versions (through various augmentation settings), with a total duration of 419 hours.
|
| 44 |
+
|
| 45 |
+
The testing results for the checkpoint on MelodySim Dataset testing split are as follows:
|
| 46 |
+
|
| 47 |
+
| |**Precision**| **Recall** | **F1** |
|
| 48 |
+
|-----------|-------------|------------|------------|
|
| 49 |
+
| Different | 1.00 | 0.94 | 0.97 |
|
| 50 |
+
| Similar | 0.94 | 1.00 | 0.97 |
|
| 51 |
+
| Average | 0.97 | 0.97 | 0.97 |
|
| 52 |
+
| Accuracy | | | 0.97 |
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
## Citation
|
| 56 |
+
|
| 57 |
+
If you find this work useful in your research, please cite:
|
| 58 |
+
|
| 59 |
+
```bibtex
|
| 60 |
+
@article{lu2025melodysim,
|
| 61 |
+
title={Text2midi-InferAlign: Improving Symbolic Music Generation with Inference-Time Alignment},
|
| 62 |
+
author={Tongyu Lu and Charlotta-Marlena Geist and Jan Melechovsky and Abhinaba Roy and Dorien Herremans},
|
| 63 |
+
year={2025},
|
| 64 |
+
journal={arXiv:2505.20979}
|
| 65 |
+
}
|
| 66 |
+
```
|