Downloads · 30 days
0
Nerdy37/baby-cry-analyzer
baby-cry-analyzer is a audio classification model from Nerdy37. Use it for the audio classification task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
license: mit language: - en pipelinetag: audio-classification libraryname: sklearn tags: - audio - baby-cry - sound-classification - sklearn - stacking-ensemble - mfcc datasets: - mennaahmed23/baby-cry metrics: - accu…
Downloads · 30 days
0
Access
Public
Updated Jun 8, 2026
Repo size
109 MB
Likes
1
Public
Click a slice to open those files.
.pkl109 MB · 100%
From the Hugging Face model README
license: mit language:
A machine learning model that classifies baby crying sounds into 11 categories to help parents understand what their baby needs.
| Metric | Score |
|---|---|
| Accuracy | 86.38% |
| F1 Score | 85.43% |
| Precision | 86.07% |
| ROC AUC | 0.9864 |
| Label | Emoji | Meaning |
|---|---|---|
| belly pain | 🤢 | Baby has stomach pain |
| burping | 💨 | Baby needs to burp |
| cold_hot | 🌡️ | Baby is too cold or hot |
| discomfort | 😣 | Baby is uncomfortable |
| hungry | 🍼 | Baby is hungry |
| laugh | 😄 | Baby is happy/laughing |
| lonely | 🥺 | Baby wants attention |
| noise | 🔊 | Background noise detected |
| scared | 😨 | Baby is startled/scared |
| silence | 🤫 | No crying detected |
| tired | 😴 | Baby is sleepy |
import joblib
import librosa
import numpy as np
from huggingface_hub import hf_hub_download
model = joblib.load(hf_hub_download("Nerdy37/baby-cry-analyzer", "best_model.pkl"))
scaler = joblib.load(hf_hub_download("Nerdy37/baby-cry-analyzer", "scaler.pkl"))
label_names = [
'belly pain', 'burping', 'cold_hot', 'discomfort',
'hungry', 'laugh', 'lonely', 'noise', 'scared', 'silence', 'tired'
]
def predict(audio_path):
audio, sr = librosa.load(audio_path, sr=22050, duration=5, mono=True)
mfcc = np.mean(librosa.feature.mfcc(y=audio, sr=sr, n_mfcc=40).T, axis=0)
chroma = np.mean(librosa.feature.chroma_stft(y=audio, sr=sr).T, axis=0)
mel = np.mean(librosa.feature.melspectrogram(y=audio, sr=sr).T, axis=0)
features = scaler.transform([np.hstack([mfcc, chroma, mel])])
pred = model.predict(features)[0]
prob = model.predict_proba(features)[0]
return label_names[pred], f"{max(prob)*100:.1f}%"
label, confidence = predict("baby_cry.wav")
print(f"Prediction: {label} ({confidence})")
hungry class has lower accuracy (28.7%) due to acoustic similarity
with discomfort, burping, and cold_hotMade by Nerdy37 as part of an end-to-end ML pipeline project.