Construction method, system and device of pig group cough type identification model
By constructing a cough type identification model for pig herds using deep learning algorithms and sound processing technology, the accuracy and timeliness issues of existing pig health monitoring methods are solved, enabling precise assessment and automated monitoring of respiratory diseases in pig herds.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-13
AI Technical Summary
Existing methods for monitoring pig health rely on experience and visual observation, which makes it difficult to guarantee accuracy and timeliness. Furthermore, they ignore the comprehensive timbre information of cough sounds and cannot effectively distinguish between different types of respiratory diseases, especially for monitoring diseases in piglets and fattening pigs.
By employing deep learning algorithms and sound processing technology, the model for identifying cough types in pig herds is constructed by extracting Mel spectrum features by recognizing the energy value and time interval of a single cough segment. This model automatically classifies dry cough, wet cough, and deep cough, and calculates a respiratory disease severity index based on the cough type.
It improves the accuracy and efficiency of disease monitoring, realizes the automation and intelligence of disease monitoring, reduces the consumption of human resources, and can detect abnormal cough patterns in a timely manner, providing support for early diagnosis and treatment.
Smart Images

Figure FT_1 
Figure SMS_1 
Figure SMS_2
Abstract
Description
Technical Field
[0001] This invention relates to the fields of pig breeding, audio detection, and audio recognition technology, and particularly to a method, system, and apparatus for constructing a cough type recognition model for pig herds. Background Technology
[0002] In the field of audio signal processing, digital signal processing (DSP) techniques are used to analyze and process audio signals to extract specific timbre features. Furthermore, machine learning methods are widely applied to audio recognition and classification to help identify different types of sounds.
[0003] In modern pig farming, respiratory diseases are one of the main factors affecting pig health and production efficiency. These diseases not only lead to slow growth and poor feed conversion rates, but can also trigger serious epidemics, causing huge economic losses to farmers. Therefore, timely and accurate monitoring and assessment of the health status of pig herds is of great significance for disease prevention and control.
[0004] Traditional methods for monitoring pig health rely primarily on the experience and visual observation of farmers. This approach is not only time-consuming and labor-intensive but also susceptible to subjective factors, making accuracy and timeliness difficult to guarantee. With advancements in science and technology, sound event detection methods are increasingly being applied to pig health monitoring. By incorporating signal processing techniques and deep learning models to analyze the sounds of pig coughs, non-invasive monitoring of respiratory abnormalities such as coughing and sneezing can be achieved. This method allows for continuous 24-hour monitoring, reducing manpower consumption and improving monitoring efficiency. For example, the early warning method for sow respiratory diseases based on acoustic analysis involves the following steps: S1, setting up audio acquisition nodes to collect sound signals; S2, training an SVM classification model to determine whether the audio is a cough; S3, calculating five parameters of sow respiratory diseases: root mean square, peak frequency, duration, average interval time, and maximum amplitude. The severity of the sow respiratory disease is determined by the ratio of the area and radius of a regular pentagon formed by connecting adjacent points of these five parameters to the maximum value; S4, using the audio data collected by two adjacent sound acquisition nodes, the location of the sound source is determined based on the energy ratio and time delay characteristics, i.e., the pen where the coughing sow is located.
[0005] The aforementioned method defines a way to quantify the severity of respiratory diseases, but the features it employs determine its limited practicality in real-world applications. For example: 1. The method is specified for predicting diseases in sows only, while the peak frequency of coughing in piglets is generally higher than in sows, this does not necessarily mean that the piglet's disease is more severe than the sow's. In actual production, respiratory disease control in piglets and fattening pigs is equally important, and the number of piglets and fattening pigs far exceeds that of sows; 2. In practical production, it is impossible to assess each pig individually; the entire herd must be assessed. This means there will be pigs closer to the microphone and pigs farther away. The maximum amplitude of coughing in pigs farther from the microphone may be smaller because the energy attenuation of the sound signal during propagation reduces the amplitude, which does not indicate that the pig's disease is not severe. Therefore, existing methods for detecting pig health based on sound events employ many signal technology indicators when searching for features, but they do not consider production conditions, ignoring the rich information contained in the overall timbre of cough sounds and the most intuitive judgment methods used by human veterinary experts when perceiving coughs, making them rather rigid. Summary of the Invention
[0006] In view of this, the present invention provides a method, system, and apparatus for constructing a cough type identification model for swine herds. By employing advanced sound processing technology and deep learning algorithms, the present invention provides a comprehensive disease severity assessment system, realizing the automatic extraction and analysis of cough sound features, improving the accuracy and efficiency of disease monitoring, thereby automating and intelligentizing the disease monitoring process, reducing the consumption of human resources, and improving the continuity and real-time nature of monitoring work.
[0007] To achieve the above-mentioned objectives, the present invention provides the following technical solution:
[0008] This invention provides a method for constructing a cough type identification model for swine herds, comprising the following steps:
[0009] Step S1: Set up audio signal acquisition nodes to acquire and store sound signals;
[0010] Step S2: Identify a single cough segment and obtain the position of the single cough segment in the sound signal;
[0011] Step S3: Calculate the energy value of the single cough fragment:
[0012]
[0013] Where E represents the energy of the frame, x[n] is the nth sample value after processing by the window function, and N is the number of sampling points in each frame;
[0014] Calculate the energy difference between adjacent single cough segments:
[0015]
[0016] Based on the time interval between adjacent single cough segments and the energy difference, the single cough segments are combined into a complete cough process;
[0017] Step S4: Extract the Mel spectrum from the coughing process as feature parameters; build a neural network model based on the feature parameters and train it; use the trained neural network model for verification to complete the cough type identification and obtain the pig herd cough type identification model; the cough type identification results include: dry cough, wet cough, or deep cough; wherein, the dry cough is a clear, short, dry cough without inflammatory secretions in the lungs; the wet cough is a cloudy, deep, moist cough with phlegm and a lot of lung secretions; the deep cough is a spasmodic, forceful, deep cough.
[0018] In some specific embodiments of the present invention, the window function includes a rectangular window, a Hanning window, a Hamming window, or a Blackman window.
[0019] In some specific embodiments of the present invention, step S3 specifically includes: starting from the first identified single cough segment, calculating the energy value of each single cough segment and the energy difference and time interval between two adjacent single cough segments; if the time interval is ≤0.8 seconds and the energy difference is ≤20%, then the two single cough segments are considered to be continuous; otherwise, the splicing of the current cough process is terminated, and the duration of the current cough process is calculated.
[0020] If the duration is less than 2 seconds, do not save;
[0021] If the duration is ≥2 seconds, retain the audio data of the entire coughing episode, move to the next identified single cough segment, and repeat the above steps until the last single cough segment is found.
[0022] In some specific embodiments of the present invention, step S4, which involves building and training a neural network model, includes the following steps:
[0023] S4-1. Obtain the coughing process described in multiple steps S3;
[0024] S4-2. Label the cough process as dry cough, wet cough, or deep cough according to the characteristics of the cough.
[0025] S4-3. Trim or pad the cough process with zeros to a uniform 5-second length and normalize the volume to reduce the difference between data. Extract the Mel spectrum from each cough process as the input of the model.
[0026] S4-4. Use the Transformer model or LSTM as the basic architecture, and add three convolutional layers on it to extract local features of the audio. The output of the model is the probability distribution of three recognition results: dry cough, wet cough, or deep cough. Select the category with the highest probability as the final cough type.
[0027] S4-5. Use the cross-entropy loss function for multi-class classification to measure the difference between the model output and the actual label, and use gradient descent to update the model parameters to minimize the loss function.
[0028] Among them, the dry cough is a clear, short, dry cough without inflammatory secretions in the lungs; the wet cough is a cloudy, deep, moist cough with rattling sounds and a lot of lung secretions; and the deep cough is a spasmodic cough with deep vibrations.
[0029] The present invention also provides a system for identifying the type of cough in pig herds, comprising:
[0030] Multiple audio signal acquisition units are used to acquire the sound signal to be identified;
[0031] An effective extraction unit is used to effectively extract sound from the sound signal, identify single cough segments, obtain the position of the single cough segment in the sound signal, and combine the single cough segments into a complete cough process based on the time interval and energy difference between adjacent single cough segments.
[0032] A classification and recognition unit is used to analyze the sound signals during the coughing process and identify the cough type as dry cough, wet cough, or deep cough.
[0033] In some specific embodiments of the present invention, the effective extraction unit performs the following steps:
[0034] Starting from the first identified single cough segment, calculate the energy value of each single cough segment, as well as the energy difference and time interval between two adjacent single cough segments:
[0035] Calculate the energy value of the single cough fragment:
[0036]
[0037] Where E represents the energy of the frame, x[n] is the nth sample value after processing by the window function, and N is the number of sampling points in each frame;
[0038] Calculate the energy difference between adjacent single cough segments:
[0039]
[0040] If the time interval is ≤0.8 seconds and the energy difference is ≤20%, then the two single cough segments are considered to be continuous; otherwise, the splicing of the current cough process ends to form a complete cough process, and the duration of the current cough process is calculated.
[0041] If the duration is less than 2 seconds, do not save;
[0042] If the duration is ≥2 seconds, retain the audio data of the entire coughing episode, move to the next identified single cough segment, and repeat the above steps until the last single cough segment is found.
[0043] This invention also provides a system for quantifying the severity of respiratory diseases in swine herds, including the aforementioned swine cough type identification system and a reporting unit; the reporting unit is used to statistically analyze the identified cough types, calculate the number of cough rounds per hour, and a respiratory disease severity index based on cough type:
[0044] Respiratory disease severity index = r_y + 1.5 * r_s + 3 * r_c
[0045] Where r_y represents the number of hours of dry cough in the pig herd on that day, r_s represents the number of hours of wet cough in the pig herd on that day, and r_c represents the number of hours of deep cough in the pig herd on that day; the respiratory disease severity index is a value that quantifies the severity of respiratory diseases in the pig herd.
[0046] In some specific embodiments of the present invention, the severity of the respiratory disease in the swine herd is determined by the following criteria:
[0047] If the respiratory disease severity index is <1, it indicates no risk.
[0048] The respiratory disease severity index of 1 to 10 indicates a mild risk.
[0049] A respiratory disease severity index of 10-30 indicates a moderate risk.
[0050] A respiratory disease severity index >30 indicates a high risk.
[0051] The present invention also provides a method for quantifying the severity of respiratory diseases in swine herds for non-disease diagnosis purposes, including obtaining the severity of respiratory diseases in swine herds using the aforementioned quantification system for the severity of respiratory diseases in swine herds.
[0052] The present invention also provides an apparatus comprising: a memory for storing a computer program; and a processor for executing the computer program to implement any of the following:
[0053] (I) The pig cough type identification system; and / or
[0054] (II) The aforementioned system for quantifying the severity of respiratory diseases in swine herds; and / or
[0055] (III) The steps of the method.
[0056] The present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement any of the following:
[0057] (I) The pig cough type identification system; and / or
[0058] (II) The aforementioned system for quantifying the severity of respiratory diseases in swine herds; and / or
[0059] (III) The steps of the method.
[0060] This invention includes, but is not limited to, the following beneficial effects:
[0061] 1. By utilizing a deep learning model to automatically classify cough audio, this invention can accurately distinguish between dry cough, wet cough, and deep cough, which is crucial for diagnosing different types of respiratory diseases. The model fully incorporates prior knowledge from veterinary experts, improving diagnostic accuracy.
[0062] 2. Through 24-hour continuous monitoring, this invention can promptly detect abnormal cough patterns, enabling early detection of respiratory diseases. Early diagnosis and treatment are crucial for controlling the spread of disease and alleviating the condition of pigs, helping to reduce mortality and treatment costs.
[0063] 3. Traditional disease monitoring methods often require a large amount of manpower for daily inspections and auscultation, which is not only inefficient but also costly. This invention can significantly reduce reliance on manpower, lowering operating costs for pig farms. It helps farmers better understand the health status of their pig herds, thereby enabling them to make more scientific management decisions. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0065] Figure 1 This is a flowchart illustrating the combined process of coughing. Detailed Implementation
[0066] This invention discloses a method, system, and apparatus for constructing a cough type identification model for swine herds. Those skilled in the art can refer to the content of this document and appropriately modify the process parameters to achieve the desired result. It is particularly important to note that all similar substitutions and modifications are obvious to those skilled in the art and are considered to be included in this invention. The methods and applications of this invention have been described through preferred embodiments. Those skilled in the art can clearly modify or appropriately change and combine the methods and applications described herein without departing from the content, spirit, and scope of this invention to implement and apply the technology of this invention.
[0067] Terminology Explanation:
[0068] Deep learning is a machine learning technique that uses multi-layered neural networks to learn feature representations and abstractions of data, thereby enabling various tasks such as image recognition, speech recognition, and natural language processing. The core of deep learning lies in the design and training of neural networks.
[0069] Model training: Using a dataset to train a machine learning model so that it can make accurate predictions on new data. Model training includes steps such as selecting a suitable algorithm and model architecture, determining model parameters, and defining a loss function.
[0070] Loss function: A function used to measure the difference between the model's predictions and the actual results. Optimizing the loss function during model training can make the model more accurate in predicting unknown data. Common loss functions include mean squared error and cross-entropy.
[0071] Backpropagation: An algorithm used to calculate the gradients of parameters in a neural network. This algorithm uses a chain rule to propagate the error from the output layer to the input layer, thereby calculating the contribution of each parameter to the error. Backpropagation is a commonly used optimization algorithm in deep learning, which can be used to update model parameters and improve model accuracy.
[0072] Neural networks: A mathematical model of algorithms that mimics the behavioral characteristics of animal neural networks to perform distributed parallel information processing. These networks rely on the complexity of the system to adjust the relationships between a large number of interconnected nodes, thereby achieving the purpose of information processing.
[0073] Gradient descent: an optimization algorithm commonly used in machine learning and artificial intelligence to recursively approximate the minimum deviation model.
[0074] Sound Event Detection (SED): SED is an automated process that involves identifying and classifying specific sound events in an audio recording. In short, the purpose of SED is to enable computers to "hear" and understand what is happening in the sound environment. For example, with SED, a computer can identify whether an audio clip contains human voices, vehicle sounds, animal sounds, or other specific sound events. In practical applications, SED can be used in various scenarios, such as security monitoring, environmental sound analysis, and health monitoring, to help automatically identify and respond to sounds in the surrounding environment.
[0075] Number of coughs and cough rounds: Imagine a person coughing. Sometimes, due to sudden stimulation or clearing the throat, it might be a single cough; however, when stimulated or suffering from illnesses such as a cold or pneumonia, coughing often manifests as a continuous action, meaning the same individual might cough several times in succession. A herd of pigs behaves similarly. Here, we define the period from the start of an individual's cough to the end of a continuous series of coughs as a cough round, and each cough as a single cough. A cough round contains one or more coughs. This defines the number of coughs and cough rounds over a period of time or within a group of individuals.
[0076] Mel Spectrogram: Mel spectrum is a method for representing audio signals that combines the features of a spectrogram with the Mel scale. A spectrogram is a graph that shows how the frequency components of an audio signal change over time, while the Mel scale is a non-linear scale based on the human ear's perception of different frequencies of sound, which can better simulate the characteristics of human auditory perception. In the Mel spectrum, the frequency axis is transformed into the Mel scale, which makes the Mel spectrum closer to how humans actually perceive sound. In fields such as audio processing and speech recognition, the Mel spectrum is widely used as a feature representation because it can effectively capture the frequency components in the audio signal that are more sensitive to the human ear, thereby improving the accuracy of sound analysis and recognition. The transformation formula of the Mel frequency is shown in Equation (1):
[0077]
[0078] Where f represents the original frequency and m represents the converted Mel frequency.
[0079] This solution uses a deep learning model to simulate the production experience of human experts. Specifically, different timbres of cough (dry cough, wet cough, and deep cough) reflect different types and degrees of respiratory illness.
[0080] This invention aims to address the limitations of existing swine respiratory disease monitoring technologies, particularly those that over-rely on cough frequency statistics or signal characteristics while neglecting cough sound timbre analysis. The core objective of this invention is to develop a comprehensive method for monitoring swine respiratory diseases that utilizes cough sound feature analysis to achieve a more accurate assessment of disease severity.
[0081] The main innovation of this invention lies in the introduction of a sound feature analysis method. This method not only focuses on the number, frequency, and amplitude of coughs, but more importantly, it can identify and classify cough types (e.g., dry cough, wet cough, and deep cough), and construct a comprehensive disease severity assessment model based on this. The introduction of this method aims to overcome the problem of insufficient information utilization in traditional monitoring methods, thereby improving the accuracy and efficiency of disease monitoring.
[0082] This invention utilizes advanced sound processing technology and deep learning algorithms to automatically extract and analyze cough sound features, thereby automating and intelligentizing the disease monitoring process, reducing the consumption of human resources, and improving the continuity and real-time performance of monitoring work.
[0083] The present invention will be further illustrated below with reference to embodiments, but the scope of protection of the present invention is not limited thereto:
[0084] Example 1
[0085] This embodiment provides a method for quantifying the severity of respiratory diseases in pig herds. The system used to implement this method includes multiple audio signal acquisition nodes, an effective extraction unit, a classification and recognition unit, and a reporting unit.
[0086] The steps for quantifying the severity of respiratory diseases in swine herds are as follows:
[0087] S1. Set up microphone acquisition nodes to collect audio signals within the pigsty. Each microphone is paired with a small processor to collect and process audio data and transmit the processing results. Specifically, this includes: collecting pigsty audio via microphones: deploying multiple high-sensitivity microphones within the pigsty to ensure complete coverage of the entire space. These microphones will record audio within the pigsty 24 / 7 to capture the sounds of the pigs, especially coughing. Audio data will be saved in 3-minute increments (the saving unit is not critical; it only needs to be suitable for storage and computation).
[0088] The microphone needs to have high sensitivity and good noise suppression capabilities to accurately capture coughing sounds amidst various background noises that may exist in the pigsty (such as fan noise, pig activity noise, etc.). At the same time, the connection between the microphone and the recording equipment should ensure real-time transmission and storage of audio data.
[0089] S2. For each audio clip obtained in step S1, the effective extraction unit identifies a single coughing segment of the pig and obtains the start and end times (position in the audio) of each cough relative to the audio clip, recorded in seconds. This identification of single coughing segments of the pig can be based on existing general SED (Sound Event Detection) technology. However, the specific path is not the focus of this invention.
[0090] S3. Combine the single cough fragments obtained in step S2 into a complete cough process. A complete cough process is called a round of coughing.
[0091] S4. The classification and recognition unit establishes a cough type recognition model. The pre-trained cough type recognition model is used to analyze the entire cough audio after preprocessing in step S3. Based on the analysis results of the deep learning model, the cough events are classified as: dry cough, wet cough, and deep cough. The number of coughs and the occurrence time of each type are recorded and uploaded to the data center.
[0092] S5. The reporting unit statistically analyzes the categorized cough events, calculating the number of cough rounds per hour and the respiratory disease severity index based on cough type. Specifically, this includes summarizing the number of dry cough, wet cough, and deep cough rounds identified from all audio recordings collected within 24 hours, dividing by the total collection hours t, and averaging the results to the hourly average to obtain the hourly dry cough rounds r_y, hourly wet cough rounds r_s, and hourly deep cough rounds r_c for the pig herd. The severity index resp_index is defined as r_y + 1.5 * r_s + 3 * r_c. The severity of the respiratory disease in the pig herd can be calculated. A higher value indicates a higher severity of the disease.
[0093] S6. The data center automatically generates detailed health reports every day, including information such as the distribution of cough types and severity index, providing farmers with a reference for disease monitoring.
[0094] Specifically, in combination Figure 1 The flowchart of the cough process shown includes step S3, which specifically includes:
[0095] S3-1, Start with the first cough from the list of identified coughs.
[0096] S3-2. Calculate the energy value of each cough using formula (2). Calculate the energy difference between the first cough and the next cough using formula (3). Calculate the time interval between the two coughs as the number of seconds between the end of the first cough and the start of the next cough.
[0097]
[0098] Where E represents the energy of the frame, x[n] is the nth sample value after processing by the window function, and N is the number of sampling points in each frame.
[0099] A sound signal contains the values of many sample points. Suppose the original long audio segment is represented as a[n] (n=0,…,N). a-1 N a It is the length of the audio signal / number of sample points). SED is a technique that extracts a small segment of target sound from a long audio signal. Let's assume the extracted target sound is b[n] (n=0, ..., N). b-1 N b N is the length of the audio signal, and by definition, N... b ≤N a x[n] is the audio signal of b[n] after processing by a window function, and the length of x[n] is N. b Common window functions include rectangular windows, Hanning windows, Hamming windows, and Blackman windows. Taking the commonly used Hanning window as an example, x[n] = 0.5*(1-cos(2*Π*b[n] / (N)). b-1 ))), n=0, ..., N b-1 .
[0100] The energy difference between two coughs is defined as follows:
[0101]
[0102] S3-3. If the time interval is ≤0.8 seconds and the energy difference is ≤20%, then the two coughs are considered to be consecutive.
[0103] S3-4. If the above conditions are not met or the end of the cough list has been found, end the current cough process splicing.
[0104] S3-5. Calculate the duration of the current coughing process as the number of seconds between the start time of the first cough and the end time of the last cough.
[0105] S3-6. If the duration is less than 2 seconds, it is considered a random, occasional cough and will not be stored or recorded in the number of cough rounds included in this audio segment. If the duration is 2 seconds or more, it is considered potentially related to a disease and the audio data of the entire cough round will be retained.
[0106] S3-7. Move to the next cough in the cough list and repeat steps S3-2 to S3-6 until the end of the cough list is reached.
[0107] The specific steps for training the cough type recognition model in step S4 are as follows:
[0108] S4-1. For the audio output in step S3, collect at least 10,000 audio recordings of pig coughing throughout the entire process, ensuring that they cover different stages of piglet, finishing pig, and gilt production, as well as different degrees of respiratory disease severity. The data should come from at least 200 different pig herds.
[0109] S4-2. Invite veterinary experts to auscultate the collected cough audio and label them as dry cough, wet cough or deep cough according to the characteristics of the cough.
[0110] The labeling criteria are as follows: Dry cough: clear, short (0.2-0.5 seconds in duration), dry, and without inflammatory secretions in the lungs;
[0111] Wet cough: cloudy, deep, moist (lasting 0.5-1.0 seconds), with rattling sounds and a lot of lung secretions;
[0112] Deep cough: spasmodic, deep vibration (duration 1.0~1.5 seconds).
[0113] S4-3. Trim or pad the audio to a uniform 5-second length and normalize the volume (normalize peak amplitude to [-1,1]) to reduce differences between data. Extract the Mel spectrogram from each audio file, a feature commonly used in sound processing, as input to the model;
[0114] S4-4. The Transformer model is used as the basic architecture. Its powerful self-attention mechanism makes it particularly suitable for processing sequential data. Three convolutional layers are added to the Transformer model to extract local features from the audio. The model outputs a probability distribution for three categories (dry cough, wet cough, and deep cough).
[0115] S4-5. Use the cross-entropy loss function for multi-class classification to measure the difference between the model output and the actual labels. Employ gradient descent to update the model parameters to minimize the loss function.
[0116] The specific steps in step 4 for analyzing the pre-trained cough type recognition model on the pre-processed full-length cough audio are as follows:
[0117] Based on steps S1-S3, the complete coughing process of the pig is obtained, and the audio is processed according to S4-3 to ensure the consistency between the model input during recognition and the training process. The trained cough type recognition model is used to identify each cough audio segment. Since the model output is a probability distribution of three categories (dry cough, wet cough, deep cough), we directly select the category with the highest probability as the final cough type.
[0118] Plot the real-time severity index change curve and set warning thresholds (mild ≥1, moderate ≥10, severe ≥30). If the index exceeds the threshold in a certain hour, an warning will be automatically triggered.
[0119] In this embodiment, 14,325 samples were collected in the training set and 2,861 samples were collected in the test set when training the cough type recognition model. The accuracy of 4-class classification on the test set was 91.3%.
[0120] Example 2
[0121] Using the quantification method for the severity of respiratory diseases in pig herds described in Example 1, pig houses A and B of a pig farm were monitored to compare the quantitative differences between "non-pathological stress cough" and "pathological infection cough." The results showed that, based on traditional cough counting, both units coughed 100 times within one hour, indicating that the cough severity was the same. However, in pig house A, the cough was actually caused by feed dust during the feeding process, which irritated the pigs, causing each pig to cough once or twice. This was a transient cough, verified as "non-pathological stress," and no control measures were needed if there were no subsequent lasting effects. In pig house B, the cough was due to mycoplasma infection; 10 pigs coughed continuously within one hour, with a total of 5 rounds of dry cough and 5 rounds of deep cough, requiring immediate treatment. According to the definition in Example 1 of this invention, the resp_index of pig house A is 0, and the resp_index of pig house B is 20. Traditional "cough frequency statistics" cannot distinguish between "stress vs. pathology" (both are 100 times / hour), while this invention can accurately quantify the severity of the disease through "cough process combination + type identification + severity index", avoiding "over-prevention and control" (pig house A) or "prevention and control delay" (pig house B), which obviously has more practical guiding significance for production.
[0122] Example 3
[0123] Using the quantification method for the severity of respiratory diseases in pigs described in Example 1, sound monitoring was conducted in Xiangyang. An alert was issued indicating that the resp_index of four consecutive pigsties in a row rose from 0 to 28 within two days. The pigsties and related handlers were quickly disinfected and isolated. Subsequently, these pigs tested positive for influenza, while pigs in other pigsties in the same farm remained healthy due to timely measures, thus minimizing losses.
[0124] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for constructing a cough type identification model for swine herds, characterized in that, Includes the following steps: Step S1: Set up audio signal acquisition nodes to acquire and store sound signals; Step S2: Identify a single cough segment and obtain the position of the single cough segment in the sound signal; Step S3: Calculate the energy value of the single cough fragment: Where E represents the energy of the frame, x[n] is the nth sample value after processing by the window function, and N is the number of sampling points in each frame; Calculate the energy difference between adjacent single cough segments: Based on the time interval between adjacent single cough segments and the energy difference, the single cough segments are combined into a complete cough process; Step S4: Extract the Mel spectrum from the coughing process as feature parameters; build a neural network model based on the feature parameters and train it; use the trained neural network model for verification to complete the cough type identification and obtain the pig herd cough type identification model; the cough type identification results include: dry cough, wet cough, or deep cough; wherein, the dry cough is a clear, short, dry cough without inflammatory secretions in the lungs; the wet cough is a cloudy, deep, moist cough with rattling sounds and a lot of lung secretions; the deep cough is a spasmodic cough with deep vibrations.
2. The construction method as described in claim 1, characterized in that, Step S3 specifically includes: starting from the first identified single cough segment, calculating the energy value of each single cough segment and the energy difference and time interval between two adjacent single cough segments; if the time interval is ≤0.8 seconds and the energy difference is ≤20%, then the two single cough segments are considered to be continuous; otherwise, the splicing of the current cough process ends, and the duration of the current cough process is calculated. If the duration is less than 2 seconds, do not save; If the duration is ≥2 seconds, retain the audio data of the entire coughing episode, move to the next identified single cough segment, and repeat the above steps until the last single cough segment is found.
3. The construction method as described in claim 1 or 2, characterized in that, Step S4, which involves building and training a neural network model, includes the following steps: S4-1. Obtain the coughing process described in multiple steps S3; S4-2. Label the cough process as dry cough, wet cough, or deep cough according to the characteristics of the cough. S4-3. Trim or pad the cough process with zeros to a uniform 5-second length and normalize the volume to reduce the difference between data. Extract the Mel spectrum from each cough process as the input of the model. S4-4. Use the Transformer model or LSTM as the basic architecture, and add three convolutional layers on it to extract local features of the audio. The output of the model is the probability distribution of three recognition results: dry cough, wet cough, or deep cough. Select the category with the highest probability as the final cough type. S4-5. Use the cross-entropy loss function for multi-class classification to measure the difference between the model output and the actual label, and use gradient descent to update the model parameters to minimize the loss function.
4. A system for identifying cough types in pig herds, characterized in that, include: Multiple audio signal acquisition units are used to acquire the sound signal to be identified; An effective extraction unit is used to effectively extract sound from the sound signal, identify single cough segments, obtain the position of the single cough segment in the sound signal, and combine the single cough segments into a complete cough process based on the time interval and energy difference between adjacent single cough segments. The classification and recognition unit is used to analyze the sound signals during the coughing process and identify the cough type as dry cough, wet cough, or deep cough.
5. The swine cough type identification system as described in claim 4, characterized in that, The effective extraction unit performs the following steps: Starting from the first identified single cough segment, calculate the energy value of each single cough segment, as well as the energy difference and time interval between two adjacent single cough segments: Calculate the energy value of the single cough fragment: Where E represents the energy of the frame, x[n] is the nth sample value after processing by the window function, and N is the number of sampling points in each frame; Calculate the energy difference between adjacent single cough segments: If the time interval is ≤0.8 seconds and the energy difference is ≤20%, then the two single cough segments are considered to be continuous; otherwise, the splicing of the current cough process ends to form a complete cough process, and the duration of the current cough process is calculated. If the duration is less than 2 seconds, do not save; If the duration is ≥2 seconds, retain the audio data of the entire coughing episode, move to the next identified single cough segment, and repeat the above steps until the last single cough segment is found.
6. A system for quantifying the severity of respiratory diseases in swine herds, characterized in that, Includes the swine cough type identification system and reporting unit as described in claim 4 or 5; the reporting unit is used to statistically analyze the identified cough types, calculate the number of cough rounds per hour, and a respiratory disease severity index based on cough type: Respiratory disease severity index = r_y + 1.5 * r_s + 3 * r_c Where r_y represents the number of hours of dry cough in the pig herd on that day, r_s represents the number of hours of wet cough in the pig herd on that day, and r_c represents the number of hours of deep cough in the pig herd on that day; the respiratory disease severity index is a value that quantifies the severity of respiratory diseases in the pig herd.
7. The quantization system as described in claim 6, characterized in that, The severity of respiratory diseases in the pig herd was determined according to the following criteria: If the respiratory disease severity index is <1, it indicates no risk. The respiratory disease severity index of 1 to 10 indicates a mild risk. A respiratory disease severity index of 10-30 indicates a moderate risk. A respiratory disease severity index >30 indicates a high risk.
8. A method for quantifying the severity of respiratory diseases in swine herds for purposes other than disease diagnosis, characterized in that, This includes using a quantification system for the severity of respiratory diseases in pig herds as described in claim 6 or 7 to obtain the severity of respiratory diseases in pig herds.
9. An apparatus, characterized in that, include: Memory, used to store computer programs; A processor, when executing the computer program, implements any of the following: (I) The swine cough type identification system as described in claim 4 or 5; and / or (II) A system for quantifying the severity of respiratory diseases in swine herds as described in claim 6 or 7; and / or (III) The steps of the method as described in claim 8.
10. A computer-readable storage medium, characterized in that, The readable storage medium stores a computer program that, when executed by a processor, implements any of the following: (I) The swine cough type identification system as described in claim 4 or 5; and / or (II) A system for quantifying the severity of respiratory diseases in swine herds as described in claim 6 or 7; and / or (III) The steps of the method as described in claim 8.