Intelligent bark stopping method and device and computer readable storage medium
By using preset pet barking models and signal processing technology on the embedded terminal of the barking device, the accurate identification and punishment of dog barking is achieved, the problems of misjudgment and overreaction of existing devices are solved, and the accuracy and safety of the system are improved.
Patent Information
- Application Number
- CN202410416710.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2044-04-08
AI Technical Summary
The existing barking device cannot accurately identify the real dog barking, which can easily cause misjudgment and overreaction, endangering the safety of pets.
Using embedded terminals and preset pet barking models, the machine learning model is optimized through sound acquisition and signal processing technology to accurately identify dog barking, and trigger the punishment module after the dog barking is recognized.
Achieve high-accuracy dog barking recognition on resource-constrained embedded microcontroller systems, reduce misjudgment and punishment, avoid pet overreaction, reduce system costs, and improve feasibility and popularity.
Smart Images

Figure CN120036250A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of anti-barking devices, and particularly to an intelligent anti-barking method, device and computer-readable storage medium. Background Art
[0002] With the common occurrence of keeping pet dogs in urban communities, the frequent or prolonged barking of pet dogs has increasingly become a major problem affecting people's daily routines. Currently, anti-barking devices worn on pets have emerged on the market, which calm barking by performing disciplinary actions. However, existing anti-barking devices all identify pet barks, that is, they simply judge based on the presence of sound or the loudness of the sound; moreover, this traditional sound recognition system often fails to truly identify whether it is a real dog bark, and can only simply judge whether there is a high-decibel sound, thus extremely easily causing misjudgment of the machine and executing wrong punishments, which in turn causes an overreaction of the pet and endangers the safety of the pet. Summary of the Invention
[0003] To overcome the deficiencies of the prior art, embodiments of the present invention provide an intelligent anti-barking method, device and computer-readable storage medium.
[0004] An intelligent anti-barking method runs in an embedded terminal worn on a pet. Among them, a preset pet barking model is built in the embedded terminal; a disciplinary module is also provided on the embedded terminal, and the disciplinary module is used to stimulate the pet and make it stop barking; the intelligent anti-barking method includes the steps of:
[0005] S1, Sound collection, obtaining the sound decibel value of the ambient noise around the pet;
[0006] S2, Model comparison. If the sound decibel value is greater than a preset decibel value, compare the collected sound with the pet barking model and output a comparison result;
[0007] S3, Outputting discipline. If the comparison result is greater than a preset discipline value, trigger the disciplinary module.
[0008] An intelligent anti-barking device includes the embedded terminal used in the intelligent anti-barking method as described above; the embedded terminal includes:
[0009] A sound collection and detection module, which is used to collect the ambient noise around the pet and input it to the intelligent anti-barking model for comparison after ADC conversion;
[0010] A disciplinary module, which includes any one or more of an electric shock module, a vibration module, and a sound stimulation module;
[0011] Power module, the power module includes a charging circuit and a voltage stabilizing circuit; the charging circuit is used to charge the lithium battery inside the embedded terminal, and the voltage stabilizing circuit is used to provide a regulated voltage for the embedded terminal;
[0012] Display module, the display module is used to display the working state of the embedded terminal;
[0013] Button module, the button module includes a power button, a mode button and an intensity button; the power button is used to control the power on and off of the embedded terminal; the mode button is used to select the current punishment module; the intensity button is used to control the intensity level of the punishment module.
[0014] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned intelligent barking prevention method are realized.
[0015] The above-mentioned intelligent barking prevention method, device and computer-readable storage medium provide a technical solution for accurately identifying dog barks on an embedded microcontroller system with limited resources through an optimized machine learning model and signal processing technology. Compared with the prior art, it can identify real dog barks in a non-single dog bark scenario, can identify whether it is the bark of a dog wearing this intelligent barking prevention device, can assist in analyzing whether there is a dog bark by analyzing the current environmental noise volume, reduce misjudgment and punishment caused by inaccurate identification, and avoid causing excessive reactions of pets; in addition, this device reduces the dependence on powerful computing resources, reduces the overall system cost, improves the feasibility and popularity in practical applications, and truly breaks away from the connection between the PC side or the cloud and the embedded microcontroller system, realizing the stand-alone operation of the data model. Description of the Drawings
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0017] Figure 1 It is a framework diagram of the intelligent barking prevention method and device in an embodiment of the present invention. Detailed Embodiments
[0018] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0019] In one embodiment, as Figure 1 shown, an intelligent anti-barking method and an intelligent anti-barking device are provided. The intelligent anti-barking device includes an embedded terminal worn on a pet, and a PC side or a cloud side for making an intelligent barking model. Among them, the intelligent anti-barking method runs on the embedded terminal, that is, in the embedded single-chip microcomputer system.
[0020] Specifically, the embedded single-chip microcomputer system adopts ARM Cortex-M and includes:
[0021] Sound acquisition module: The sound from the outside world is collected and after ADC conversion, it is fed to the in8 model for inference and comparison.
[0022] Wearing detection module: Detect whether this device is worn on the neck of the pet dog. If it is correctly worn, send a Y signal; if it is not correctly worn, send an N signal.
[0023] Sound detection module: Detect the volume of the environmental noise. The judgment threshold is 65DB (i.e., the preset decibel value). When it is greater than 65DB, send a Y signal for the next step of outputting punishment; when it is less than 65DB, send an N signal.
[0024] Display module: Display the current working state, such as power on, power off, current mode, etc.
[0025] Power supply module: It consists of a charging circuit and a voltage stabilizing circuit, which are used to charge the internal lithium battery of the device and provide a stabilized voltage for the entire system of the device to work.
[0026] Punishment module: Used to stimulate the pet and make it stop barking. It includes any one or more of an electric shock module, a vibration module, and a sound stimulation module. Among them, the electric shock module is used to generate an electrostatic shock after receiving a driving instruction; the vibration module is used to generate a vibration prompt after receiving a driving instruction; the sound stimulation module is used to generate a sound or ultrasonic prompt after receiving a driving instruction, and its frequency range is 1.25KHZ - 30KHZ.
[0027] Button module: It includes a power button, a mode button, and an intensity button, which are used to control the power on and off of the device, the working mode (i.e., the punishment method output), and the intensity level in this mode respectively.
[0028] The intelligent anti-barking method mainly includes the following processes:
[0029] S1, Sound collection, to obtain the sound decibel value of the ambient noise around the pet;
[0030] S2, Model comparison, if the sound decibel value is greater than the preset decibel value, such as 65 DB, then compare the collected sound with the pet barking model and output the comparison result;
[0031] S3, Output punishment, if the comparison result is greater than the preset punishment value, then trigger the punishment module.
[0032] Specifically, the working process of the embedded terminal is as follows:
[0033] When the button corresponding to the power supply in the button module is pressed, the power-on instruction is transmitted to the power supply module to start the system regulated power supply, and the regulated voltage is 3.3V; when the regulated 3.3V flows through and powers on the ARM Cortex-M, the ARM Cortex-M initializes and starts up, completing the power-on action; when the power button is pressed again, a shutdown instruction will be sent to the ARM Cortex-M, and the ARM Cortex-M will send a shutdown instruction to the power supply module to turn off the power of the entire system.
[0034] When the device is powered on normally, the wearing detection module automatically detects whether the device is worn around the pet's neck. If it is worn correctly, a working instruction will be sent to the ARM Cortex-M, and then the power switch will be turned on to power on the sound collection and detection module to start working; if it is not worn correctly, a shutdown instruction will be sent to the ARM Cortex-M, and the entire machine will be powered off after 30 seconds by default, where the default shutdown time can be flexibly set in advance.
[0035] The mode button of the button module is used to adjust the working mode of the device to the sound stimulation mode, or the vibration mode, or the electric shock mode, and the working level intensity of the above three modules can be set through the intensity button in the button module. At the same time, the current working mode, working level intensity, battery information, etc. can be displayed through the display module, which is convenient for more intuitively understanding the current working state of the device and making corresponding adjustments in a timely manner.
[0036] When the sound collection and detection module is in the working state, when there is a dog barking sound in the outside world, it will detect whether the current sound decibel value is greater than 65 DB. If it is greater than 65 DB, an instruction will be sent to the ARM Cortex-M, and the ARM Cortex-M module will compare the input sound signal with the preset intelligent barking model and output the comparison result. Compare the comparison result with the preset punishment value to trigger the punishment module. Among them, the preset punishment value is 0.9. When the comparison result is greater than or equal to 0.9, it is recognized as a dog barking sound. At this time, according to the current working mode setting, a corresponding trigger instruction is output to the three warning modules to execute corresponding warnings or punishments:
[0037] 1) When the comparison result ≥ 0.9, ARM Cortex-M sends a trigger sound warning instruction to the sound stimulation module to execute a beeping alarm, and the alarm sound frequency will increase as the number of triggers increases, with the frequency range being 1.25K - 30KHZ; the execution intensity is carried out according to the settings after the system is powered on.
[0038] 2) When the comparison result ≥ 0.9, ARM Cortex-M sends a trigger vibration warning instruction to the vibration module to execute a vibration alarm, and the execution intensity is carried out according to the settings after the system is powered on.
[0039] 3) When the comparison result ≥ 0.9, ARM Cortex-M sends a trigger electric shock warning instruction to the electric shock module to execute an electrostatic pulse shock punishment, and the execution intensity is carried out according to the settings after the system is powered on.
[0040] 4) When the comparison result < 0.9, ARM Cortex-M does not perform any action and will continue to analyze and calculate the next sound electrical signal and output the comparison result.
[0041] The intelligent barking prevention device also includes a PC terminal or a cloud, and the PC terminal or the cloud is used to make a pet barking model, specifically including the steps:
[0042] S01, Audio acquisition: Use a high-definition recording device to record the audio of various dog barks and the background sound audio in various scenarios.
[0043] S02, Data preprocessing: Clip the collected dog barks and background sound audio for 1 second, denoise, compress the dynamic range, convert them into WAV format with a sampling rate of 16Khz, label the dog barks as dog and the noise as noise, and classify the data into a training set, a validation set, and a test set.
[0044] S03, Feature extraction: Use Mel Frequency Energy (MFE for short) as a feature to extract the features of the sound signal. Since the audio for feature extraction is dog barks, using MFE is particularly suitable for feature extraction of non-human speech, making MFE more conducive to deploying the subsequent intelligent barking model to an embedded single-chip microcomputer system for real-time recognition in some real-time calculations or resource-constrained applications.
[0045] S04. Model training: Build a convolutional neural network through Keras, and use TensorFlow to train the data after feature extraction to obtain a pet barking model. Specifically, first build a model, a CNN model; then use the training data labeled with "dog" and "noise" to train the model. At the same time, use the validation data to monitor the performance during the training process to avoid overfitting.
[0046] S05. Model evaluation: Use the test set to evaluate the model performance and understand the performance of the model on new unseen data. According to the performance of the model, layers can be added or removed, and parameters such as the number of neurons can be adjusted to obtain an optimal model.
[0047] S06. Result output: Establish a visual result output for the prediction of new data. The visual result output includes table and distribution map forms, and has a byte output format with a numerical range between 0.0000 - 1. For example, after inputting a sample, if the result after sound comparison is 1 (greater than 0.9, 0.9 is an approximate value of the visual result output), it is determined as a dog bark.
[0048] Furthermore, in the S03 feature extraction stage, the feature extraction process is as follows:
[0049] S031. Pre-emphasis: Improve the signal strength of the high-frequency part through the following formula: y(n) = x(n) - ax(n - 1), where x(n) is the original signal, y(n) is the pre-emphasized signal, and α is the pre-emphasis coefficient, greater than or equal to 0.9.
[0050] S032. Frame division and window function: Divide the pre-emphasized signal into frames and apply a window function, such as a Hamming window, to each frame to reduce signal discontinuity at the frame boundaries.
[0051] S033. Fast Fourier transform: Apply the fast Fourier transform (FFT) to each frame to obtain the spectrum of the signal. Apply FFT to each frame of the signal x(n) to obtain the spectrum X(k), where k is the frequency index.
[0052] S034. Mel filter bank: Apply a set of Mel filter banks to the FFT result. Each filter is mapped to a specific frequency region on the Mel scale to simulate the auditory characteristics of the human ear; each filter covers a specific frequency range; the relationship between the Mel frequency fmel and the actual frequency f is expressed by the following formula:
[0053]
[0054] S035, Energy calculation, calculates the energy output by each Mel filter. MFE directly uses these energy values as features without further logarithmic transformation or discrete cosine transform (DCT). The output energy Em of each filter is calculated by computing the sum of the squares of the filter outputs, with the formula as follows:
[0055] E m =∑ k X(k)·H m (k) 2
[0056] where Em is the output energy of the m-th filter, X(k) is the spectrum obtained by fast Fourier transform, Hm(k) is the frequency response of the m-th Mel filter, and the summation is performed over all frequencies k covered by the filter.
[0057] Further, after obtaining the intelligent barking model, it also includes the process of compressing, converting, and deploying the model to an embedded terminal, specifically including:
[0058] S07, Model compression and conversion, performs quantization processing on the pet barking model, compresses and converts the pet barking model into a dataset running on an embedded terminal; where quantization is a technique for reducing the model size, achieved by reducing the precision of the numerical values in the model, thereby making the model more suitable for running on a resource-constrained embedded microcontroller system. For example, converting a TensorFlow model to a TensorFlow Lite model.
[0059] S08, Model deployment, converts the dataset into a C language array format and downloads it to the embedded terminal. That is, in order to be able to use the converted in8 model on an embedded microcontroller system, the model file also needs to be converted into a C array format. For example, using the xxd tool of TensorFlow Lite Micro; including the converted C array into the embedded microcontroller system code so that the model data can be directly accessed.
[0060] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the intelligent barking prevention method in the above method embodiment. To avoid repetition, it will not be elaborated here.
[0061] The intelligent barking prevention method, device, and computer-readable storage medium provided by the present invention, through an optimized machine learning model and signal processing technology, enable high-accuracy dog barking recognition to be achieved on a resource-constrained embedded microcontroller system; at the same time, reduce the dependence on powerful computing resources, lower the system cost; truly break away from the connection between the PC side or cloud and the embedded microcontroller system, and achieve the single-machine operation of the data model, improving the feasibility and popularity in practical applications.
[0062] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. An intelligent barking control method, characterized in that: The intelligent barking control method is run in an embedded terminal worn on a pet, wherein a preset pet barking model is built in the embedded terminal; a punishment module is also provided on the embedded terminal, and the punishment module is used to stimulate the pet and make it stop barking; the intelligent barking control method comprises the steps of: S1, sound collection, obtaining the decibel value of the ambient noise around the pet; S2, model comparison, if the decibel value of the sound is greater than the preset decibel value, the collected sound is compared with the pet barking model and the comparison result is output; S3, outputting a punishment. If the comparison result is greater than a preset punishment value, the punishment module is triggered.
2. The intelligent barking control method according to claim 1, characterized in that: The punishment module includes any one or more of an electric shock module, a vibration module, and a sound stimulation module; the electric shock module is used to generate an electrostatic shock after receiving a driving instruction; the vibration module is used to generate a vibration prompt after receiving a driving instruction; the sound module is used to generate a sound or ultrasonic prompt after receiving a driving instruction, and the frequency range generated by the sound stimulation module is 1.25KHZ-30KHZ.
3. The intelligent barking control method according to claim 1 or 2, characterized in that: Prior to S1, it also included: S0, wearing detection, performs automatic detection after the embedded terminal is turned on. If it is detected that the embedded terminal is worn on the pet, enter S1; if it is not detected that the embedded terminal is correctly worn on the pet, it automatically shuts down after a predetermined time.
4. An intelligent barking control device, characterized in that: The method comprises an embedded terminal used in the intelligent barking control method according to any one of claims 1 to 3; the embedded terminal comprises: A sound collection and detection module, which is used to collect ambient noise around the pet and input it into the intelligent barking control model for comparison after ADC conversion; A punishment module, wherein the punishment module includes any one or more of an electric shock module, a vibration module, and a sound stimulation module; A power module, the power module comprising a charging circuit and a voltage stabilizing circuit; the charging circuit is used to charge the lithium battery inside the embedded terminal, and the voltage stabilizing circuit is used to provide a regulated voltage to the embedded terminal; A display module, the display module is used to display the working status of the embedded terminal; A button module, the button module includes a power button, a mode button and a strength button; the power button is used to control the power on and off of the embedded terminal; the mode button is used to select the current punishment module; the strength button is used to control the strength level of the punishment module.
5. The intelligent barking control device as claimed in claim 4, characterized in that: The embedded terminal also includes: The wearing detection module is used to detect whether the intelligent anti-barking device is correctly worn on the neck of the pet.
6. The intelligent barking control device as claimed in claim 4, characterized in that: It also includes a PC or a cloud end, and the PC or the cloud end is used to make the pet barking model, and making the pet barking model includes the steps of: S01, audio collection, using high-definition recording equipment to record the barking sounds of various dogs and various background sounds; S02, data preprocessing, long-cutting, noise reduction and dynamic range compression of the barking sound and background sound with a preset duration, and converting them into a WAV format file with a preset sampling rate; The barking sounds and background sounds are classified into different sound labels and classified into a training set, a validation set and a test set; S03, feature extraction, performing feature extraction on the data after the data preprocessing by using Mel frequency energy; S04, model training, building a convolutional neural network through Keras, and using TensorFlow to train the data after the feature extraction to obtain the pet barking model; S05, model evaluation, using the test set to evaluate the performance of the pet barking model, obtaining the performance of the pet barking model on new unseen data, adding layers to or deleting layers from the pet barking model, and adjusting parameters of the pet barking model; S06, result output, for each input sample, establish a visual result output.
7. The intelligent barking control device as claimed in claim 6, characterized in that: After S04, it also includes: S07, model compression and conversion, quantizing the pet barking model, compressing the pet barking model and converting it into a data set running on the embedded terminal; S08, model deployment, converting the data set into a C language array format and downloading it to the embedded terminal.
8. The intelligent barking control device as claimed in claim 6, characterized in that: The feature extraction further includes: S031, pre-emphasis, improves the signal strength of the high frequency part through the following formula: y(n)=x(n)-ax(n-1) Where x(n) is the original signal, y(n) is the pre-emphasized signal, and α is the pre-emphasis coefficient, which is greater than or equal to 0.9; S032, framing and window function: framing the pre-emphasized signal, and applying a window function to each frame; S033, fast Fourier transform, applying fast Fourier transform to each frame to obtain the spectrum of the signal, and for each frame of the signal x(n), obtaining the spectrum X(k), where k is the frequency index; S034, Mel filter bank, applies a set of Mel filter banks to the fast Fourier transform result, each filter is mapped to a specific frequency region on the Mel scale; each filter covers a specific frequency range; the relationship between the Mel frequency fmel and the actual frequency f is expressed by the following formula: S035, energy calculation, calculate the energy of each Mel filter output. The output energy Em of each filter is calculated by summing the squares of the filter outputs. The formula is as follows: E m =∑ k X(k)·H m (k) 2 Where Em is the output energy of the mth filter, X(k) is the spectrum obtained by fast Fourier transform, Hm(k) is the frequency response of the mth Mel filter, and the summation is performed over all frequencies k covered by the filter.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the intelligent barking control method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Intelligent bark stopping method and device
CN107960342A
Pet bark stopping device and method based on convolutional neural network
CN108157219A
Barking stopper control device with noise reduction function and method thereof
CN115777567A
Animal training device and control method
US20210219524A1