Voice Classifier: Human vs AI Speech

Model Description

This model is a Wav2Vec2-based audio classification model designed to classify speech audio as either human-generated or AI-generated.

The model uses the Wav2Vec2ForSequenceClassification architecture from the Hugging Face Transformers library and is intended for binary audio classification tasks involving spoken voice samples.

Note: This model card should be updated with training data, evaluation metrics, and known limitations before using the model in production or high-stakes environments.

Model Details

  • Developed by: Harshit Chauhan
  • Model type: Audio classification
  • Architecture: Wav2Vec2 for sequence classification
  • Language: English
  • Input: Speech audio waveform
  • Output: Predicted class label
  • Framework: PyTorch / Transformers
  • Base model: facebook/wav2vec2-base
  • Repository: IronandIrish/voice-classifier-human-ai

Intended Use

Direct Use

This model can be used to classify an input speech audio file as one of the supported classes, such as:

  • Human speech
  • AI-generated speech

Example use cases:

  • Voice authenticity analysis
  • AI voice detection experiments
  • Audio classification research
  • Internal evaluation pipelines for voice-agent systems

Out-of-Scope Use

This model should not be used as the only decision-making system for:

  • Fraud detection
  • Legal evidence
  • Identity verification
  • Any high-stakes or safety-critical decision

The model output should be treated as a probabilistic signal, not as absolute proof.

Limitations

This model may produce incorrect predictions in cases such as:

  • Very short audio clips
  • Background music or overlapping speakers
  • Accented speech not represented in training data
  • AI voices from models not seen during training
  • Human voices processed with filters, compression, or voice changers

The model may also generalize poorly if the training dataset was small or not diverse.

Bias, Risks, and Ethical Considerations

AI-generated voice detection is a difficult and evolving problem. Newer synthetic speech systems may be harder to detect than older systems.

Potential risks include:

  • False positives: human speech classified as AI-generated
  • False negatives: AI-generated speech classified as human
  • Unequal performance across accents, genders, age groups, microphones, or recording conditions
  • Misuse for surveillance or unfair authenticity judgments

Users should validate the model on their own target data before deployment.

Training Details

Training Data

Add details here:

  • Dataset name:
  • Dataset source:
  • Number of samples:
  • Audio duration:
  • Human speech sources:
  • AI speech sources:
  • Sampling rate:
  • Train/validation/test split:

The model was trained on a custom dataset containing human and AI-generated English speech samples. Audio files were resampled to 16 kHz before training.

Evaluation

The model was evaluated on a test set of 2,000 audio samples containing both human and machine-generated speech.

Classification Report

Class Precision Recall F1-score Support
Human 0.98 0.87 0.92 1007
Machine 0.88 0.98 0.93 993
Accuracy 0.93 2000
Macro Avg 0.93 0.93 0.93 2000
Weighted Avg 0.93 0.93 0.93 2000

Confusion Matrix

Actual \ Predicted Human Machine
Human 876 131
Machine 16 977

Interpretation

The model performs strongly overall with approximately 93% accuracy.

The model has high recall for the machine class, meaning it correctly identifies most machine-generated audio samples. However, the human recall is lower, meaning some human audio samples are incorrectly classified as machine-generated. This model should therefore be used as a classification signal, not as final proof that an audio sample is human or machine-generated.

1. Install Dependencies

Install the required Python packages:

pip install torch transformers librosa

2. Load Model

from transformers import Wav2Vec2ForSequenceClassification, AutoFeatureExtractor

model_id = "IronandIrish/voice-classifier-human-ai"

model = Wav2Vec2ForSequenceClassification.from_pretrained(model_id)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_id)

3. Run Prediction

import torch
import librosa
from transformers import Wav2Vec2ForSequenceClassification, AutoFeatureExtractor

model_id = "IronandIrish/voice-classifier-human-ai"

model = Wav2Vec2ForSequenceClassification.from_pretrained(model_id)
feature_extractor = AutoFeatureExtractor.from_pretrained(model_id)

audio_file = "path/to/audio.wav"

waveform, sr = librosa.load(audio_file, sr=16000)

inputs = feature_extractor(
    waveform,
    sampling_rate=16000,
    return_tensors="pt",
    padding=True
)

with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits
    predicted_class_id = torch.argmax(logits, dim=-1).item()

label = model.config.id2label[predicted_class_id]

print("Predicted label:", label)

4.Get Prediction

import torch

probs = torch.nn.functional.softmax(logits, dim=-1)[0]

for class_id, score in enumerate(probs):
    label = model.config.id2label[class_id]
    print(f"{label}: {score:.4f}")
Downloads last month
15
Safetensors
Model size
94.6M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for IronandIrish/voice-classifier-human-ai

Finetuned
(995)
this model