Knock detection method and device, electronic equipment and computer program
By using an accelerometer to collect acceleration signals, combined with usage scenario recognition and feature signal extraction, the detection parameters are adaptively adjusted, solving the problem of low accuracy in existing tapping detection technologies and achieving higher detection precision and adaptability.
Patent Information
- Application Number
- CN202511102872.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-11-18
AI Technical Summary
Existing impact detection methods are insufficient in accuracy, especially in noisy environments or motion scenarios where it is difficult to accurately distinguish between impact signals and noise, leading to inconvenience in operation.
An accelerometer is used to collect acceleration signals. By identifying the usage scenario and extracting feature signals based on the detection parameters corresponding to the scenario, the detection parameters are adaptively adjusted to determine the knocking event.
It improves the accuracy of tap detection, adapts to different usage scenarios, and enhances the user experience.
Smart Images

Figure CN120973235A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of interactive technology, and in particular to a tapping detection method, device, electronic device, and computer program. Background Technology
[0002] Tapping has become a common interaction function between users and electronic devices due to its convenience. If a user taps an electronic device, the device can detect the tap and execute the corresponding function, thus achieving more convenient human-computer interaction while meeting user needs. Currently, tap detection is typically achieved through signals from at least one sensor. However, this method suffers from low accuracy in tap detection. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, and computer program for tapping detection, which improves the accuracy of tapping detection.
[0004] In a first aspect, a knock detection method is provided for use in an electronic device, the electronic device including one or more sensors, the one or more sensors including an accelerometer. The method includes: acquiring an acceleration signal through the accelerometer; identifying the usage scenario of the electronic device based on the sensor data acquired by the one or more sensors; extracting a feature signal from the acceleration signal; and determining a knock detection result corresponding to the acceleration signal based on the feature signal and detection parameters corresponding to the usage scenario, the knock detection result being used to indicate whether the acceleration signal is a signal triggered by a knock event.
[0005] In this application, the electronic device includes one or more sensors, including an accelerometer, enabling the electronic device to acquire acceleration signals. Based on the sensor data acquired by the one or more sensors, the device identifies the usage scenario in which it is located. The electronic device can extract feature signals from the aforementioned acceleration signals and, based on detection parameters corresponding to the usage scenario, determine a knock detection result corresponding to the acceleration signal. This knock detection result indicates whether the acceleration signal is a signal triggered by a knock event. By identifying the usage scenario through sensor data, the device can use detection parameters corresponding to the current usage scenario to determine the knock detection result corresponding to the acceleration signal based on the feature signals in different usage scenarios. This adaptive adjustment of the detection parameters avoids the inability of uniform detection parameters to adapt to the knock detection needs of different usage scenarios, thus improving the accuracy of knock detection.
[0006] Secondly, a method and apparatus for detecting impact is provided, applied to an electronic device. The electronic device includes one or more sensors, including an accelerometer. The impact detection apparatus includes a data acquisition module, an identification module, and a detection module. The data acquisition module is used to acquire acceleration signals through the accelerometer. The identification module is used to identify the usage scenario of the electronic device based on the sensor data acquired by the one or more sensors. The detection module is used to extract feature signals from the acceleration signals. Based on detection parameters corresponding to the usage scenario, the impact detection result corresponding to the acceleration signal is determined according to the feature signals. The impact detection result is used to indicate whether the acceleration signal is a signal triggered by a impact event.
[0007] Thirdly, another electronic device is provided, including a processor coupled to a memory for executing instructions in the memory to implement the methods in any of the possible implementations of the first aspect described above. Optionally, the electronic device also includes a memory. Optionally, the electronic device also includes a communication interface to which the processor is coupled.
[0008] Fourthly, a processor is provided, comprising: an input circuit, an output circuit, and a processing circuit. The processing circuit is used to receive signals through the input circuit and transmit signals through the output circuit, causing the processor to execute the method in any possible implementation of the first aspect described above.
[0009] In specific implementation, the processor can be a chip, the input circuit can be an input pin, the output circuit can be an output pin, and the processing circuit can be a transistor, gate circuit, flip-flop, and various logic circuits. The input signal received by the input circuit can be received and input by, for example, but not limited to, a receiver, and the signal output by the output circuit can be output to, for example, but not limited to, a transmitter and transmitted by the transmitter. Furthermore, the input circuit and the output circuit can be the same circuit, which is used as the input circuit and the output circuit at different times. This application does not limit the specific implementation of the processor and various circuits.
[0010] Fifthly, a processing apparatus is provided, including a processor and a memory. The processor is used to read instructions stored in the memory and to receive signals via a receiver and transmit signals via a transmitter to execute the method in any of the possible implementations of the first aspect described above.
[0011] Optionally, there may be one or more processors and one or more memories.
[0012] Alternatively, the memory can be integrated with the processor, or the memory can be set up separately from the processor.
[0013] In specific implementation, the memory can be a non-transitory memory, such as read-only memory (ROM), which can be integrated with the processor on the same chip or set on different chips. The embodiments of this application do not limit the type of memory or the way the memory and processor are set.
[0014] It should be understood that the relevant data interaction process, such as sending indication information, can be the process of outputting indication information from the processor, and receiving capability information can be the process of the processor receiving input capability information. Specifically, the processed output data can be output to the transmitter, and the input data received by the processor can come from the receiver. Here, the transmitter and receiver can be collectively referred to as a transceiver.
[0015] The processing device in the fifth aspect above can be a chip. The processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. The memory can be integrated into the processor or located outside the processor and exist independently.
[0016] In a sixth aspect, a computer program product is provided, the computer program product comprising: a computer program (also referred to as code or instructions), which, when run, causes a computer to perform the method in any of the possible implementations of the first aspect described above.
[0017] In a seventh aspect, a computer-readable storage medium is provided that stores a computer program (also referred to as code or instructions) that, when executed on a computer, causes the computer to perform the methods in any of the possible implementations of the first aspect described above. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the system architecture of the electronic device provided in the embodiments of this application;
[0019] Figure 2 This is a schematic flowchart of a tapping detection method provided in an embodiment of this application;
[0020] Figure 3 This is a schematic flowchart illustrating a first specific example of the tapping detection method provided in the embodiments of this application;
[0021] Figure 4 This is a schematic flowchart illustrating a second specific example of the tapping detection method provided in the embodiments of this application;
[0022] Figure 5This is a schematic flowchart illustrating a third specific example of the tapping detection method provided in the embodiments of this application;
[0023] Figure 6 This is a schematic flowchart illustrating the fourth specific example of the tapping detection method provided in the embodiments of this application;
[0024] Figure 7 This is a schematic flowchart illustrating the fifth specific example of the tapping detection method provided in the embodiments of this application;
[0025] Figure 8 This is a schematic flowchart illustrating the sixth specific example of the tapping detection method provided in the embodiments of this application;
[0026] Figure 9 This is a schematic flowchart illustrating the seventh specific example of the tapping detection method provided in the embodiments of this application;
[0027] Figure 10 This is a schematic block diagram of a tapping detection device provided in an embodiment of this application;
[0028] Figure 11 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0029] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0030] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0031] It should be noted that, in this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0032] Furthermore, "at least one" refers to one or more, while "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b, and c, where a, b, and c can be single or multiple.
[0033] To make the objectives and technical solutions of this application clearer and more intuitive, the tapping detection method, apparatus, electronic device, and computer program provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit the scope of this application.
[0034] Currently, to enhance the user experience, users can perform tap operations on electronic devices to achieve desired functions. For example, electronic devices can detect taps and execute the corresponding function upon detection, thus enabling more convenient human-computer interaction.
[0035] In related technologies, taking headphones as an example of electronic devices, the following methods can be used to implement tap detection on headphones:
[0036] 1. Utilizing the piezoelectric effect of piezoelectric sensors to detect tapping. For example, the mechanical impact of a tap can be converted into an electrical signal, and the headphones can analyze the characteristics of this signal to determine whether a tapping event has occurred. However, this method is costly, and users need to tap a specific location on the electronic device, leading to inconvenience in certain usage scenarios (such as sports activities).
[0037] 2. A microphone is used to capture the sound signal generated by the tapping, which is then converted into an electrical signal. The tapping action is detected based on this electrical signal. However, microphones are easily affected by ambient noise. In noisy environments, the microphone may not be able to accurately distinguish between the tapping sound and background noise.
[0038] 3. Using resistive / capacitive touch sensors to detect changes in resistance / capacitance to sense touch or tapping. However, this method has low sensitivity, is easily affected by changes in humidity and temperature, and requires the user to tap a specific location, leading to inconvenience during movement or other activities.
[0039] In summary, the above-mentioned tapping detection method has the problem of low detection accuracy.
[0040] This application provides a method, apparatus, electronic device, and computer program for tapping detection. The electronic device includes one or more sensors, including an accelerometer, enabling it to acquire acceleration signals. Based on the sensor data acquired by the one or more sensors, the device identifies the usage scenario. The electronic device can extract feature signals from the acceleration signals and, based on detection parameters corresponding to the usage scenario, determine the tapping detection result corresponding to the acceleration signal. This tapping detection result indicates whether the acceleration signal is triggered by a tapping event. By identifying the usage scenario through sensor data, the device can use detection parameters corresponding to the current usage scenario to determine the tapping detection result corresponding to the acceleration signal based on the feature signals. This adaptive adjustment of detection parameters avoids the inability of uniform detection parameters to meet the tapping detection needs of different usage scenarios, thus improving the accuracy of tapping detection.
[0041] The electronic devices involved in the embodiments of this application may be mobile phones, watches, earphones, glasses, laptops, handheld computers, mobile internet devices (MIDs), personal computers (PCs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in self-driving vehicles, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, personal digital assistants (PDAs), etc., but the embodiments of this application are not limited to these.
[0042] For example, Figure 1 This is a schematic diagram of the system architecture of an electronic device provided in an embodiment of this application.
[0043] like Figure 1 As shown, the electronic device includes a processor 110 and a transceiver 120.
[0044] Optionally, the electronic device may also include a memory 130. The processor 110, transceiver 120, and memory 130 can communicate with each other via internal connections to transfer data. The memory 130 stores computer programs, and the processor 110 retrieves and runs the computer programs from the memory 130. The processor 110 and memory 130 can be combined into a single processing device, but more commonly they are independent components. The processor 110 executes the program code stored in the memory 130 to achieve the aforementioned functions. In specific implementations, the memory 130 can be integrated into the processor 110, or it can be independent of the processor 110.
[0045] In addition, to further enhance the functionality of the electronic device, it may also include one or more of an input unit 160 and a sensor 101.
[0046] The electronic device may include one or more sensors 101, and the one or more sensors 101 may include an accelerometer to enable the electronic device to acquire acceleration data through the accelerometer and perform tap detection based on the acceleration data.
[0047] Optionally, the above-mentioned electronic device may also include a power supply 150 for providing power to various devices or circuits in the electronic device.
[0048] Understandable Figure 1 The operation and / or function of each module in the illustrated electronic device are respectively for implementing the corresponding processes in the following method embodiments. For details, please refer to the descriptions in the following method embodiments; detailed descriptions are omitted here to avoid repetition.
[0049] Understandable Figure 1 The processor 110 in the illustrated electronic device may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0050] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0051] Understandable Figure 1 The power supply 150 shown provides power to the processor 110, memory 130, display unit 170, input unit 160, and transceiver 120. The transceiver 120 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The transceiver 120 can be one or more devices integrating at least one communication processing module. The display unit 170 is used to display images, videos, etc. The memory 130 can be used to store computer executable program code, including instructions. The memory 130 can include a program storage area and a data storage area. The program storage area can store the operating system, applications required for at least one function, etc. The data storage area can store data created during the use of the electronic device. Furthermore, memory 130 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 performs various functional applications and data processing of the electronic device by executing instructions stored in memory 130 and / or instructions stored in memory disposed in the processor.
[0052] Figure 2 This is a schematic flowchart of a tapping detection method 200 provided in an embodiment of this application. The method can be derived from the above... Figure 1 The illustrated electronic device performs this action, and the electronic device includes one or more sensors, including an acceleration sensor. Figure 2 As shown, the method 200 may include the following steps:
[0053] S201, Electronic devices acquire acceleration signals through an accelerometer.
[0054] In some embodiments, when the electronic device is powered on, it acquires acceleration signals via an accelerometer.
[0055] In some embodiments, the electronic device may also acquire acceleration signals via an accelerometer in response to a signal acquisition command triggered by a user operation.
[0056] The user operation that triggers the signal acquisition command can be to enable the tap interaction function. When this tap interaction function is enabled, the user can perform a tap operation on the electronic device. The electronic device can collect acceleration signals through an accelerometer, and if a tap operation is detected based on the acceleration signal, it will execute the corresponding interactive function.
[0057] In some embodiments, the accelerometer may acquire acceleration signals based on a preset sampling rate.
[0058] For example, during the process of a user tapping an electronic device, the contact time between the user's hand and the electronic device is usually short, such as 0.1 seconds (s) to 0.2 seconds, which makes the duration of the effective acceleration signal (i.e., the tapping signal) less than 0.1 seconds. Therefore, the above-mentioned preset sampling rate can be higher than 200 (Hz).
[0059] In some embodiments, electronic devices can acquire acceleration signals in real time using an accelerometer.
[0060] In some embodiments, electronic devices may acquire acceleration signals in non-real-time using an accelerometer.
[0061] In one possible scenario, electronic devices can collect acceleration signals through an accelerometer under a preset application scenario. This allows them to collect acceleration signals that can be detected by tapping events under the preset application scenario, while avoiding the extra power consumption caused by the accelerometer collecting acceleration signals for a long time.
[0062] Preset application scenarios can be scenarios where users can achieve preset functions by tapping on electronic devices. These preset application scenarios can be factory defaults or set by the user according to their own usage needs.
[0063] For example, if the electronic device is a smart headphone device, the preset application scenario can be a music playback scenario where the electronic device is used as an audio playback device. In this music playback scenario, the electronic device can collect the acceleration signal generated in the music playback scenario through an accelerometer, so that it can subsequently determine whether a tapping operation has been detected based on the acceleration signal. If a tapping operation is detected, the device can execute interactive functions related to the music playback scenario triggered by the tapping operation, such as music pause function, music playback function, volume boost function, and volume decrease function.
[0064] For example, if the electronic device is a smart glasses device, the preset application scenario can be a recording scenario where the electronic device is used as a recording device. In the recording scenario, the electronic device can collect the acceleration signal generated in the recording scenario through an accelerometer, so that it can later determine whether a tapping operation has been detected based on the acceleration signal, and if a tapping operation is detected, execute the interactive functions related to the recording scenario triggered by the tapping operation, such as the recording pause function and the recording resume function.
[0065] It should be understood that the preset application scenarios shown above are merely exemplary. In addition, there may be other scenarios, such as call scenarios where call-related functions (answering a call, hanging up a call) can be achieved by tapping. This application does not limit these scenarios.
[0066] In some embodiments, the acceleration sensor described above may be a single-axis or multi-axis acceleration sensor.
[0067] In one possible scenario, the aforementioned accelerometer can be a multi-axis accelerometer, which is an integrated sensor capable of simultaneously detecting physical quantities (such as acceleration) in multiple directions. It can achieve complex motion and environmental perception through multi-dimensional data fusion.
[0068] For example, if the above-mentioned accelerometer is a triaxial accelerometer, the electronic device can acquire acceleration signals through the triaxial accelerometer, and the acceleration signals can be used to identify user operations (such as shaking, tapping, and flipping).
[0069] A three-axis accelerometer can identify different user operations by detecting linear acceleration changes in electronic devices in three-dimensional space. The three axes can be the X-axis, Y-axis, and Z-axis.
[0070] For example, the X-axis represents the left-right direction (lateral) of the electronic device, the Y-axis represents the front-back direction (vertical) of the electronic device, and the Z-axis represents the up-down direction (vertical) of the electronic device. When the electronic device is placed horizontally at rest: the acceleration on the X-axis is approximately 0g (no lateral movement), the acceleration on the Y-axis is approximately 0g, and the acceleration on the Z-axis is approximately ±1g (1g if the front of the electronic device is facing up, and -1g if the back of the electronic device is facing up).
[0071] S202, The electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0072] In some embodiments, the usage scenario may include a first usage scenario and a second usage scenario. The first usage scenario may be a scenario in which the electronic device is moving, and the second usage scenario may be a scenario in which the electronic device is not moving.
[0073] In one possible scenario, the first use case could be a situation where the electronic device is moving with the user.
[0074] In an example scenario, if the electronic device is a smart headset, when the user wears the smart headset on their ear and is exercising, the smart headset can move in sync with the user's movements.
[0075] In one possible scenario, the first use case could also be a scenario where the electronic device moves from a stationary state to a running state with the user.
[0076] For example, if the electronic device is a smart bracelet, when a user wears the smart bracelet on their wrist, if the user raises their wrist, the smart bracelet will move from a stationary position as the user raises their wrist.
[0077] In one possible scenario, the second use case is when the electronic device is stationary.
[0078] For example, if the electronic device is a smart glasses device, the smart glasses device remains stationary when the user wears the smart glasses on their head and keeps their head still.
[0079] In another possible scenario, the second use case could also be a scenario where the electronic device changes from motion to rest as the user moves.
[0080] For example, if the electronic device is a smart terminal device, if the user moves while carrying the smart terminal device, and the user stops moving, the smart terminal device will change from motion to stillness as the user stops moving.
[0081] It should be understood that the electronic devices shown above are merely exemplary and are not intended to limit the scope of this application.
[0082] In some embodiments, the electronic device identifies the usage scenario of the electronic device based on the acceleration signal collected by the accelerometer.
[0083] For example, an electronic device can compare an acceleration signal with an acceleration signal threshold. If the acceleration signal meets the acceleration signal threshold, the electronic device can identify the usage scenario based on the mapping relationship between the acceleration signal threshold and the usage scenario.
[0084] In one possible scenario, the acceleration sensor here can be the acceleration sensor in S201 above, and the acceleration data can be the acceleration data in S201 above.
[0085] In another possible scenario, the acceleration sensor here can be an acceleration sensor other than the acceleration sensor in S201 above. That is, the electronic device can have at least two acceleration sensors, one for performing the acceleration signal acquisition task in S201 above, and the other acceleration sensor for performing the acceleration signal acquisition task in S202.
[0086] In some embodiments, electronic devices can identify the usage scenario based on sensor data collected by sensors other than the accelerometer.
[0087] In one possible scenario, electronic devices can identify the usage scenario based on sensor data collected by a sound-to-electrical transducer. For example, if the sound-to-electrical transducer is a microphone, the electronic device can convert sound pressure fluctuations in the air into electrical signals, and identify the usage scenario based on these electrical signals, the energy (sound pressure level) threshold of the electrical signals, and the mapping relationship between the energy threshold and the usage scenario.
[0088] In one possible scenario, electronic devices can identify their usage scenario based on sensor data collected by an angular velocity sensor. For example, if the angular velocity sensor is a gyroscope, the electronic device can measure the rotational angular velocities of the X, Y, and Z axes. If the angular velocities of the three axes are approximately 0, it can be determined that the electronic device is in a stationary scenario. If there are axes that output continuous non-zero angular velocity pulses, it can be determined that the electronic device is in a moving scenario.
[0089] In one possible scenario, electronic devices can identify their usage environment based on sensor data acquired by a Hall effect magnetic sensor. For example, this Hall effect magnetic sensor could be a magnetometer. In most indoor / outdoor environments, the magnetic field is static; however, the direction and magnitude of the magnetic vector change as the electronic device moves with the user. Therefore, the electronic device can monitor the magnetic field state using the magnetometer to identify whether it is in a static or moving environment.
[0090] In some embodiments, to improve the accuracy of scene recognition, electronic devices can also identify the usage scenario based on the same or different types of sensor data collected by different sensors.
[0091] It should be understood that the sensors shown above are merely exemplary. In addition, other sensors can be used to collect sensor data to identify usage scenarios, and this application does not limit this.
[0092] S203, the characteristic signal of the acceleration signal is extracted by the electronic device.
[0093] In some embodiments, when the aforementioned accelerometer is a single-axis accelerometer, the electronic device can perform differential processing on the acceleration signal to obtain the characteristic signal of the acceleration signal. A knocking event typically manifests as a sudden change in the acceleration signal (such as a sharp peak). Differential processing can amplify this high-frequency change and suppress slowly changing background noise or drift. It can also remove DC components or low-frequency trends (such as gravitational components) from the acceleration signal, making the knocking characteristics more pronounced. Furthermore, differential processing suppresses low-frequency interference, retains the high-frequency components associated with the knocking, and enhances the signal-to-noise ratio.
[0094] For example, the first sampling point in the acceleration signal is subtracted from the second sampling point to obtain a first reference sampling point. The first sampling point and the second sampling point are adjacent sampling points in the acceleration signal. The sampling time of the second sampling point is earlier than the sampling time of the first sampling point. The second sampling point in the acceleration signal can be updated based on the first reference sampling point to obtain the characteristic signal of the acceleration signal.
[0095] In some embodiments, when the aforementioned accelerometer is a multi-axis accelerometer, the acceleration signal acquired by the accelerometer may include acceleration sub-signals corresponding to each of the multiple axes. The electronic device can perform differential processing on the acceleration sub-signals corresponding to each axis to obtain differential signals corresponding to each axis, and then aggregate the differential signals corresponding to each axis to obtain the aforementioned feature signal. By extracting the transient features of the impact in the acceleration signal through differential processing, and by enhancing robustness and quantifying the impact event through aggregation, the accuracy and noise resistance of impact detection are improved.
[0096] For example, the electronic device can subtract the third sampling point from the fourth sampling point in the acceleration sub-signal corresponding to each axis to obtain the second reference sampling signal corresponding to each axis. The third sampling point and the fourth sampling point are adjacent sampling points in the acceleration sub-signal corresponding to each axis. The sampling time of the fourth sampling point is earlier than the sampling time of the third sampling point. Based on the second reference sampling points corresponding to each axis, the fourth sampling point in the acceleration sub-signal corresponding to each axis can be updated to obtain the differential signal corresponding to each axis.
[0097] In the case where the above-mentioned accelerometer is a triaxial accelerometer, x_d[n], y_d[n], and z_d[n] are signal sequences of triaxial acceleration signals after differential processing, that is, acceleration signals that have weakened low frequencies and retained high-frequency impact characteristics.
[0098] For example, the differential signals corresponding to each axis of the triaxial sensor can be obtained using the following formula:
[0099] x_d[n] = x[n] - x[n-1];
[0100] y_d[n] = y[n] - y[n-1];
[0101] z_d[n] = z[n] - z[n-1];
[0102] Where x[n], y[n], and z[n] are the outputs of the triaxial accelerometer at the nth sampling point.
[0103] In one possible implementation, the electronic device can sum the differential signals corresponding to each axis to achieve aggregation and obtain the aforementioned characteristic signal. Aggregation can smooth high-frequency noise, avoid false triggering, and transform short-term transient signals into stable characteristic values, making it easier to set thresholds to determine whether an impact has occurred.
[0104] For example, if the accelerometer is a triaxial accelerometer, and the signal sequences of the differential signals corresponding to the X, Y, and Z axes are x_d[n], y_d[n], and z_d[n], the characteristic signal S[n] can be obtained by the following formula:
[0105] S[n]=x_d[n]+y_d[n]+z_d[n].
[0106] In one possible implementation, the electronic device can also take the modulus value of the differential signals corresponding to each axis to achieve aggregation and obtain the aforementioned characteristic signals.
[0107] For example, if the accelerometer is a triaxial accelerometer, and the signal sequences of the differential signals corresponding to the X, Y, and Z axes are x_d[n], y_d[n], and z_d[n], the characteristic signal M[n] can be obtained by the following formula:
[0108]
[0109] It should be understood that the formulas for calculating characteristic signals shown above are merely exemplary and are not intended to limit the scope of this application.
[0110] S204, the electronic device determines the knock detection result corresponding to the acceleration signal based on the characteristic signal according to the detection parameters corresponding to the usage scenario. The knock detection result is used to indicate whether the acceleration signal is a signal generated by a knock event.
[0111] In some embodiments, the usage scenario includes a first usage scenario and a second usage scenario. The first usage scenario may be a scenario in which the electronic device moves, and the second usage scenario may be a scenario in which the electronic device stops moving.
[0112] For example, in a first usage scenario, the electronic device can determine the impact detection result corresponding to the aforementioned acceleration signal based on the first detection parameter corresponding to the first usage scenario and the feature signal.
[0113] For example, in the second usage scenario, the electronic device can determine the knock detection result corresponding to the acceleration signal based on the feature signal according to the second detection parameters corresponding to the second usage scenario.
[0114] It should be understood that the detection sensitivity indicated by the first detection parameter is lower than the detection sensitivity indicated by the second detection parameter. A lower detection sensitivity means a larger lower limit amplitude of the acceleration signal that the electronic device can detect, thus reducing the probability of false triggering in scenarios where the electronic device is moving. Conversely, a higher detection sensitivity means a smaller lower limit amplitude of the signal that the electronic device can detect, allowing for the detection of slight tapping signals even when the electronic device is stationary, thereby improving the accuracy of tap detection.
[0115] It should be understood that the first and second usage scenarios shown above are merely examples. In addition, usage scenarios may include other different usage scenarios, and under different usage scenarios, the impact detection result corresponding to the acceleration signal can be determined based on the feature signal according to different detection parameters.
[0116] In some embodiments, the detection parameters include a peak threshold and peak feature conditions. The electronic device can perform peak detection on the characteristic signal based on a peak threshold corresponding to the usage scenario to obtain peak features, which include one or more of the following: peak quantity, peak width, and time interval between adjacent peaks. If the peak features satisfy the peak feature conditions corresponding to the usage scenario, the electronic device can determine the tapping detection result corresponding to the acceleration signal as a first result, which indicates that the acceleration signal is a signal triggered by a tapping event.
[0117] In this application, the electronic device includes one or more sensors, including an accelerometer, enabling the electronic device to acquire acceleration signals. Based on the sensor data acquired by the one or more sensors, the device identifies the usage scenario in which it is located. The electronic device can extract feature signals from the aforementioned acceleration signals and, based on detection parameters corresponding to the usage scenario, determine a knock detection result corresponding to the acceleration signal. This knock detection result indicates whether the acceleration signal was generated by a knock event. By identifying the usage scenario through sensor data, the device can use detection parameters corresponding to the current usage scenario to extract feature signals from the acceleration signals and determine the knock detection result corresponding to the acceleration signal based on these feature signals. This avoids the problem of preset detection parameters being unable to adapt to the knock detection needs of different usage scenarios, thus improving the accuracy of knock detection.
[0118] In some embodiments, the detection parameters further include a detection step size, so that the electronic device can perform peak detection on the acceleration signal based on the detection step size corresponding to the usage scenario.
[0119] Figure 3 This is a schematic flowchart of a tapping detection method 300 provided in an embodiment of this application. Figure 3 As shown, the method 300 may include the following steps:
[0120] S301, the electronic device acquires acceleration signals through an accelerometer.
[0121] S302, The electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0122] S303, the characteristic signal of the acceleration signal extracted by the electronic device.
[0123] S304, the electronic device performs peak detection on the feature signal based on the peak threshold and detection step size corresponding to the usage scenario, and obtains peak features, which include one or more of the following: peak number, peak width and time interval between adjacent peaks.
[0124] In some embodiments, different detection step sizes may correspond to different use cases.
[0125] In the first usage scenario shown in the above embodiments, the electronic device can use a first detection step size to perform peak detection on the feature signal. Alternatively, in the second usage scenario shown in the above embodiments, the electronic device can use a second detection step size to perform peak detection on the feature signal. The first detection step size can be larger than the second detection step size.
[0126] For example, the acceleration signal collected in the first use scenario changes drastically, and high-frequency sampling has limited significance. Using a larger first detection step size can reduce redundant calculations. Furthermore, motion artifacts (such as accelerometer drift and mechanical vibration) usually generate short-term high-frequency noise. Using a larger first detection step size can also smooth out the above interference and reduce false alarms.
[0127] For example, in the second use case, the baseline of the acceleration signal collected is stable. Small impacts or low-amplitude signals require high-resolution detection. Using a smaller detection step size can avoid missing impact signals.
[0128] In some embodiments, the electronic device can also perform peak detection on the feature signal with a smaller detection step size. After detecting a peak, it can predict the sampling point where the next peak may occur, and use a larger detection step size to skip the sampling points where there is no possible peak and directly detect the sampling points where a peak may occur.
[0129] For example, the electronic device can perform peak detection on the feature signal according to a third detection step size. If the first peak is detected at the first sampling point in the signal sampling sequence corresponding to the feature signal, and if the electronic device predicts that the next peak may appear at the second sampling point, it can sample at a fourth detection step size, jumping directly from the first sampling point to the third sampling point, and detecting whether the next peak appears at the sampling points after the third sampling point based on the third detection step size. The third detection step size can be smaller than the fourth detection step size, so that the electronic device can perform peak detection based on a smaller detection step size, reducing the probability of missing peaks in the feature signal, and can avoid performing peak detection on signals that are predicted not to have peaks by using a larger detection step size, thereby improving peak detection efficiency and reducing power consumption.
[0130] S305, when the above-mentioned peak characteristics meet the peak characteristic conditions corresponding to the usage scenario, the electronic device determines the knock detection result corresponding to the acceleration signal as the first result, and the first result is used to indicate that the acceleration signal is a signal generated by the knock event.
[0131] In this embodiment of the application, the electronic device can perform peak detection on the acceleration signal based on the detection step size corresponding to the usage scenario. This improves the detection efficiency while avoiding the extra power consumption caused by performing peak detection on signals that are unlikely to have peak values.
[0132] In some embodiments, the electronic device can filter peak features using a tap signal constraint model and determine the tap detection result corresponding to the acceleration signal based on the filtered peak features.
[0133] Figure 4 This is a schematic flowchart of a tapping detection method 400 provided in an embodiment of this application. Figure 4 As shown, the method 400 may include the following steps:
[0134] S401, the electronic device acquires acceleration signals through an accelerometer.
[0135] S402, the electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more of the sensors.
[0136] S403, the characteristic signal of the acceleration signal extracted by the electronic device.
[0137] S404, The electronic device performs peak detection on the characteristic signal based on the peak threshold corresponding to the usage scenario to obtain peak features, which include one or more of the following: peak number, peak width, and time interval between adjacent peaks.
[0138] S405, the electronic device filters the above peak features through the knock signal constraint model, and determines the knock detection result corresponding to the acceleration signal as the first result if the filtered peak features meet the peak feature conditions corresponding to the usage scenario.
[0139] For example, when the above-mentioned peak characteristics indicate the detection of multiple peaks, these multiple peaks may include spurious peaks caused by noise or other interference. The electronic device can filter the above-mentioned peak characteristics using a tap signal constraint model to eliminate spurious peaks that do not conform to the physical characteristics of a tap. For instance, the tap signal constraint model can filter out peaks whose peak widths do not meet a preset width threshold. The preset width threshold is determined based on the peak width of the tap signal.
[0140] In this embodiment, the electronic device can filter the aforementioned peak features using a tap signal constraint model. If the filtered peak features meet the peak feature conditions corresponding to the usage scenario, the tap detection result corresponding to the acceleration signal is determined as the first result. A preset width threshold (such as a minimum / maximum width range) set by the tap signal constraint model (peak-width constraint model) can further filter and eliminate false peaks in the peak features that do not conform to the physical characteristics of tapping, thereby improving the accuracy of tap detection.
[0141] In some embodiments, the electronic device may also determine the impact detection result corresponding to the acceleration signal based on the detection parameters corresponding to the usage scenario, when it detects that there are sampling points in the feature signal that meet the admission conditions.
[0142] Figure 5 This is a schematic flowchart of a tapping detection method 500 provided in an embodiment of this application. Figure 5 As shown, the method 500 may include the following steps:
[0143] S501, the electronic device acquires acceleration signals through an accelerometer.
[0144] S502, the electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0145] S503, the electronic device extracts the characteristic signal of the acceleration signal.
[0146] S504, when the electronic device detects that there is a first sampling point in the feature signal that meets the admission conditions, it takes the first sampling point as the starting sampling point and determines the impact detection result corresponding to the acceleration signal based on the feature signal.
[0147] In some embodiments, the admission criteria include the amplitude of the signal value corresponding to the sampling point being greater than or equal to a second amplitude threshold, and the sampling point being a local extremum.
[0148] In this embodiment of the application, when a sampling point that meets the admission criteria is detected in the feature signal, the impact detection result corresponding to the acceleration signal is determined based on the detection parameters corresponding to the usage scenario. This avoids meaningless or low-quality signals from entering the impact detection process, thereby reducing the waste of computing power and the probability of false detection.
[0149] In some embodiments, the electronic device may also stop determining the impact detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario if it detects that there is a sampling point in the feature signal that meets the clearance condition.
[0150] Figure 6 This is a schematic flowchart of a tapping detection method 600 provided in an embodiment of this application. Figure 6 As shown, the method 600 may include the following steps:
[0151] S601, the electronic device acquires acceleration signals through an accelerometer.
[0152] S602, the electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0153] S603, the characteristic signal of the acceleration signal extracted by the electronic device.
[0154] S604, when the electronic device detects that there is a first sampling point in the feature signal that meets the admission conditions, it takes the first sampling point as the starting sampling point and determines the knock detection result corresponding to the acceleration signal based on the detection parameters corresponding to the usage scenario.
[0155] S605, if the electronic device detects that there is a second sampling point in the feature signal that meets the clearance condition, it stops determining the knock detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario.
[0156] In some embodiments, the exit conditions include one or more of the following:
[0157] The amplitude of the signal value corresponding to the sampling point is less than the third amplitude threshold;
[0158] The time interval between the sampling point and the first sampling point is greater than or equal to the time interval threshold.
[0159] The difference between the square of the amplitude of the signal value corresponding to the sampling point and the square of the amplitude of the signal value corresponding to the first sampling point is greater than or equal to the difference threshold.
[0160] In this embodiment, the electronic device can also know that there is no peak feature corresponding to the knocking operation in the feature signal when it detects that there is a sampling point in the acceleration signal that meets the exit condition. In this case, it can stop determining the knocking detection result corresponding to the acceleration signal based on the feature signal, thereby avoiding over-detection or under-detection and improving detection efficiency and accuracy.
[0161] In some embodiments, the electronic device may also perform a tap pre-detection, and if the pre-detection result indicates that the acceleration signal may be a signal generated by a tapping event, determine the tap detection result corresponding to the acceleration signal based on the characteristic signal according to the detection parameters corresponding to the usage scenario.
[0162] Figure 7 This is a schematic flowchart of a tapping detection method 700 provided in an embodiment of this application. Figure 7 As shown, the method 700 may include the following steps:
[0163] S701, electronic devices acquire acceleration signals through an accelerometer.
[0164] S702: The electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0165] S703, the characteristic signal of the acceleration signal extracted by the electronic device.
[0166] S704, the electronic device filters out multiple target sampling points in the feature signal. The target sampling points are the sampling points in the feature signal whose signal value amplitude is greater than or equal to a first amplitude threshold.
[0167] S705, the electronic device merges the above-mentioned multiple target sampling points to obtain at least one sampling interval, which includes multiple target sampling points, and the sampling interval between the multiple target sampling points is less than or equal to the sampling interval threshold.
[0168] S706, the electronic device determines the impact detection result corresponding to the acceleration signal based on the detection parameters corresponding to the above-mentioned usage scenario and the feature signal in the first sampling interval. The first sampling interval is a sampling interval that meets the sampling conditions among the above-mentioned at least one sampling interval.
[0169] In some embodiments, the sampling conditions include one or more of the following:
[0170] The peak amplitude of the sampling interval is greater than or equal to the peak amplitude threshold.
[0171] The peak rise time of the sampling interval is less than or equal to the peak rise time threshold.
[0172] The effective duration of the sampling interval is less than or equal to the effective time threshold.
[0173] The signal-to-noise ratio of the sampling interval is greater than or equal to the signal-to-noise ratio threshold.
[0174] In this embodiment, the electronic device can determine the impact detection result corresponding to the acceleration signal based on the characteristic signals of the feature signals in the first sampling interval, according to the detection parameters corresponding to the usage scenario. The first sampling interval is a sampling interval that meets the sampling conditions among at least one sampling interval. The first sampling interval includes multiple target sampling points, which are sampling points in the aforementioned feature signals whose signal amplitude is greater than or equal to a first amplitude threshold. The electronic device can pre-detect the feature details of the acceleration signal to filter out sampling intervals that may be impact signals, and then perform impact detection based on these filtered sampling intervals, thereby reducing the computational load of impact detection and improving its efficiency.
[0175] Figure 8 This is a schematic flowchart of a tapping detection method 800 provided in an embodiment of this application. Figure 8 As shown, the method 800 may include the following steps:
[0176] S801, the electronic device acquires acceleration signals through an accelerometer.
[0177] S802, the electronic device identifies the usage scenario of the electronic device based on sensor data collected by one or more sensors.
[0178] S803 is a feature signal extracted by the electronic device from the acceleration signal.
[0179] S804, the electronic device filters out multiple target sampling points in the feature signal. The target sampling points are the sampling points in the feature signal whose signal value amplitude is greater than or equal to a first amplitude threshold.
[0180] S805, the electronic device merges the above-mentioned multiple target sampling points to obtain at least one sampling interval, which includes multiple target sampling points, and the sampling interval between the multiple target sampling points is less than or equal to the sampling interval threshold.
[0181] S806, when the electronic device detects that there is a first sampling point in the feature signal in the first sampling interval that meets the admission conditions, it takes the first sampling point as the starting sampling point and performs peak detection on the feature signal in the first sampling interval based on the peak threshold and detection step size corresponding to the usage scenario to obtain the peak feature.
[0182] The peak characteristics include one or more of the following: peak number, peak width, and time interval between adjacent peaks.
[0183] The admission criteria include that the amplitude of the signal value corresponding to the sampling point is greater than or equal to the second amplitude threshold, and that the sampling point is a local extremum.
[0184] S807, if the electronic device detects that there is a second sampling point in the feature signal in the first sampling interval that meets the exit condition, it stops performing peak detection on the feature signal in the first sampling interval based on the peak threshold and detection step size corresponding to the usage scenario.
[0185] In some embodiments, exit conditions include one or more of the following:
[0186] The amplitude of the signal value corresponding to the sampling point is less than the third amplitude threshold;
[0187] The time interval between the sampling point and the first sampling point is greater than or equal to the time interval threshold.
[0188] The difference between the square of the amplitude of the signal value corresponding to the sampling point and the square of the amplitude of the signal value corresponding to the first sampling point is greater than or equal to the difference threshold.
[0189] S808, the electronic device filters peak features through a knock signal constraint model, and determines the knock detection result corresponding to the acceleration signal as the first result if the filtered peak features meet the peak feature conditions corresponding to the usage scenario.
[0190] Optionally, if the tap detection result corresponding to the acceleration signal is the first result, the electronic device will also store the above-mentioned peak features in memory, and if no update of the peak features is detected within a preset time period, it can determine the tap event that triggers the generation of the acceleration signal based on the peak features.
[0191] Optionally, the electronic device may also execute S906 and S807 above based on the second sampling interval. The second sampling interval is smaller than the first sampling interval, and the first sampling interval includes the second sampling interval.
[0192] For example, the second sampling interval can be a new sampling interval centered on the peak value of the first sampling interval, extended forward and backward by a fixed time (e.g., ±5ms). This second sampling interval can be about 10ms long, shorter than the first sampling interval, to avoid wasting computation on noise segments at the end or beginning of the first sampling interval.
[0193] The following section uses a smart earphone device as an example to describe in detail the tapping detection method provided in this application.
[0194] Figure 9 This is a schematic flowchart illustrating a tapping detection method provided in an embodiment of this application. Figure 9 As shown, smart earphone devices can collect acceleration data through an accelerometer and extract characteristic signals from the acceleration signal.
[0195] For example, when the accelerometer is a multi-axis accelerometer, the smart headphone device can obtain the characteristic signals of the acceleration signal by triggering and aggregating the acceleration signal.
[0196] like Figure 9 As shown, the smart headphone device can perform peak pre-detection based on the above-mentioned feature signals, and perform peak detection when it is determined that the feature signals meet the pre-detection threshold.
[0197] For example, a smart headphone device can filter out sampling points in a feature signal whose amplitude is greater than or equal to a first amplitude threshold, and merge the multiple target sampling points to obtain at least one sampling interval. This sampling interval includes multiple target sampling points, and the sampling interval between these multiple target sampling points is less than or equal to a sampling interval threshold. The smart headphone device can determine the tapping detection result corresponding to the acceleration signal based on the feature signal in a sampling interval (such as the first sampling interval) that meets the sampling conditions. For instance, an electronic device can perform peak detection on the feature signal based on a peak threshold to obtain peak features, which include one or more of the following: peak quantity, peak width, and time interval between adjacent peaks.
[0198] like Figure 9 Furthermore, before performing peak detection, the smart headphone device can also detect the usage scenario and determine the detection parameters based on the usage scenario.
[0199] The smart earphone device can identify the usage scenario based on sensor data collected by one or more sensors. In a first usage scenario, based on a first detection parameter corresponding to the first usage scenario, it determines the tapping detection result corresponding to the acceleration signal based on the feature signal. Alternatively, in a second usage scenario, based on a second detection parameter corresponding to the second usage scenario, it determines the tapping detection result corresponding to the acceleration signal based on the feature signal. The first usage scenario is when the smart earphone device is moving, and the second usage scenario is when the smart earphone device is stationary. The detection sensitivity indicated by the first detection parameter is lower than the detection sensitivity indicated by the second detection parameter.
[0200] For example, electronic devices can perform peak detection on feature signals based on peak thresholds and detection step sizes corresponding to the usage scenario to obtain peak features. By adaptively adjusting detection parameters (such as peak thresholds and detection step sizes), the inability of uniform detection parameters to adapt to the needs of tap detection in different usage scenarios is avoided, thereby improving the accuracy of tap detection.
[0201] like Figure 9 As shown, before peak detection, the smart earphone device can also perform mean filtering on the feature signal of the first sampling interval to reduce the probability of subsequently misdetecting noise signal as peak.
[0202] like Figure 9 As shown, smart headphone devices can determine whether the aforementioned peak features are knocking features.
[0203] For example, if the above-mentioned peak characteristics meet the peak characteristic conditions corresponding to the usage scenario, the electronic device can determine that it meets the knocking characteristics, that is, the knocking detection result corresponding to the acceleration signal is the first result, which is used to indicate that the acceleration signal is a signal generated by the knocking event.
[0204] Optionally, the smart headphone device filters the above-mentioned peak features through a tapping signal constraint model, and determines the tapping detection result corresponding to the acceleration signal as the first result if the filtered peak features meet the peak feature conditions corresponding to the usage scenario.
[0205] Optionally, if the smart earphone device detects a first sampling point in the feature signal that meets the admission criteria, it can determine the tapping detection result corresponding to the acceleration signal based on the feature signal, using the first sampling point as the starting sampling point and the detection parameters corresponding to the usage scenario.
[0206] Optionally, if the smart earphone device detects a second sampling point in the feature signal that meets the clearance condition, it stops determining the tapping detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario.
[0207] like Figure 9 As shown, when the tapping detection result corresponding to the acceleration signal is the first result, the smart earphone device will also store the above peak features in memory, and can trigger a tapping event that generates an acceleration signal based on the peak features if no update of the peak features is detected within a preset time period.
[0208] For example, a smart headphone device can perform tap counting based on one or more of the peak characteristics, including the number of peaks, the peak width, and the time interval between adjacent peaks. If there is only one peak, the tap count can be "1", and if there are multiple peaks, the tap count can be a value greater than 1.
[0209] like Figure 9 As shown, the smart earphone device can also perform signal consistency detection and output the tapping event based on the tapping event classification.
[0210] For example, a smart headphone device can perform tapping force and interval consistency detection on the acceleration signal corresponding to the peak features in memory. By analyzing the peak value and time interval features of the tapping signal, interference from spurious peaks can be eliminated, thereby improving the accuracy of the tapping results. If the peak features after consistency detection include a single peak, a single tap operation can be output; if they include multiple peaks, a multi-tap operation can be output.
[0211] It should also be understood that the various embodiments described above can be coupled to each other, and this application does not limit this. Furthermore, the sequence number of each process does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0212] The above text combines Figures 1 to 9 The knocking detection method of the embodiments of this application is described in detail below. Figure 10 and Figure 11 This application describes in detail the tapping detection device according to embodiments of the present application.
[0213] Figure 10This application illustrates a knock detection device 1000 provided in an embodiment of the present application. Applied to an electronic device, the electronic device includes one or more sensors, including an accelerometer. The knock detection device 1000 includes: a data acquisition module 1001, an identification module 1002, and a detection module 1003. The data acquisition module 1001 is used to: acquire acceleration signals through the accelerometer; the identification module 1002 is used to: identify the usage scenario of the electronic device based on sensor data acquired by the one or more sensors; the detection module 1003 is used to: extract feature signals from the acceleration signals; and, based on detection parameters corresponding to the usage scenario, determine a knock detection result corresponding to the acceleration signals according to the feature signals. The knock detection result indicates whether the acceleration signals are signals triggered by a knock event.
[0214] Optionally, the above-mentioned usage scenarios include a first usage scenario and a second usage scenario, wherein the first usage scenario is a scenario in which the electronic device moves, and the second usage scenario is a scenario in which the electronic device stops moving; the detection module 1003 is used to: in the first usage scenario, determine the knock detection result corresponding to the acceleration signal based on the feature signal according to the first detection parameter corresponding to the first usage scenario; or, in the second usage scenario, determine the knock detection result corresponding to the acceleration signal based on the feature signal according to the second detection parameter corresponding to the second usage scenario; the detection sensitivity indicated by the first detection parameter is less than the detection sensitivity indicated by the second detection parameter.
[0215] Optionally, the detection parameters include a peak threshold and peak feature conditions; the detection module 1003 is used to: perform peak detection on the feature signal based on the peak threshold corresponding to the above-mentioned usage scenario to obtain peak features, wherein the peak features include one or more of the following: peak quantity, peak width, and time interval between adjacent peaks; and, if the peak features satisfy the peak feature conditions corresponding to the above-mentioned usage scenario, determine the knock detection result corresponding to the acceleration signal as a first result, wherein the first result is used to indicate that the acceleration signal is a signal generated by a knock event.
[0216] Optionally, the detection module 1003 is used to: filter the above-mentioned peak features through the impact signal constraint model, and determine the impact detection result corresponding to the above-mentioned acceleration signal as the first result if the filtered peak features meet the peak feature conditions corresponding to the above-mentioned use scenario.
[0217] Optionally, the detection parameters also include a detection step size. The detection module 1003 is used to: perform peak detection on the feature signal based on the peak threshold and the detection step size corresponding to the above-mentioned use scenario, and obtain the peak feature.
[0218] Optionally, the detection module 1003 is used to: perform differential processing on the above-mentioned acceleration signal to obtain the above-mentioned characteristic signal.
[0219] Optionally, the above-mentioned acceleration sensor is a multi-axis acceleration sensor, and the above-mentioned acceleration signal includes acceleration sub-signals corresponding to each of the multiple axes; the detection module 1003 is used to: perform differential processing on the acceleration sub-signals corresponding to each axis to obtain the differential signals corresponding to each axis; and aggregate the differential signals corresponding to each axis to obtain the above-mentioned feature signal.
[0220] Optionally, the acceleration signal includes signal values corresponding to multiple sampling points. The detection module 1003 is used to: filter out multiple target sampling points from the feature signal; the target sampling points are sampling points in the feature signal whose signal value amplitude is greater than or equal to a first amplitude threshold; merge the multiple target sampling points to obtain at least one sampling interval, the sampling interval includes multiple target sampling points, and the sampling interval between the multiple target sampling points is less than or equal to a sampling interval threshold; based on the detection parameters corresponding to the above-mentioned usage scenario, determine the impact detection result corresponding to the acceleration signal according to the feature signal in the first sampling interval, the first sampling interval being the sampling interval that meets the sampling conditions among the at least one sampling interval.
[0221] Optionally, the above sampling conditions include one or more of the following: the peak amplitude of the sampling interval is greater than or equal to the peak amplitude threshold; the peak rise time of the sampling interval is less than or equal to the peak rise time threshold; the effective duration of the sampling interval is less than or equal to the effective time threshold; and the signal-to-noise ratio of the sampling interval is greater than or equal to the signal-to-noise ratio threshold.
[0222] Optionally, the detection module 1003 is used to: when a first sampling point that meets the admission conditions is detected in the above-mentioned feature signal, based on the detection parameters corresponding to the above-mentioned use scenario, take the first sampling point as the starting sampling point, and determine the knock detection result corresponding to the above-mentioned acceleration signal according to the above-mentioned feature signal; wherein, the above-mentioned admission conditions include that the amplitude of the signal value corresponding to the sampling point is greater than or equal to a second amplitude threshold, and the sampling point is a local extremum.
[0223] Optionally, the detection module 1003 is configured to: stop determining the impact detection result corresponding to the acceleration signal based on the feature signal when a second sampling point satisfying the cutoff condition is detected in the feature signal; wherein the cutoff condition includes one or more of the following: the amplitude of the signal value corresponding to the sampling point is less than a third amplitude threshold; the time interval between the sampling point and the first sampling point is greater than or equal to the time interval threshold; the difference between the square of the amplitude of the signal value corresponding to the sampling point and the square of the amplitude of the signal value corresponding to the first sampling point is greater than or equal to the difference threshold.
[0224] Optionally, the detection module 1003 is used to: store the peak feature in memory when the tapping detection result corresponding to the acceleration signal is the first result; and trigger a tapping event of the acceleration signal based on the peak feature when no update of the peak feature is detected within a preset time period.
[0225] It should be understood that the tapping detection device 1000 here is embodied in the form of a functional module. The term "module" here can refer to an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor, etc.) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components supporting the described functions. In an alternative example, those skilled in the art will understand that the tapping detection device 1000 can be specifically the electronic device in the above embodiments, or the functions of the electronic device in the above embodiments can be integrated into the tapping detection device 1000. The tapping detection device 1000 can be used to execute the various processes and / or steps corresponding to the electronic device in the above method embodiments; to avoid repetition, these will not be described again here. The above-described tapping detection device 1000 has the function of implementing the corresponding steps performed by the electronic device in the above method; the above functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. In the embodiments of this application, Figure 10 The tap detection device 1000 can also be a chip or a chip system, such as a system on chip (SoC).
[0226] Figure 11An electronic device 1100 according to an embodiment of this application is shown. The electronic device 1100 includes one or more sensors, including an acceleration sensor. The electronic device 1100 includes a processor 1101, a memory 1102, a communication interface 1103, and a bus 1104. The memory 1102 stores instructions, and the processor 1101 executes the instructions stored in the memory 1102. The processor 1101, the memory 1102, and the communication interface 1103 are interconnected via the bus 1104.
[0227] The processor 1101 is configured to: acquire acceleration signals through the aforementioned acceleration sensor; identify the usage scenario of the electronic device based on sensor data acquired by one or more of the aforementioned sensors; extract feature signals of the acceleration signals based on detection parameters corresponding to the aforementioned usage scenario; and determine the knock detection result corresponding to the acceleration signals based on the aforementioned feature signals, wherein the knock detection result is used to indicate whether the acceleration signals are signals generated by a knock event.
[0228] It should be understood that the electronic device 1100 may specifically be the electronic device in the above embodiments, or the functions of the electronic device in the above embodiments may be integrated into the electronic device 1100. The electronic device 1100 may be used to execute the various steps and / or processes corresponding to the electronic device in the above method embodiments. Optionally, the memory 1102 may include read-only memory and random access memory, and provide instructions and data to the processor 1101. A portion of the memory 1102 may also include non-volatile random access memory. For example, the memory 1102 may also store device type information. The processor 1101 may be used to execute instructions stored in the memory, and when the processor executes the instructions, the processor 1101 may execute the various steps and / or processes corresponding to the electronic device in the above method embodiments. It should be understood that in the embodiments of this application, the processor may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. In implementation, the steps of the above methods can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The steps of the methods disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor executes the instructions in the memory, combining with its hardware to complete the steps of the above methods. To avoid repetition, detailed descriptions are not provided here. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. Those skilled in the art will readily understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood from the several embodiments provided in this application that the disclosed systems, devices, and methods can be implemented in other ways.For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces, indirect couplings, or communication connections between devices or units, and may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Additionally, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. If the function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. The above descriptions are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A tapping detection method, characterized in that, Applied to an electronic device, the electronic device including one or more sensors, the one or more sensors including an acceleration sensor, the method includes: Acceleration signals are acquired through the accelerometer. Based on sensor data collected by one or more of the sensors, the usage scenario of the electronic device is identified; Extract the characteristic signals of the acceleration signal; Based on the detection parameters corresponding to the usage scenario, the knock detection result corresponding to the acceleration signal is determined according to the feature signal. The knock detection result is used to indicate whether the acceleration signal is a signal generated by a knock event.
2. The method according to claim 1, characterized in that, The usage scenarios include a first usage scenario and a second usage scenario, wherein the first usage scenario is a scenario in which the electronic device moves, and the second usage scenario is a scenario in which the electronic device stops moving; the step of determining the tapping detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario includes: In the first usage scenario, based on the first detection parameters corresponding to the first usage scenario, the impact detection result corresponding to the acceleration signal is determined according to the feature signal; or... In the second usage scenario, based on the second detection parameter corresponding to the second usage scenario, the impact detection result corresponding to the acceleration signal is determined according to the feature signal; the detection sensitivity indicated by the first detection parameter is less than the detection sensitivity indicated by the second detection parameter.
3. The method according to claim 1, characterized in that, The detection parameters include peak threshold and peak characteristic conditions; The step of determining the impact detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario includes: Based on the peak threshold corresponding to the usage scenario, peak detection is performed on the feature signal to obtain peak features, which include one or more of the following: peak number, peak width, and time interval between adjacent peaks. If the peak feature satisfies the peak feature condition corresponding to the usage scenario, the knock detection result corresponding to the acceleration signal is determined as the first result. The first result is used to indicate that the acceleration signal is a signal generated by a knock event.
4. The method according to claim 3, characterized in that, The step of determining the impact detection result corresponding to the acceleration signal as the first result when the peak feature satisfies the peak feature condition corresponding to the usage scenario includes: The peak features are filtered by a knock signal constraint model, and if the filtered peak features meet the peak feature conditions corresponding to the usage scenario, the knock detection result corresponding to the acceleration signal is determined as the first result.
5. The method according to claim 3, characterized in that, The detection parameters also include a detection step size. The peak detection of the feature signal based on a peak threshold corresponding to the usage scenario to obtain peak features includes: Based on the peak threshold and the detection step size corresponding to the usage scenario, peak detection is performed on the feature signal to obtain the peak feature.
6. The method according to claim 3, characterized in that, The method further includes: If the impact detection result corresponding to the acceleration signal is the first result, the peak feature is stored in memory; If no update of the peak features stored in the memory is detected within a preset time period, a tapping event is determined based on the peak features stored in the memory.
7. The method according to claim 1, characterized in that, The extraction of feature signals from the acceleration signal includes: The acceleration signal is differentially processed to obtain the characteristic signal.
8. The method according to claim 6, characterized in that, The accelerometer is a multi-axis accelerometer, and the acceleration signal includes acceleration sub-signals corresponding to each of the multiple axes; the differential processing of the acceleration signal to obtain the feature signal includes: Differential processing is performed on the acceleration sub-signals corresponding to each axis to obtain the differential signals corresponding to each axis; The differential signals corresponding to each axis are aggregated to obtain the feature signal.
9. The method according to claim 1, characterized in that, The acceleration signal includes signal values corresponding to multiple sampling points. Before determining the impact detection result corresponding to the acceleration signal based on the feature signal using detection parameters corresponding to the usage scenario, the method further includes: Multiple target sampling points are selected from the feature signal; the target sampling points are sampling points in the feature signal whose signal value amplitude is greater than or equal to a first amplitude threshold. The multiple target sampling points are merged to obtain at least one sampling interval, wherein the sampling interval includes multiple target sampling points, and the sampling interval between the multiple target sampling points is less than or equal to a sampling interval threshold. The step of determining the impact detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario includes: Based on the detection parameters corresponding to the usage scenario, the impact detection result corresponding to the acceleration signal is determined according to the feature signal of the feature signal in the first sampling interval, wherein the first sampling interval is the sampling interval that meets the sampling conditions among the at least one sampling interval.
10. The method according to claim 9, characterized in that, The sampling conditions include one or more of the following: The peak amplitude of the sampling interval is greater than or equal to the peak amplitude threshold; The peak rise time of the sampling interval is less than or equal to the peak rise time threshold; The effective duration of the sampling interval is less than or equal to the effective time threshold; The signal-to-noise ratio of the sampling interval is greater than or equal to the signal-to-noise ratio threshold.
11. The method according to claim 1, characterized in that, The step of determining the impact detection result corresponding to the acceleration signal based on the feature signal according to the detection parameters corresponding to the usage scenario includes: If a first sampling point that meets the admission criteria is detected in the feature signal, the impact detection result corresponding to the acceleration signal is determined based on the feature signal, taking the first sampling point as the starting sampling point and the detection parameters corresponding to the use scenario. The admission criteria include that the amplitude of the signal value corresponding to the sampling point is greater than or equal to the second amplitude threshold, and that the sampling point is a local extremum.
12. The method according to claim 11, characterized in that, The method further includes: If a second sampling point that satisfies the cutoff condition is detected in the feature signal, then the detection based on the detection parameters corresponding to the usage scenario is stopped, and the knocking detection result corresponding to the acceleration signal is determined according to the feature signal. The exit criteria include one or more of the following: The amplitude of the signal value corresponding to the sampling point is less than the third amplitude threshold; The time interval between the sampling point and the first sampling point is greater than or equal to the time interval threshold; The difference between the square of the amplitude of the signal value corresponding to the sampling point and the square of the amplitude of the signal value corresponding to the first sampling point is greater than or equal to the difference threshold.
13. A tapping detection device, characterized in that, Applied to an electronic device, the electronic device including one or more sensors, the one or more sensors including an accelerometer, the impact detection device includes: The acquisition module is used to acquire acceleration signals through the accelerometer. The identification module is used to identify the usage scenario of the electronic device based on sensor data collected by one or more of the sensors. The detection module is used to extract the feature signals of the acceleration signal; based on the detection parameters corresponding to the usage scenario, it determines the knock detection result corresponding to the acceleration signal according to the feature signals, and the knock detection result is used to indicate whether the acceleration signal is a signal generated by a knock event.
14. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program that can run on the processor, and the processor executing the computer program to implement the method according to any one of claims 1 to 12.
15. A computer program, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 12.