This repository provides an implementation of the Adaptive Centroid Shift Loss (AOCloss) method for Audio Deepfake Detection, as described in the corresponding research paper. The approach employs a one-class learning framework that continuously adapts a centroid to represent bonafide audio embeddings while maximizing the distance of spoof embeddings.
from AOC_loss import AOCloss
# Initialize with desired embedding dimension
criterion = AOCloss(embedding_dim=512)loss = criterion(embeddings, labels)embeddings: Tensor of shape(batch_size, embedding_dim).labels: Binary tensor where0represents bonafide samples and1represents spoof samples.
The centroid is automatically updated during the forward pass.
criterion.update_centroid(bonafide_embeddings)- PyTorch >= 1.10
- Python >= 3.8
-
ValueError: Centroid has not been initialized:- Ensure the batch contains bonafide samples.
-
Negative Loss:
- This is expected due to the range of cosine similarity between
-1and1.
- This is expected due to the range of cosine similarity between
If you use this repository in your work, please cite it as follows:
@misc{Weizman2025_OneClassACS_GitHub,
author = {Weizman, Avishai},
title = {One-Class Learning with Adaptive Centroid Shift for Audio Deepfake Detection — Implementation (GitHub)},
howpublished = {GitHub repository},
year = {2025},
url = {https://github.com/avishai111/One-Class-Learning-with-Adaptive-Centroid-Shift-for-Audio-Deepfake-Detection},
note = {Related to the paper “One-Class Learning with Adaptive Centroid Shift for Audio Deepfake Detection” by Kim, Jang, and Kim, Interspeech 2024.}
}
This github implementation based on the following paper:
@inproceedings{kim24b_interspeech,
title = {One-class learning with adaptive centroid shift for audio deepfake detection},
author = {Hyun Myung Kim and Kangwook Jang and Hoirin Kim},
year = {2024},
booktitle = {Interspeech 2024},
pages = {4853--4857},
doi = {10.21437/Interspeech.2024-177},
issn = {2958-1796},
}
For issues or questions, feel free to open an issue in the repository.
- This implementation is inspired by research paper.
If you have questions, feedback, or want to collaborate, feel free to reach out:
📧 Email: Avishai Weizman
🔗 GitHub: github.com/avishai111
🎓 Google Scholar: Avishai Weizman
💼 LinkedIn: linkedin.com/in/avishai-weizman/