Downloads · 30 days
224
30% of all-time downloads
lofcz/ai-music-detector
ai-music-detector is a audio classification model from lofcz. Use it for the audio classification task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Detects music generated by Suno <= 5 and Udio <= 1.5 using spectral fakeprint analysis.
Downloads · 30 days
224
30% of all-time downloads
All-time downloads
749
Public
Parameters
3.6K
44.4 KB on disk
Likes
1
Public
Click a slice to open those files.
.npz15.1 KB · 31%
From the Hugging Face model README
Detects music generated by Suno <= 5 and Udio <= 1.5 using spectral fakeprint analysis.
This model analyzes the frequency spectrum of audio to detect characteristic artifacts left by neural vocoders in AI music generators. These "fakeprints" are regularly-spaced peaks in the spectrum caused by transposed convolution (deconvolution) layers.
Audio must be preprocessed to extract fakeprints:
| Parameter | Value |
|---|---|
| Sample Rate | 16000 Hz |
| FFT Size | 8192 |
| Frequency Range | 1000-8000 Hz |
| Hull Area | 10 bins |
Evaluated on a held-out test set of 17,866 samples (5,741 real, 12,125 AI-generated).
| Metric | Value |
|---|---|
| Accuracy | 99.88% |
| Precision | 0.9985 |
| Recall | 0.9998 |
| F1 Score | 0.9991 |
| False Positive Rate | 0.31% |
| False Negative Rate | 0.02% |
import numpy as np
import onnxruntime as ort
# Load model
session = ort.InferenceSession("ai_music_detector.onnx")
# fakeprint = extract_fakeprint(audio_file) # Your preprocessing
output = session.run(None, {"fakeprint": fakeprint.reshape(1, -1)})
ai_probability = output[0][0, 0]
print(f"AI Probability: {ai_probability:.1%}")
from safetensors.numpy import load_file
import numpy as np
weights = load_file("model.safetensors")
w = weights["weights"] # Shape: (1, 3585)
b = weights["bias"] # Shape: (1,)
# fakeprint = extract_fakeprint(audio_file)
logit = np.dot(fakeprint, w.T) + b
probability = 1 / (1 + np.exp(-logit))
This implementation is based on the fakeprint detection method proposed by Afchar et al. [1], which demonstrates that neural vocoders in generative music models produce characteristic frequency-domain artifacts due to their deconvolution architecture.
[1] D. Afchar, G. Meseguer-Brocal, K. Akesbi, and R. Hennequin, "A Fourier Explanation of AI-music Artifacts," in Proc. International Society for Music Information Retrieval Conference (ISMIR), 2025. Available: https://arxiv.org/abs/2506.19108
MIT License