A method, device and storage medium for detecting baby sounds
Through the multi-feature detection algorithm of support vector machine and sliding window filtering mechanism, the accuracy and real-time problems of existing infant sound detection methods when computing resources are limited are solved, and efficient and accurate infant cry detection is achieved.
Patent Information
- Application Number
- CN202211391630.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-08
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-11-08
AI Technical Summary
The existing infant sound detection methods have shortcomings in detection accuracy and real-time performance, especially when computing resources are limited, it is difficult to achieve efficient and accurate infant cry detection.
Adaptive real-time detection algorithm based on support vector machine is adopted, combined with sliding window filtering mechanism, and adaptive real-time detection is achieved through audio data buffering and message queue management.
It improves the accuracy and stability of infant cry detection, reduces the false alarm rate, and can achieve real-time and accurate infant cry detection under limited computing resources.
Smart Images

Figure CN115662476B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of infant sound analysis, and in particular to an infant sound detection method, device and storage medium. Background Art
[0002] Infant care is a major concern for young parents today. Babies, who haven't yet learned to speak, often express discomfort and needs only through crying. When babies are left alone in cribs or strollers to rest or play, caregivers aren't around to promptly detect and detect their cries, potentially leading to unforeseen consequences. In recent years, smart homes have gradually become part of people's lives, bringing convenience to daily life. Various devices with baby sound detection can identify a baby's cry and notify the caregiver through various methods, allowing them to more quickly identify their baby's needs and protect their healthy and healthy growth. These devices are often integrated into products like cribs and strollers, or placed in the baby's room, to promptly detect a baby's cry and alert the caregiver.
[0003] However, existing baby sound detection methods have several shortcomings: Detection algorithms based on simple analog circuits or solely on Mel-spectrum spectrograms are often inaccurate and subject to missed or false detections. Existing deep learning-based methods are complex to train and deploy, requiring high computational costs, making them difficult to deploy and monitor at the edge in real time. On the devices where the detection algorithms run, cloud-based recognition solutions rely on a stable network and have low reliability. Local recognition solutions are limited by the computing power of the deployed devices and, when sharing computing resources with other intelligent algorithms, may suffer from resource contention, leading to insufficient real-time performance, delayed alerts, and even decreased accuracy. Therefore, it is necessary to design a real-time baby sound detection method that is more accurate, can automatically adapt to available computing resources, and can be flexibly scheduled in the context of the Internet of Things (IoT). Summary of the Invention
[0004] In order to at least partially solve one of the technical problems existing in the prior art, an object of the present invention is to provide a method, device and storage medium for detecting baby sounds.
[0005] The technical solution adopted in the present invention is:
[0006] A method for detecting infant sounds comprises the following steps:
[0007] Get the audio clip;
[0008] Buffering the audio clip according to the current load of computing resources to obtain a cached audio clip;
[0009] Perform crying detection based on the cached audio clip, and save the detection result to a detection queue;
[0010] Voting is performed based on multiple test results in the test queue to obtain the final test result.
[0011] Furthermore, obtaining the audio clip includes:
[0012] Use the driver to read the audio clip from the microphone device;
[0013] Wherein, the driver is deployed in the Linux operating system.
[0014] Furthermore, the method of using a driver to read an audio clip from a microphone device includes:
[0015] Call the ALSA driver interface of the Linux operating system to initialize the microphone device;
[0016] Get the timestamp of the sound card hardware from ALSA and read the audio waveform data;
[0017] The audio waveform data, timestamp, and sampling rate are packaged through the message queue to obtain the audio clip.
[0018] Furthermore, the buffering of the audio clip to obtain the cached audio clip according to the current load of the computing resources includes:
[0019] Read audio messages from the message queue;
[0020] Compare the timestamp of the read audio message with the current time. If the time difference exceeds the preset threshold, it is determined that the current detection delay is too high and all unprocessed data packets with timestamps before n seconds are discarded; where n is the preset detection window length;
[0021] Determine whether the current audio clip is continuous with the previously buffered content based on the timestamp. If not, clear the buffer and detection queue.
[0022] Add the audio waveform data in the current audio message to the buffer;
[0023] When the audio waveform data in the buffer reaches or exceeds n seconds, the audio waveform data in the buffer are spliced as a cached audio segment.
[0024] Furthermore, the performing crying detection based on the cached audio clip includes:
[0025] Extracting features from the cached audio clips, performing classification and recognition based on the extracted features and a preset support vector machine to obtain a recognition result;
[0026] The support vector machine is obtained in the following way:
[0027] Obtain a data set, resample the data set, and perform feature extraction; the extracted features include Mel-frequency cepstral coefficients, spectrum roll-off points, spectrum centroid, zero-crossing rate, spectrum bandwidth, and root mean square energy;
[0028] The support vector machine is obtained by fitting the extracted features.
[0029] Furthermore, the spectrum centroid is defined as follows:
[0030] C=Σ k S k f k / Σ k S k
[0031] The spectrum bandwidth is the second-order spectrum bandwidth, defined as follows:
[0032]
[0033] Among them, S k represents the spectrum of the kth window, f k Indicates the frequency corresponding to the kth data point in the spectrum.
[0034] Furthermore, the voting process is performed based on multiple test results in the test queue to obtain the final test result, including:
[0035] When the number of detection results stored in the detection queue reaches or exceeds m times, and more than half of the detection results in the latest m times are the same, the detection result is used as the final detection result; where m is the preset filter window size.
[0036] Furthermore, taking the test result as the final test result includes:
[0037] If the detection result shows that the baby is crying, the preset alarm message is triggered.
[0038] Another technical solution adopted in the present invention is:
[0039] A baby sound detection device, comprising:
[0040] at least one processor;
[0041] at least one memory for storing at least one program;
[0042] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.
[0043] Another technical solution adopted in the present invention is:
[0044] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to perform the method described above when executed by the processor.
[0045] The beneficial effect of the present invention is that the present invention can improve the accuracy of detection by taking into account the load of current computing resources and performing buffering processing on audio data.
[0046] In addition, based on the message queue and detection queue, the part that reads audio data and the recognition part are deployed in two containers respectively during deployment, making the deployment highly modular and more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following introduction is made to the drawings of the embodiments of the present invention or the related technical solutions in the prior art. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative work.
[0048] Figure 1 This is a flowchart of the steps of a dynamic infant crying detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and are not to be construed as limiting the present invention. The step numbers in the following embodiments are provided for ease of explanation only and do not limit the order of the steps. The order of execution of the steps in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0050] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on the present invention.
[0051] In the description of the present invention, "several" means one or more, "many" means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. The use of "first" and "second" in the description is solely for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, implicitly specifying the number of the indicated technical features, or implicitly specifying the order of the indicated technical features.
[0052] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, and connecting should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0053] like Figure 1 As shown, this embodiment provides a dynamic baby crying detection method. First, an audio clip is read from the device driver and placed in a buffer. At the same time, the buffer content is adaptively managed according to the current computing resource load, so as to ensure the real-time detection of the audio. Then, a multi-feature crying detection algorithm is used to detect the cached audio clip within a sliding window of 5 seconds in length in the form of a sliding window, and the detection results are saved in a queue. Finally, the five most recent detection results in the queue are counted and voted. If more than half of the results are crying, a predefined alarm is triggered. This method can effectively reduce the false alarm rate of the device and improve fault tolerance, thereby improving the stability and accuracy of the detection.
[0054] This method can be combined with a standard microphone driver and deployed on a device running the Linux operating system. During deployment, the audio data reading part and the recognition part are deployed in two containers respectively. Thanks to containerization technology and the related ecosystem, the deployment of the embodiment of the present invention is highly modular and flexible, enabling efficient collaboration between the cloud and the terminal, as well as between different terminals. Specifically,
[0055] 1. The hardware-related audio reading portion is independent and can flexibly adapt to the audio acquisition environment. For example, it can be read from a file when debugging a program; targeted adjustments can be made based on the hardware used to improve the hardware adaptability range; and even algorithms such as noise reduction and directional audio acquisition can be added between the hardware and the recognition algorithm. All of these operations do not require any adjustments to the container of the subsequent recognition algorithm. This solution also supports the simultaneous use of collected audio by multiple different algorithms in complex applications, avoiding the problem of hardware exclusive access, and can also support direct audio reading from remote devices.
[0056] 2. The crying detection module is independent and not restricted by specific hardware. This greatly facilitates algorithm development, debugging, and iterative improvement. Depending on the application scenario, crying detection can be deployed on a separate terminal from the audio capture module. For example, deployment on dedicated edge computing equipment can reduce the cost of the audio capture terminal.
[0057] 3. Combined with container orchestration tools such as KubeEdge, this solution can leverage mature Kubernetes-related management tools to dynamically update containers while the system is running, offering high scalability.
[0058] 4. Combined with network virtualization, this technology can build a seamlessly connected IoT, unconstrained by physical network topology. For example, algorithms running on remote servers can read audio captured by devices in real time. Crying detection results can trigger push notifications that rely on remote services. Crying detection results can also be used to control actuators like smart cribs or provide insights for other intelligent algorithms.
[0059] In general, existing infant crying detection methods fail to consider adaptive real-time performance in situations where potential computing resource contention exists. Embodiments of the present invention operate optimally when computing resources are abundant. When computing resources are limited, they exploit the fact that infant cries requiring guardian attention typically last for extended periods of time. By controlledly discarding data that cannot be processed in time, they maximize real-time detection and enable timely detection and alerting of infant crying. Embodiments of the present invention can automatically adapt to available computing resources without human intervention.
[0060] Most existing baby crying detection methods either use deep learning to automatically extract features, or use simple and single features (such as volume, spectrum). The training and deployment process of solutions using deep learning methods is more complex and difficult, with poor interpretability and high computational cost requirements, making it difficult to achieve real-time detection on resource-constrained edge devices. Using a simple single feature for detection results in poor detection performance, low accuracy, and is prone to false positives and missed detections. The embodiment of the present invention is based on a variety of manually designed efficient and robust audio features and uses traditional support vector machines to achieve efficient and accurate detection. Compared with deep neural networks, it is simpler in training and deployment, and has better interpretability; compared with single-feature methods, it has higher accuracy and better stability.
[0061] In this embodiment of the present invention, the audio driver interaction and detection algorithm modules are independent and communicate via message queues. This allows the audio driver to be implemented in low-level languages like C, while the algorithm module can be implemented in high-level languages like Python, improving development efficiency. Furthermore, the detection method can be decoupled from the specific microphone hardware, allowing it to be deployed using containerization technologies like Docker, simplifying the deployment process.
[0062] The embodiment of the present invention is deployed using a containerized solution, which can be combined with container software ecosystems such as KubeEdge to achieve flexible scheduling and expansion, and can be combined with network virtualization to achieve flexible communication.
[0063] The above method is explained in detail below with reference to specific embodiments.
[0064] like Figure 1 As shown, this embodiment provides a dynamic infant crying detection method, which specifically includes the following steps:
[0065] S1: Reads an audio clip from the microphone device driver.
[0066] S1-1: Call the ALSA driver interface of the Linux operating system, initialize the microphone device, and set acquisition parameters such as sampling rate.
[0067] ALSA, short for Advanced Linux Sound Architecture, is the audio architecture in the Linux operating system. It is used for common audio operations such as recording and playing audio. Existing sound card devices have ALSA support, and most applications use it to interact with audio hardware.
[0068] The embodiment of the present invention uses ALSA's recording function through ALSA's official user space alsa-lib function library. When in use, the microphone device must first be initialized with specified parameters. The hardware parameters mainly include: the data format is a little-endian 16-bit integer, the number of channels is 1, the sampling rate is 48000Hz, and other approximate sampling rates can be selected as needed, and automatic resampling is disabled; the software parameters mainly include: enabling timestamps, and the timestamp type is GETTIMEOFDAY. Finally, the snd_pcm_prepare function is called to complete the initialization process. The sampling rate represents the number of times the microphone hardware completes signal sampling per second in the process of converting the analog signal of the mechanical wave of sound into a digital signal.
[0069] S1-2: Get the sound card hardware timestamp from ALSA. The snd_pcm_htimestamp function retrieves the number of audio samples currently in the hardware queue and the timestamp recorded by the hardware at that moment. The timestamp of the first unprocessed sample in the hardware queue can be calculated using the sampling rate.
[0070] S1-3: Read audio waveform data segments from ALSA. These are the raw samples of the mechanical sound waves sampled by the sound card. The snd_pcm_readi function reads a specified number of samples from the hardware queue, waiting if the number of samples is insufficient. This embodiment reads 1024 samples at a time, converting to approximately 20ms of audio waveform data at the sampling rate. Calling snd_pcm_recover mitigates exceptions such as hardware queue overflows caused by insufficient software speed. Subsequent processing can determine whether data has been lost based on the timestamp.
[0071] S1-4: Use a message queue (such as ZeroMQ) to package the waveform data and metadata such as timestamp, sampling rate, and number of channels and send them to subsequent processing processes. Return to S1-2 and the cycle continues.
[0072] S2: Buffers audio segments and manages buffer content based on load.
[0073] S2-1: Read messages from the message queue.
[0074] S2-2: Compare the timestamp of the currently read message with the current time. If the time difference exceeds a preset threshold, the detection latency is too high, and all unprocessed packets with timestamps older than n seconds are discarded. n is the pre-specified detection window length. A longer window improves detection accuracy, but also increases the algorithm's computational complexity and latency. In this example, n is set to 5 seconds.
[0075] S2-3: Determine whether the current audio segment is continuous with the previously buffered content based on the timestamp. If not, clear the buffer and the detection result queue (i.e., the detection queue). This discontinuity may be caused by the active discard of data packets in the previous step, or by an overflow in the microphone hardware's buffer queue or message queue.
[0076] S2-4: Add the audio waveform data in the current message to the buffer.
[0077] S2-5: When the audio waveform data in the buffer reaches or exceeds n seconds, these data are spliced and sent to crying detection.
[0078] S3: Multi-feature crying detection.
[0079] S3-1: Before system deployment, a dataset consisting of audio of crying babies and random ambient sounds was collected. The audio was segmented and resampled, and features such as Mel-frequency cepstral coefficients, spectral roll-off points, spectral centroid, zero-crossing rate, spectral bandwidth, and RMS energy were extracted. A support vector machine was fitted with these features. Among them:
[0080] 1) The zero-crossing rate is the ratio of the number of times a waveform crosses zero to the total number of samples. It is calculated using a sliding window with a window size of 2048 samples and a step size of 512 samples.
[0081] 2) The root mean square energy represents the square root of the mean of the square of the vibration amplitude at each sampling point, and is calculated using a sliding window with a window size of 2048 samples and a step size of 512 samples.
[0082] 3) Mel-frequency cepstral coefficients (MFCC) represent the first 13 coefficients of the logarithmic Mel power spectrum after DCT.
[0083] 4) The spectrum centroid is defined as C = ∑ k S k f k / ∑ k S k , where S represents the spectrum of the current window, f represents the frequency corresponding to each data point of the spectrum, in Hz, and the spectrum centroid is calculated using a sliding window with a window size of 2048 samples and a step size of 512 samples.
[0084] 5) The spectrum roll-off point indicates that 90% of the energy is distributed at this frequency and below, and is calculated using a sliding window with a window size of 2048 samples and a step size of 512 samples.
[0085] 6) Spectral bandwidth represents the second-order spectrum bandwidth, defined as The calculation is performed using a sliding window with a window size of 2048 samples and a step size of 512 samples.
[0086] S3-2: During runtime, it receives the n-second audio clip output by S2, performs resampling (if the sampling rate is different from that during training), extracts features, and performs classification using the support vector machine fitted in the previous step.
[0087] This method, based on mel-spectrograms and other methods, further extracts more robust features. It is more robust than simpler circuits or methods based solely on mel-spectrograms, and is more adaptable to complex practical applications. Compared with deep learning-based methods, it is simpler to train and deploy, requires less computing power, and helps reduce application costs.
[0088] S4: Sliding window filtering.
[0089] When the program is started, or after the detection result queue is cleared in the aforementioned S2, the detection result queue is empty.
[0090] S4-1: Save the detection result currently output by S3 to the detection result queue.
[0091] S4-2: If, after adding this test result, there are m test results in the queue, and more than half of the most recent m results are crying, a predefined alarm action is triggered. m is the predefined filter window size. A larger filter window allows the algorithm to tolerate more noise, but also increases detection latency and may incorrectly filter out shorter crying sounds. In this embodiment, m = 5. The oldest test in the test result queue is discarded, and the more recent m-1 tests are retained.
[0092] S4-3: Discard the oldest 1 second of data in the audio buffer, retain the newer n-1 seconds, and return to S2 to repeat.
[0093] This method achieves a sliding window with a step size of 1 second and a window size of n+m-1 seconds, which acts as a median filter to filter out short-term interference signals. It also adapts to S2's automatic data discarding based on load, ensuring the quality of the final crying detection results.
[0094] S5: Trigger an alarm.
[0095] If the baby is determined to be crying, a predefined alarm action is triggered. Options include: displaying an alarm message on the terminal; connecting to a remote server to send a push message to the guardian's smartphone; playing music to automatically soothe the baby, etc.
[0096] In summary, this embodiment has the following advantages and beneficial effects compared to the prior art:
[0097] (1) The embodiments of the present invention can automatically adapt to available computing resources, enabling real-time and accurate detection of infant crying even under resource constraints, providing the best possible user experience. When computing resources are insufficient, data can be automatically discarded, ensuring accurate detection while still providing users with the lowest possible latency for crying detection.
[0098] (2) The embodiment of the present invention integrates multiple manually designed robust audio features and combines them with a support vector machine with a sliding window filtering mechanism for classification detection, which has higher stability and accuracy while maintaining simple real-time detection.
[0099] (3) The various parts of the embodiment of the present invention are highly modular, which brings convenience to development and deployment and has high scalability. The audio data acquisition part and the crying detection algorithm part can be developed using different programming languages, run in different processes, and use message queues for communication. In the future, the audio data can be provided to other algorithms for use at the same time, and can also be transmitted to the cloud or other terminals for analysis and use in real time through the network. If necessary, a new audio data acquisition part can be written, and the algorithm part does not need to be changed. For example, a module that reads data from an audio file can be used during development and debugging.
[0100] (4) The embodiments of the present invention, combined with the container software ecosystem and network virtualization, can achieve flexible and convenient software upgrades and expansions, flexible hardware configuration, and flexible allocation of computing resources. They can also conveniently collaborate with other intelligent algorithms, other terminals, actuators, cloud services, etc.
[0101] This embodiment further provides a baby sound detection device, comprising:
[0102] at least one processor;
[0103] at least one memory for storing at least one program;
[0104] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 1 The method shown.
[0105] An infant sound detection device of this embodiment can execute an infant sound detection method provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.
[0106] The present application also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs Figure 1 The method shown.
[0107] This embodiment also provides a storage medium storing instructions or programs that can execute a method for detecting infant sounds provided by an embodiment of the method of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be achieved.
[0108] In some optional embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided in an exemplary manner for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented herein. Optional embodiments are contemplated in which the order of the various operations is changed and the sub-operations described as a part of a larger operation are performed independently.
[0109] Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise indicated, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It will also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the ordinary skill of an engineer. Therefore, a person skilled in the art using ordinary skill will be able to implement the present invention set forth in the claims without undue experimentation. It will also be understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0110] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0111] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0112] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0113] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0114] In the above description of this specification, reference to the terms "one embodiment / example," "another embodiment / example," or "certain embodiments / examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0115] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
[0116] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A method for detecting baby sounds, characterized in that: The following steps are involved: Get the audio clip; Buffering the audio clip according to the current load of computing resources to obtain a cached audio clip; Perform crying detection based on the cached audio clip, and save the detection result to a detection queue; Voting is performed based on multiple test results in the test queue to obtain the final test result; The step of obtaining the audio clip includes: Use the driver to read the audio clip from the microphone device; Wherein, the driver is deployed in the Linux operating system; The driver is used to read audio clips from the microphone device, including: Call the ALSA driver interface of the Linux operating system to initialize the microphone device; Get the timestamp of the sound card hardware from ALSA and read the audio waveform data; The audio waveform data, timestamp, and sampling rate are packaged through the message queue to obtain the audio clip; The step of buffering the audio clip according to the current load of the computing resources to obtain the cached audio clip includes: Read audio messages from the message queue; Compare the timestamp of the read audio message with the current time. If the time difference exceeds the preset threshold, it is determined that the current detection delay is too high and all unprocessed data packets with timestamps before n seconds are discarded; where n is the preset detection window length; Determine whether the current audio clip is continuous with the previously buffered content based on the timestamp. If not, clear the buffer and detection queue. Add the audio waveform data in the current audio message to the buffer; When the audio waveform data in the buffer reaches or exceeds n seconds, the audio waveform data in the buffer are spliced as a cached audio segment.
2. A method for detecting baby sounds according to claim 1, characterized in that: The performing crying detection according to the cached audio clip includes: Extract features from the cached audio clips, and perform classification and recognition based on the extracted features and a preset support vector machine. Obtain recognition results; The support vector machine is obtained in the following way: Obtain a data set, resample the data set, and perform feature extraction; the extracted features include Mel-frequency cepstral coefficients, spectrum roll-off points, spectrum centroid, zero-crossing rate, spectrum bandwidth, and root mean square energy; The support vector machine is obtained by fitting the extracted features.
3. A method for detecting baby sounds according to claim 2, characterized in that: The spectrum centroid is defined as follows: C=∑ k S k f k / ∑ k S k The spectrum bandwidth is the second-order spectrum bandwidth, defined as follows: Among them, S k represents the spectrum of the kth window, f k Indicates the frequency corresponding to the kth data point in the spectrum.
4. The method for detecting infant sounds according to claim 1, wherein: The voting process based on multiple test results in the test queue to obtain the final test result includes: When the number of detection results stored in the detection queue reaches or exceeds m times, and more than half of the detection results in the latest m times are the same, the detection result is used as the final detection result; where m is the preset filter window size.
5. The method for detecting baby sounds according to claim 4, wherein: The method of taking the test result as the final test result includes: If the detection result shows that the baby is crying, the preset alarm message is triggered.
6. A baby sound detection device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 5.
7. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 5 when executed by the processor.
Citation Information
Patent Citations
Infant cry recognition method, device and equipment
CN109658953A
Baby cry detecting method and device, and computer readable storage medium
CN110322898A
Infant monitoring method and apparatus, camera device and storage medium
CN110706449A
Real-time voice stream slice analysis method and system and computer equipment
CN115242735A
Cloud side-end cooperative intelligent baby nursing system and method
CN115715671A