Avian cough acoustic intelligent detection method and system based on convolutional audio spectrogram transformer and medium

By combining the Convolutional Audio Spectrograph Transformer (CAST) with lightweight CNN and ASTTransformer models, the problem of distinguishing cough sounds from background noise in poultry farming environments has been solved, achieving high-precision, low-complexity cough sound detection and supporting all-weather automated early warning.

CN122157704APending Publication Date: 2026-06-05SHANGHAI XIA SHU NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI XIA SHU NETWORK TECH CO LTD
Filing Date
2026-03-25
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively distinguish coughing sounds from background noise in poultry farming environments, resulting in low recognition accuracy, poor anti-interference capabilities, and model bias due to imbalanced training data categories, making it difficult to achieve all-weather, automated, and precise disease early warning.

Method used

A Convolutional Audio Spectrum Transformer (CAST) is employed to enhance the high-frequency transient features of cough sounds through pre-emphasis processing, while adaptive spectral denoising preserves the target signal. Combined with a lightweight CNN network and an ASTTransformer model, local time-frequency pattern extraction and global time-frequency dependency modeling are achieved, thereby improving detection robustness.

Benefits of technology

It significantly improves the accuracy and robustness of cough sound detection in complex noisy environments, reduces false positive and false negative rates, and enables accurate extraction of target features from complex scenes, thereby enhancing the model's discriminative and generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157704A_ABST
    Figure CN122157704A_ABST
Patent Text Reader

Abstract

The application provides an intelligent detection method and system for poultry cough sound based on a convolutional audio spectrogram transformer and a medium. The method comprises: continuously collecting original audio streams in a poultry breeding environment based on a microphone array, preprocessing the original audio streams to obtain standardized mel-frequency spectrograms; inputting the standardized mel-frequency spectrograms into a CAST model to output a cough sound confidence score; comparing the confidence score with a preset threshold to determine whether a cough event exists; if so, recording the event and a timestamp and counting the frequency of cough events within a preset time window; if the frequency of cough events exceeds a safety threshold, triggering an early warning and outputting early warning information, and updating a health status panel in real time; and through the global self-attention mechanism of the CAST, the complete time-frequency context of the sound can be modeled, the cough sound can be effectively distinguished from background noise with similar morphology, the target features can be accurately extracted in a complex scene, and the discrimination and generalization of the model are fundamentally improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of acoustic detection technology, and more specifically, to an intelligent acoustic detection method, system, and medium for poultry cough based on a convolutional audio spectrogram converter. Background Technology

[0002] In modern, intensive poultry farming, flock health is central to ensuring economic benefits. Respiratory diseases (such as infectious bronchitis and Newcastle disease) are characterized by high infectivity and mortality, and one of their early typical symptoms is abnormal coughing in poultry. Therefore, early and accurate monitoring of coughing is crucial for disease early warning and preventing the spread of epidemics. Traditional health monitoring relies entirely on manual inspections by poultry workers at regular intervals. This method is not only labor-intensive but also suffers from problems such as intermittent monitoring, subjective judgment, susceptibility to human experience, and potential disturbance to the flock, making it difficult to meet the demands of modern, intelligent, 24 / 7 farming that requires automation and precision.

[0003] The disadvantages of existing technology are as follows: 1) Low recognition accuracy and poor anti-interference ability: Existing methods struggle to effectively distinguish coughing sounds from background noise in complex, non-stationary noise environments in chicken houses, leading to high false alarm or false negative rates.

[0004] The corresponding solution of this invention is a data and model co-optimization approach. At the data level, pre-emphasis processing enhances the high-frequency transient features of cough sounds, and adaptive spectral denoising is performed based on pure noise segments, suppressing persistent background interference while preserving key components of the target signal. At the model level, a convolution-enhanced audio spectrogram transformer is innovatively constructed. Its front-end lightweight CNN network efficiently extracts local time-frequency patterns from the spectrogram, while the back-end ASTTransformer encoder models long-range time-frequency dependencies through a global self-attention mechanism. This design achieves a deep fusion of local feature perception and global context understanding, enabling the model to accurately identify the unique cross-domain time-frequency distribution pattern of cough sounds, thereby significantly improving detection robustness in noisy environments and effectively reducing false positives and false negatives.

[0005] 2) Lack of effective mechanisms to handle the problem of extreme imbalance in training data categories: In the audio collected from the breeding farm, the number of cough sounds (positive samples) is far less or far more than the number of normal environmental sounds (negative samples). The training of existing models is prone to bias due to sample imbalance, tending to predict all samples as the majority class and losing actual detection ability. Summary of the Invention

[0006] The purpose of this application is to provide an acoustic intelligent detection method, system and medium for avian cough based on a convolutional audio spectrogram transformer. By using the global self-attention mechanism of CAST, the complete time-frequency context of the sound can be modeled, thereby effectively distinguishing the cough sound from background noise with similar shape. This achieves accurate extraction of target features from complex scenes, fundamentally improving the model's discriminative power and generalization ability.

[0007] This application also provides an intelligent acoustic detection method for avian cough based on a convolutional audio spectrogram transformer, including: Based on the continuous acquisition of raw audio streams from the poultry farming environment using a microphone array, the raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output. The confidence score is compared with a preset threshold to determine whether a cough event has occurred. If it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

[0008] Optionally, in the poultry cough acoustic intelligent detection method based on convolutional audio spectrogram transformer described in this application embodiment, the continuous acquisition of raw audio streams from the poultry farming environment based on a microphone array specifically includes: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

[0009] Optionally, in the intelligent acoustic detection method for avian cough based on a convolutional audio spectrogram transformer described in this application embodiment, the original audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Collect pure noise segments when there are no coughing events in the poultry house, and perform noise spectrum estimation based on the pure noise segments to obtain the noise power spectral density; Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

[0010] Optionally, in the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer described in this application embodiment, the standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output, specifically including: The standardized Mel spectrogram is input into the CAST model, and based on four layers of convolutional units, two-dimensional convolution, batch normalization, ReLU activation and downsampling pooling are performed sequentially to obtain the feature sequence. Based on the positional encoding unit, temporal information is injected into the high-level feature sequence. The positional encoding adopts sine and cosine positional encoding to ensure that the model captures the temporal correlation of the feature sequence. The feature sequence after injecting time-series information is input into the Transformer encoder. The global dependency of each time step in the feature sequence is calculated through the multi-head self-attention mechanism, the frequency domain context information is modeled, and the global context features are output. The global context features are input into a lightweight classification head, and the features are aggregated through average pooling. The fully connected layer maps the aggregated features into a one-dimensional vector. The one-dimensional vector is transformed using the Sigmoid activation function, and the output cough confidence score is in the range [0,1]. Optionally, in the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer described in this application embodiment, if coughing occurs, the event and timestamp are recorded, and the frequency of coughing events within a preset time window is statistically analyzed, specifically including: When the confidence score of the cough sound is greater than the preset threshold, it is determined that there is a cough event in the current audio segment, the system time corresponding to the current cough event is obtained, and a timestamp is generated. Establish a cough event log database, store the identified cough events along with their corresponding timestamps and audio segments in the log database, and mark the collection location of the audio segments; Set the start and end times of a preset time window, traverse the cough event log database in a sliding window mode, and extract all associated stored cough event records within the time window; Based on the deduplication algorithm, duplicate records caused by audio frame overlap are removed. When the timestamp difference between two cough events is less than the frame shift of the frame processing and they correspond to the same acquisition position, they are judged as duplicate records, and only the earliest record is retained. The number of cough events remaining after deduplication is counted, and the frequency of cough events within a preset time window is calculated.

[0011] Optionally, in the intelligent acoustic detection method for poultry coughing based on a convolutional audio spectrogram transformer described in this application embodiment, if the frequency of coughing events exceeds a safety threshold, an early warning is triggered and warning information is output, and the health status panel is updated in real time, specifically including: Obtain the frequency of cough events and the pre-defined safety threshold within a preset time window; Determine if the frequency of coughing events exceeds a safe threshold. If it does, determine that there is a risk of health abnormality, trigger the early warning process, and mark the early warning trigger indicator. Standardized early warning information is generated based on early warning trigger identifiers, and the risk level is analyzed based on the standardized early warning information. Generate matching early warning notification information based on risk level; The warning notification information is transmitted to the terminal, and the health status panel is updated.

[0012] Secondly, embodiments of this application provide an acoustic intelligent detection system for poultry cough based on a convolutional audio spectrogram transformer. The system includes a memory and a processor. The memory includes a program for an acoustic intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the acoustic intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by the processor, it performs the following steps: Based on the continuous acquisition of raw audio streams from the poultry farming environment using a microphone array, the raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output. The confidence score is compared with a preset threshold to determine whether a cough event has occurred. If it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

[0013] Optionally, in the poultry cough acoustic intelligent detection system based on a convolutional audio spectrogram transformer described in this application embodiment, the continuous acquisition of raw audio streams from the poultry farming environment based on a microphone array specifically includes: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

[0014] Optionally, in the intelligent acoustic detection system for avian cough based on a convolutional audio spectrogram transformer described in this application embodiment, the original audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Collect pure noise segments when there are no coughing events in the poultry house, and perform noise spectrum estimation based on the pure noise segments to obtain the noise power spectral density; Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

[0015] Thirdly, embodiments of this application also provide a computer-readable storage medium, which includes a program for an intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by a processor, it implements the steps of the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer as described in any of the above claims.

[0016] As can be seen from the above, the intelligent acoustic detection method, system, and medium for poultry cough based on a convolutional audio spectrogram transformer provided in this application continuously collects raw audio streams from the poultry farming environment using a microphone array. The raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into a CAST model to output a cough confidence score. The confidence score is compared with a preset threshold to determine if a cough event exists. If it exists, the event and timestamp are recorded, and the frequency of cough events within a preset time window is statistically analyzed. If the frequency of cough events exceeds a safety threshold, an early warning is triggered and warning information is output, and the health status panel is updated in real time. Through the global self-attention mechanism of CAST, the complete time-frequency context of the sound can be modeled, effectively distinguishing cough sounds from background noise with similar shapes. This achieves accurate extraction of target features from complex scenes, fundamentally improving the model's discriminative and generalization capabilities. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart of the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer provided in this application embodiment; Figure 2 A CAST model architecture diagram of the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer provided in the embodiments of this application; Figure 3 A flowchart of an intelligent acoustic detection system for poultry cough based on a convolutional audio spectrogram transformer, provided in an embodiment of this application; Figure 4 Trend chart of training index of AST model for intelligent detection of avian cough based on convolutional audio spectrogram transformer provided in the embodiments of this application; Figure 5 A trend chart showing the standard changes of the training index of the CAST model for the intelligent acoustic detection method of poultry cough based on convolutional audio spectrogram transformer provided in the embodiments of this application. Figure 6 A trend chart of CAST model training index changes before strategy optimization for the intelligent acoustic detection method for poultry cough based on convolutional audio spectrogram transformer provided in this application embodiment; Figure 7 The chart shows the trend of training index changes of the CAST model after strategy optimization for the intelligent detection method of avian cough acoustics based on convolutional audio spectrogram transformer provided in the embodiments of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0020] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0021] Please refer to Figures 1-7 As shown, the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer is used in a terminal device. This intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer includes the following steps: S101, based on the microphone array, continuously collects the original audio stream in the poultry farming environment, preprocesses the original audio stream, and obtains a standardized Mel spectrogram; S102, input the standardized Mel spectrogram into the CAST model and output the cough sound confidence score; S103, compare the confidence score with the preset threshold to determine whether a cough event exists; S104, if it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; S105: If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

[0022] Specifically, the system acquires audio signals in real time: it continuously collects ambient audio streams through a microphone array deployed in the chicken coop, serving as the starting point for the entire process.

[0023] Signal preprocessing: This module performs a series of normalization operations on the raw audio, including pre-emphasis to enhance high-frequency features, noise reduction based on noise spectrum estimation to suppress background interference, framing (usually 10.24-second segments), and finally generating a normalized Mel spectrogram for model recognition.

[0024] CAST Model Inference: This is the core of the system. The preprocessed spectrogram is input into the convolutional audio spectrogram transformer model. This model first extracts local time-frequency patterns through a lightweight CNN front end and converts them into high-level feature sequences; then, positional encoding is added to this sequence to inject temporal information; finally, the Transformer encoder performs global context modeling on the sequence through a self-attention mechanism and outputs a confidence score representing the probability that the audio segment contains a cough.

[0025] To objectively evaluate the effectiveness and advancement of the CAST model proposed in this invention, a comparative experiment was designed with the existing benchmark audio recognition technology—the AST model. To ensure the fairness of the comparison and accelerate model convergence, both models were initialized with AST weights pre-trained on a large general-purpose audio dataset. Specifically, the CAST model was trained using its structurally consistent Transformer encoder with all pre-trained weights loaded, employing a staged transfer learning strategy: first, the Transformer encoder was frozen, and only randomly initialized CNN front-ends and classification heads were trained; after initial convergence, the entire model was unfrozen and end-to-end collaborative fine-tuning was performed with a low learning rate, ensuring that the local features extracted by the CNN were fully adapted to the global modeling capabilities of the Transformer.

[0026] Decision and Event Logging: The system determines whether the current audio frame contains a cough by comparing the confidence level of the model output with a preset threshold (0.5). If the model confidence level is greater than the threshold, the event, along with its timestamp and other information, is recorded in the log.

[0027] Data analysis and early warning: The system does not issue an early warning for a single cough, but rather continuously monitors and statistically analyzes the frequency of coughing events over a period of time (e.g., per minute). When the statistical value exceeds a preset safety threshold, it is determined to be an abnormal health condition of the poultry flock, triggering an early warning.

[0028] Output and Loop: Early warning information will be notified to farmers via a visual interface, SMS, or audio-visual devices. Regardless of whether an early warning is triggered, the system will update the health status panel in real time. After the process is completed, the system automatically returns to the data collection phase, forming a continuous real-time monitoring loop.

[0029] According to an embodiment of the present invention, continuously acquiring raw audio streams from a poultry farming environment based on a microphone array specifically includes: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

[0030] According to an embodiment of the present invention, the original audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Pure noise segments were collected in the poultry house when there were no coughing events. Based on the pure noise segments, the noise spectrum was estimated to obtain the noise power spectral density. Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

[0031] According to an embodiment of the present invention, a standardized Mel spectrogram is input into a CAST model to output a cough sound confidence score, specifically including: The standardized Mel spectrogram is input into the CAST model, and based on four layers of convolutional units, two-dimensional convolution, batch normalization, ReLU activation and downsampling pooling are performed sequentially to obtain the feature sequence. Based on the positional coding unit, temporal information is injected into the high-level feature sequence. The positional coding adopts sine and cosine positional coding to ensure that the model captures the temporal correlation of the feature sequence. The feature sequence after injecting time-series information is input into the Transformer encoder. The global dependency of each time step in the feature sequence is calculated through the multi-head self-attention mechanism, the frequency domain context information is modeled, and the global context features are output. The global context features are input into a lightweight classification head, and the features are aggregated through average pooling. The fully connected layer maps the aggregated features into a one-dimensional vector. The one-dimensional vector is transformed using the Sigmoid activation function, and the output cough confidence score is in the range [0,1]. According to an embodiment of the present invention, if a cough occurs, the event and timestamp are recorded, and the frequency of cough events within a preset time window is statistically analyzed, specifically including: When the confidence score of the cough sound is greater than the preset threshold, it is determined that there is a cough event in the current audio segment, the system time corresponding to the current cough event is obtained, and a timestamp is generated. Establish a cough event log database, store the identified cough events along with their corresponding timestamps and audio segments in the log database, and mark the collection location of the audio segments; Set the start and end times of a preset time window, and traverse the cough event log database in a sliding window mode to extract all associated stored cough event records within the time window; Based on the deduplication algorithm, duplicate records caused by audio frame overlap are removed. When the timestamp difference between two cough events is less than the frame shift of the frame processing and they correspond to the same acquisition position, they are judged as duplicate records, and only the earliest record is retained. The number of cough events remaining after deduplication is counted, and the frequency of cough events within a preset time window is calculated.

[0032] According to an embodiment of the present invention, if the frequency of coughing events exceeds a safety threshold, an early warning is triggered and warning information is output, and the health status panel is updated in real time, specifically including: Obtain the frequency of cough events and the pre-defined safety threshold within a preset time window; Determine if the frequency of coughing events exceeds a safe threshold. If it does, determine that there is a risk of health abnormality, trigger the early warning process, and mark the early warning trigger indicator. Standardized early warning information is generated based on early warning trigger identifiers, and the risk level is analyzed based on the standardized early warning information. Generate matching early warning notification information based on risk level; The warning notification information is transmitted to the terminal, and the health status panel is updated.

[0033] Secondly, embodiments of this application provide an acoustic intelligent detection system for poultry cough based on a convolutional audio spectrogram transformer. The system includes a memory and a processor. The memory contains a program for an acoustic intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the acoustic intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by the processor, it performs the following steps: Based on the continuous acquisition of raw audio streams from the poultry farming environment using a microphone array, the raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output. The confidence score is compared with a preset threshold to determine whether a cough event has occurred. If it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

[0034] It should be noted that the CAST model of this invention is a hierarchical "local-global" coprocessor, and its overall architecture is as follows: Figure 2As shown, the model first performs a Mel-frequency transform on the input raw audio signal to generate a two-dimensional time-frequency graph as the basic representation. This spectrogram is then fed into a dedicated four-layer convolutional neural network for deep processing: each layer consists of two-dimensional convolution, batch normalization, ReLU activation function, and downsampling pooling in sequence. The first three layers use max pooling for spatial compression, while the crucial fourth layer uses adaptive average pooling to uniformly normalize the input of arbitrary length into a high-level feature sequence with a fixed dimension (hidden_size) and a constant time step of 50. This sequence is enhanced by learnable or pre-defined sine and cosine positional encoding and then input into a Transformer encoder based on a multi-head self-attention mechanism to model the global contextual dependencies in the entire time-frequency domain. Finally, the contextual features output by the encoder are aggregated and mapped through a lightweight classification head to generate a detection confidence score for the cough event. The system compares this confidence score with a preset threshold to complete the final binary classification decision. The core innovation of this design lies in the adaptive sequence compression and length standardization achieved through the CNN front end, which fundamentally reduces the computational complexity of the Transformer from (O(T2)) to (O(502)), significantly improving the inference efficiency and deployment feasibility of the model on edge devices.

[0035] like Figure 4 and Figure 5 As shown in the training curves, the CAST model exhibits superior convergence stability and performance ceiling. Quantitative results demonstrate that the CAST model achieves a mean mAP of 98.77% on the test set, a 2.54 percentage point improvement compared to the AST model's 96.23%. Crucially, while achieving improved accuracy, the CAST model requires only 34M trainable parameters, a significant reduction of approximately 60% compared to the AST model's 87M parameters. This result fully validates the innovation of the proposed architecture: by introducing a lightweight CNN front-end for feature compression and refinement, it not only significantly improves the model's discrimination accuracy in the cough detection task but also fundamentally optimizes model efficiency, achieving a dual advantage in both accuracy and complexity.

[0036] According to an embodiment of the present invention, continuously acquiring raw audio streams from a poultry farming environment based on a microphone array specifically includes: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

[0037] According to an embodiment of the present invention, the original audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Pure noise segments were collected in the poultry house when there were no coughing events. Based on the pure noise segments, the noise spectrum was estimated to obtain the noise power spectral density. Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

[0038] A third aspect of the present invention provides a computer-readable storage medium including a program for an intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by a processor, it implements the steps of the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer as described in any of the above claims.

[0039] This invention discloses an acoustic intelligent detection method, system, and medium for poultry cough based on a convolutional audio spectrogram transformer. It continuously collects raw audio streams from the poultry farming environment using a microphone array, preprocesses the raw audio streams to obtain a standardized Mel spectrogram, inputs the standardized Mel spectrogram into a CAST model, and outputs a cough sound confidence score. The confidence score is compared with a preset threshold to determine if a cough event exists. If a cough event exists, the event and timestamp are recorded, and the frequency of cough events within a preset time window is statistically analyzed. If the cough event frequency exceeds a safety threshold, an early warning is triggered and output, updating the health status panel in real time. Through CAST's global self-attention mechanism, the complete time-frequency context of the sound can be modeled, effectively distinguishing cough sounds from morphologically similar background noise. This achieves accurate extraction of target features from complex scenes, fundamentally improving the model's discriminative and generalization capabilities.

[0040] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0041] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0042] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0043] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0044] Alternatively, if the integrated units of the present invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

Claims

1. A method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer, characterized in that, include: Based on the continuous acquisition of raw audio streams from the poultry farming environment using a microphone array, the raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output. The confidence score is compared with a preset threshold to determine whether a cough event has occurred. If it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

2. The method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer according to claim 1, characterized in that, The system continuously collects raw audio streams from the poultry farming environment using a microphone array, specifically including: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

3. The method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer according to claim 2, characterized in that, The raw audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Collect pure noise segments when there are no coughing events in the poultry house, and perform noise spectrum estimation based on the pure noise segments to obtain the noise power spectral density; Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

4. The method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer according to claim 3, characterized in that, The standardized Mel spectrogram is input into the CAST model, and the output cough sound confidence score includes: The standardized Mel spectrogram is input into the CAST model, and based on four layers of convolutional units, two-dimensional convolution, batch normalization, ReLU activation and downsampling pooling are performed sequentially to obtain the feature sequence. Based on the positional encoding unit, temporal information is injected into the high-level feature sequence. The positional encoding adopts sine and cosine positional encoding to ensure that the model captures the temporal correlation of the feature sequence. The feature sequence after injecting time-series information is input into the Transformer encoder. The global dependency of each time step in the feature sequence is calculated through the multi-head self-attention mechanism, the frequency domain context information is modeled, and the global context features are output. The global context features are input into a lightweight classification head, and the features are aggregated through average pooling. The fully connected layer maps the aggregated features into a one-dimensional vector. The one-dimensional vector is transformed using the Sigmoid activation function, and the output cough confidence score is in the range [0,1].

5. The method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer according to claim 4, characterized in that, If present, record the event and timestamp, and count the frequency of cough events within a preset time window, specifically including: When the confidence score of the cough sound is greater than the preset threshold, it is determined that there is a cough event in the current audio segment, the system time corresponding to the current cough event is obtained, and a timestamp is generated. Establish a cough event log database, store the identified cough events along with their corresponding timestamps and audio segments in the log database, and mark the collection location of the audio segments; Set the start and end times of a preset time window, traverse the cough event log database in a sliding window mode, and extract all associated stored cough event records within the time window; Based on the deduplication algorithm, duplicate records caused by audio frame overlap are removed. When the timestamp difference between two cough events is less than the frame shift of the frame processing and they correspond to the same acquisition position, they are judged as duplicate records, and only the earliest record is retained. The number of cough events remaining after deduplication is counted, and the frequency of cough events within a preset time window is calculated.

6. The method for intelligent acoustic detection of avian cough based on a convolutional audio spectrogram transformer according to claim 5, characterized in that, If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time, including: Obtain the frequency of cough events and the pre-defined safety threshold within a preset time window; Determine if the frequency of coughing events exceeds a safe threshold. If it does, determine that there is a risk of health abnormality, trigger the early warning process, and mark the early warning trigger indicator. Standardized early warning information is generated based on early warning trigger identifiers, and the risk level is analyzed based on the standardized early warning information. Generate matching early warning notification information based on risk level; The warning notification information is transmitted to the terminal, and the health status panel is updated.

7. An intelligent acoustic detection system for avian cough based on a convolutional audio spectrogram transformer, characterized in that, The system includes a memory and a processor. The memory contains a program for an intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the intelligent acoustic detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by the processor, it performs the following steps: Based on the continuous acquisition of raw audio streams from the poultry farming environment using a microphone array, the raw audio streams are preprocessed to obtain a standardized Mel spectrogram. The standardized Mel spectrogram is input into the CAST model, and the cough sound confidence score is output. The confidence score is compared with a preset threshold to determine whether a cough event has occurred. If it exists, record the event and timestamp, and count the frequency of cough events within the preset time window; If the frequency of coughing events exceeds the safety threshold, an alert will be triggered and an alert message will be output, and the health status panel will be updated in real time.

8. The intelligent acoustic detection system for poultry cough based on a convolutional audio spectrogram transformer according to claim 7, characterized in that, The system continuously collects raw audio streams from the poultry farming environment using a microphone array, specifically including: Obtain poultry house area information, and based on the poultry house area information, set up the microphone array in different areas of the poultry house in an equilateral triangle layout; Set the sampling frequency, and control multiple microphones to synchronously acquire audio signals based on the sampling frequency to obtain multi-channel raw audio streams; Time synchronization calibration is performed on the multi-channel raw audio stream to eliminate the phase difference caused by transmission delay of each microphone, resulting in a synchronized single-channel fused audio stream.

9. The intelligent acoustic detection system for poultry cough based on a convolutional audio spectrogram transformer according to claim 8, characterized in that, The raw audio stream is preprocessed to obtain a standardized Mel spectrogram, specifically including: The original audio stream after synchronization is pre-emphasized, and the high-frequency transient characteristics of cough sounds are enhanced based on a first-order high-pass filter. Collect pure noise segments when there are no coughing events in the poultry house, and perform noise spectrum estimation based on the pure noise segments to obtain the noise power spectral density; Adaptive spectral denoising was performed on the pre-emphasized audio signal using spectral subtraction to remove persistent background noise and retain the effective components of coughing sounds, resulting in a denoised audio signal. The denoised audio signal is segmented into frames, and a fast Fourier transform is performed on each frame to obtain the power spectrum of each frame. The power spectrum is then converted into Mel frequency domain features. Logarithmic operations are performed on the Mel frequency domain features to obtain the Mel spectrum. Normalization is then performed on the Mel spectrum to obtain the standardized Mel spectrum.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a program for an acoustically intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer. When the program for the acoustically intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer is executed by a processor, it implements the steps of the acoustically intelligent detection method for poultry cough based on a convolutional audio spectrogram transformer as described in any one of claims 1 to 6.