Downloads · 30 days
0
IceKhoffi/chicken-vocalization-classifier
chicken-vocalization-classifier is a machine learning model from IceKhoffi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is designed for classifying chicken vocalizations into categories indicative of health status or environmental noise. It serves as a crucial audio-based component within the "Chicken Health & Behavior Detec…
Downloads · 30 days
0
Access
Public
Updated Jul 9, 2025
Repo size
26.6 MB
Likes
1
Public
Click a slice to open those files.
.pth26.1 MB · 98%
From the Hugging Face model README
Chicken Vocalization ClassifierThis model is designed for classifying chicken vocalizations into categories indicative of health status or environmental noise. It serves as a crucial audio-based component within the "Chicken Health & Behavior Detection" multimodal project, aiming to aid in the early detection of poultry diseases and the monitoring of farm conditions.
The chicken-vocalization-classifier is a Convolutional Neural Network (CNN) built with PyTorch, designed to process Log-Mel Spectrogram representations of audio recordings. It categorizes chicken sounds into three classes: Healthy, Noise, and Unhealthy. This model can help identify abnormal vocalizations (e.g., coughing, distress calls) that might signal health issues, or distinguish between relevant chicken sounds and general farm noise.
This model was trained using the "Poultry Vocalization Signal Dataset for Early Disease Detection".
The model was implemented and trained using the PyTorch framework
Model Architecture: The model, named ModdifiedModel, consists of a features extractor and a classifier head.
Conv2d layer, BatchNorm2d, ReLU activation, and MaxPool2d.
Conv2d(1, 32, kernel_size=3), BatchNorm2d(32), ReLU(), MaxPool2d(2)Conv2d(32, 64, kernel_size=3), BatchNorm2d(64), ReLU(), MaxPool2d(2)Conv2d(64, 128, kernel_size=3), BatchNorm2d(128), ReLU(), MaxPool2d(2)Flatten layer, two Linear layers, Dropout, and ReLU activation.
Linear(in_features=25088, out_features=256)Dropout(0.5)ReLU()Linear(in_features=256, out_features=3) (for 3 classes)Preprocessing: Audio files are converted to Log-Mel Spectrograms using librosa.
SAMPLE_RATE = 22050 HzWAV_SIZE = int(1.5 * SAMPLE_RATE))MEL_BANDS = 128N_FFT = 2648HOP_LENGTH = 256Data Splitting: The dataset was split into training and testing sets using train_test_split with test_size=0.2 and random_state=27
Loss Function: nn.CrossEntropyLoss()
Optimizer: torch.optim.Adam with a learning rate (lr) of 0.001
Epochs: The model was trained for 30 epochs
Batch Size: Training was performed with a batch_size of 32
The Modified model was evaluated on a test set.


You can load this trained model's weights with PyTorch. For full usage examples, including audio preprocessing steps and inference, please refer to the CHBD_Vocalization_Analysis.ipynb notebook provided in this repository.
from huggingface_hub import hf_hub_download
import torch
import torch.nn as nn
import os
# Define the ModdifiedModel class
# (You will need to copy this class definition from the CHBD_Vocalization_Analysis.ipynb file)
class ModdifiedModel(nn.Module):
def __init__(self, num_classes=3):
super(ModdifiedModel, self).__init__()
# ... (copy the full model architecture definition here) ...
def forward(self, x):
# ... (copy the forward pass definition here) ...
# Instantiate the model
model = ModdifiedModel(num_classes=3)
# Define each Hugging Face details
repo_id = "IceKhoffi/chicken-vocalization-classifier"
filename = "Chiken_CNN_Disease_Detection_Model.pth"
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
state_dict = torch.load(model_path, map_location='cpu')
model.load_state_dict(state_dict)
# Set model to evaluation mode
model.eval()
# The model is now loaded and ready for inference.
# Refer to the provided .ipynb for detailed preprocessing and inference examples.