Instructions to use DaveLoay/bamm-cnn-detectors with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use DaveLoay/bamm-cnn-detectors with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://DaveLoay/bamm-cnn-detectors") - Notebooks
- Google Colab
- Kaggle
BAMM CNN detectors: CNN Clean and CNN Broadcast
Two binary classifiers that estimate whether a piece of music is AI-generated (Suno v3.5) or human-made. They are the baselines of the ISMIR 2026 paper Assessing AI-generated music detection in real-world broadcast monitoring (arXiv:2608.07359), which introduces the BAMM dataset of real TV broadcast clips.
Code (training, evaluation, inference): https://github.com/DaveLoay/BAMM-dataset
| Folder | Model | Trained on |
|---|---|---|
cnn_clean/ |
CNN Clean | Clean foreground music: FMA-medium (human) vs SONICS Suno v3.5 (AI) |
cnn_broadcast/ |
CNN Broadcast | The same music, 70% of each class mixed with LibriSpeech speech at a random SNR in [β30, +30] dB, 30% left clean, all re-encoded as 8 kHz / 40 kbps MP3 |
Each folder holds:
| File | Content |
|---|---|
model.h5 |
Keras model, legacy HDF5 format, no optimizer state (6.6 MB, 1.64 M parameters) |
config_snapshot.yaml |
The full training configuration, including the feature parameters inference must use |
training_history.json |
Per-epoch loss, accuracy and ROC-AUC |
model_summary.txt |
Layer-by-layer summary |
Usage
With the GitHub repository:
git clone https://github.com/DaveLoay/BAMM-dataset.git && cd BAMM-dataset
pip install -e .
python scripts/download_weights.py
python -m pipelines.predict --model-path weights/cnn_broadcast/model.h5 --input clip.mp4
Or with the single-file inference.py from this repository:
pip install "tensorflow>=2.11,<2.16" "librosa>=0.10" "numpy<2" pyyaml huggingface_hub
python inference.py --model cnn_broadcast song.mp3 clip.mp4
Both need ffmpeg on the PATH. Any format FFmpeg can decode works, including MP4 video.
The output is P(AI), the mean of the model's scores over non-overlapping 5 s windows. The paper
classifies a clip as AI-generated when P(AI) >= 0.5.
Input and preprocessing
The models expect exactly this pipeline (implemented in both options above):
- FFmpeg transcode to mono MP3, 8 kHz, 40 kbps
- Power mel spectrogram: STFT 2048, hop 1024, window 2048, 128 bands from 20 Hz to 4 kHz
librosa.power_to_db(S, ref=np.max), then(S + 4.0) / 3.0- Non-overlapping 5 s windows of 38 frames, input shape
(38, 128, 1); clips shorter than 5 s are zero-padded
Architecture
Six blocks of 3Γ3 Conv2D (16, 32, 64, 128, 256, 512 filters, ReLU), each followed by 2Γ2 max pooling and batch normalisation; global average pooling; dropout 0.2; dense 128 (swish); dropout 0.2; one sigmoid unit. The design follows Afchar et al., AI-generated music detection and its challenges.
Training
Adam (learning rate 1e-3, halved on plateau), batch size 50, binary cross-entropy, up to 100 epochs with early stopping on validation loss (patience 15). Each epoch draws random 5 s crops from every track: 5 per track for CNN Clean, 3 for CNN Broadcast. The stratified 70/20/10 split uses seed 123. The saved checkpoint is the one with the best validation ROC-AUC.
Evaluation
Results from scripts/reproduce_paper.py in the GitHub repository (F1 at threshold 0.5,
ROC-AUC):
| Scenario | Unit | n | CNN Clean F1 | CNN Clean ROC | CNN Broadcast F1 | CNN Broadcast ROC |
|---|---|---|---|---|---|---|
| CFM | clip | 952 | 0.992 | 0.998 | 0.992 | 0.996 |
| STB | clip | 3,294 | 0.342 | 0.910 | 0.661 | 0.926 |
| RTB | clip | 5,498 | 0.186 | 0.761 | 0.472 | 0.796 |
| RTB | DMD segment, all | 8,653 | 0.172 | 0.707 | 0.422 | 0.775 |
| RTB | DMD segment, foreground | 3,359 | 0.317 | 0.782 | 0.519 | 0.858 |
| RTB | DMD segment, background | 5,225 | 0.039 | 0.667 | 0.338 | 0.745 |
- CFM, Clean Foreground Music: the 476 human / 476 AI clean reference tracks AI-OpenBMAT was built from (not publicly available)
- STB, Synthetic TV Broadcast: the 3,294 AI-OpenBMAT mixtures
- RTB, Real TV Broadcast: BAMM, by clip and by Deep Music Detector segment
The paper's Table 1 uses the clip-level F1 and the all-segments ROC-AUC for RTB. The foreground and background rows match its Figure 3.
Limitations
- The AI class is Suno v3.5 only. Other generators and later Suno versions were not part of training.
- On real broadcast audio both models degrade a lot, mostly by missing AI music (false negatives), and more so when the music is in the background. The paper's conclusion is that these detectors are not reliable enough for broadcast monitoring on their own.
- The models only see content below 4 kHz, at 8 kHz / 40 kbps.
- Do not use a single score to make decisions about a person or a work. Treat the output as one signal among others.
License
The weights are released under CC BY-NC 4.0 (attribution, non-commercial). They were trained on FMA-medium, SONICS and LibriSpeech; check those datasets' terms for your use. The code in the GitHub repository is MIT-licensed.
Citation
@inproceedings{lopezayala2026bamm,
title = {Assessing {AI}-generated music detection in real-world broadcast monitoring},
author = {L{\'o}pez-Ayala, David and Garcia de la Cruz, Fernando and Zinemanas, Pablo
and Molina, Emilio and Rocamora, Mart{\'i}n},
booktitle = {Proc. of the 27th Int. Society for Music Information Retrieval Conf. (ISMIR)},
address = {Abu Dhabi, UAE},
year = {2026}
}
- Downloads last month
- -