Event detection method and device, electronic device, and storage medium
By emitting two ultrasonic signals and analyzing the echo frequency shift spectrum, a neural network is used to identify events that are approaching or moving away, thus solving the problem of accidental touches on mobile phone screens and improving the user experience.
Patent Information
- Application Number
- CN202110172631.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-08
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-02-08
AI Technical Summary
When using mobile devices such as smartphones, the screen is easily touched accidentally, causing calls to be interrupted or paused, which affects the user experience.
By transmitting two ultrasonic signals of different frequencies, receiving and analyzing the frequency shift spectrum of the echo signals, and using a neural network model to identify events that are approaching or moving away, the screen touch response is controlled.
It improves the accuracy of event detection, prevents accidental touches, and enhances the user experience in services such as calls.
Smart Images

Figure CN114943242B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to event detection technology in electronic devices, and more particularly to an event detection method and device, electronic devices, and storage media. Background Art
[0002] Currently, when users use mobile devices such as mobile phones, especially when making calls, they need to place the receiver of the mobile phone against their ears, so that the mobile phone screen is also placed against the user's face. In this way, the mobile phone screen may be accidentally touched, which may automatically hang up the call or put the current call on hold for no reason, etc., causing considerable inconvenience to the user in making and receiving calls. Summary of the invention
[0003] The present invention provides an event detection method and device, an electronic device, and a storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an event detection method, the method comprising:
[0005] transmitting a detection signal;
[0006] receiving an echo signal of the detection signal;
[0007] Acquiring a characteristic value of the echo signal;
[0008] A decision parameter is calculated based on the feature value, and an occurred event is determined based on the decision parameter.
[0009] Optionally, the transmitting detection signal includes:
[0010] Two detection signals with a frequency greater than a set threshold are transmitted; the frequencies of the two detection signals are different.
[0011] Optionally, the acquiring the characteristic value of the echo signal includes:
[0012] Performing frequency shift on the echo signal, and performing low-pass filtering on the frequency-shifted echo signal;
[0013] Performing frequency domain transformation on the echo signal after low-pass filtering to obtain the frequency component of the echo signal;
[0014] The amplitudes of the frequency component of the echo signal and a set number of adjacent frequency components in the frequency component are calculated, and a characteristic vector is formed by the calculated amplitudes to form a frequency shift spectrum, and the frequency shift spectrum is used as a characteristic value of the echo signal.
[0015] Optionally, before performing frequency domain transformation on the echo signal after low-pass filtering, the method further includes:
[0016] The echo signal after low-pass filtering is subjected to downsampling rate processing to reduce the sampling rate of the echo signal after low-pass filtering.
[0017] Optionally, performing frequency domain transformation on the echo signal after low-pass filtering includes:
[0018] The echo signal after low-pass filtering is framed according to a set time length, and the echo signal after frame is multiplied by a window function to perform windowing;
[0019] Perform Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
[0020] Optionally, the calculating the decision parameter based on the characteristic value includes:
[0021] A neural network model or a combination of neural network models is set, and model coefficients of each network layer in the neural network model or the combination of neural network models are generated through training, and a decision parameter is generated based on the correlation between the characteristic value and the model coefficient.
[0022] Optionally, calculating a decision parameter based on the characteristic value, and determining the occurred event based on the decision parameter, includes:
[0023] The frequencies of the two detection signals are f1 and f2, where f2>f1; and detection thresholds T1 and T2 are set;
[0024] Among the characteristic values of the echo signal, the frequency band f lower than the frequency f1 is calculated. 11 to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to f 22 The ratio r2 of the RMS value or mean of the amplitude of the echo signal within and the amplitude of the echo signal at the frequency f2;
[0025] If r1>T1, a moving away event occurs; if r2>T2, an approaching event occurs.
[0026] According to a second aspect of an embodiment of the present disclosure, there is provided an event detection device, including:
[0027] A transmitting unit, used for transmitting a detection signal;
[0028] A receiving unit, used for receiving an echo signal of the detection signal;
[0029] An acquisition unit, used for acquiring a characteristic value of the echo signal;
[0030] A calculation unit, configured to calculate a decision parameter based on the characteristic value;
[0031] A determination unit is used to determine the occurred event based on the decision parameter.
[0032] Optionally, the transmitting unit is further used for:
[0033] Two detection signals with a frequency greater than a set threshold are transmitted; the frequencies of the two detection signals are different.
[0034] Optionally, the acquisition unit is further used to:
[0035] Performing frequency shift on the echo signal, and performing low-pass filtering on the frequency-shifted echo signal;
[0036] Performing frequency domain transformation on the echo signal after low-pass filtering to obtain the frequency component of the echo signal;
[0037] The amplitudes of the frequency component of the echo signal and a set number of adjacent frequency components in the frequency component are calculated, and a characteristic vector is formed by the calculated amplitudes to form a frequency shift spectrum, and the frequency shift spectrum is used as a characteristic value of the echo signal.
[0038] Optionally, the acquisition unit is further used to: before performing frequency domain transformation on the echo signal after low-pass filtering, perform downsampling rate processing on the echo signal after low-pass filtering, so as to reduce the sampling rate of the echo signal after low-pass filtering.
[0039] Optionally, the acquisition unit is further used to:
[0040] The echo signal after low-pass filtering is framed according to a set time length, and the echo signal after frame is multiplied by a window function to perform windowing;
[0041] Perform Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
[0042] Optionally, the computing unit is further used for:
[0043] A neural network model or a combination of neural network models is set, and model coefficients of each network layer in the neural network model or the combination of neural network models are generated through training, and a decision parameter is generated based on the correlation between the characteristic value and the model coefficient.
[0044] Optionally, the computing unit is further used for:
[0045] The frequencies of the two detection signals are f1 and f2, where f2>f1; and detection thresholds T1 and T2 are set;
[0046] Among the characteristic values of the echo signal, the frequency band f lower than the frequency f1 is calculated. 11to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to f 22 The ratio r2 of the RMS value or mean of the amplitude of the echo signal within and the amplitude of the echo signal at the frequency f2;
[0047] Correspondingly, the determining unit is further configured to: if r1>T1, a moving away event occurs; and if r2>T2, a moving approach event occurs.
[0048] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor and a memory for storing processor executable instructions, wherein the processor is configured to execute the event detection method when calling the executable instructions in the memory.
[0049] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, which enables the electronic device to perform the event detection method when instructions in the storage medium are executed by a processor of an electronic device.
[0050] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0051] In the embodiments of the present disclosure, two detection signals of different frequency bands are emitted, where the detection signals are preferably ultrasonic signals, to improve the accuracy of event detection. The receiving end receives the echo signals of the two detection signals, and extracts the spectrum information around the specific frequency bands of the two echo signals to form a frequency shift spectrum. When a mobile terminal device such as a mobile phone approaches or moves away, obvious stripes will appear on the frequency shift spectrum. The present application improves the recognition effect of approaching or moving away events by effectively utilizing the frequency shift information. The embodiments of the present application can perform corresponding touch response control on the screen of the electronic device based on the detection event by detecting the approaching or moving away event between the electronic device and the user's face. When the electronic device is close to the human face, the screen touch response of the electronic device is temporarily turned off, which will not affect the user's services such as answering calls, thereby improving the user's experience.
[0052] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0054] Figure 1A schematic diagram of a flow chart of an event detection method according to an embodiment of the present disclosure;
[0055] Figure 2 This is a schematic diagram showing an example of an event detection method according to an embodiment of the present disclosure;
[0056] Figure 3 It is a schematic diagram of the composition structure of the ultrasonic generator according to an embodiment of the present disclosure;
[0057] Figure 4 It is a schematic diagram of two ultrasonic signals emitted by the signal transmitter according to an embodiment of the present disclosure;
[0058] Figure 5 It is a schematic diagram of the structure of the sound wave receiver according to an embodiment of the present disclosure;
[0059] Figure 6 A schematic diagram of the composition structure of an analyzer shown in an embodiment of the present disclosure;
[0060] Figure 7 A schematic diagram of the structure of the identifier according to an embodiment of the present disclosure;
[0061] Figure 8 A schematic diagram of the structure of an event detection device according to an embodiment of the present disclosure;
[0062] Fig. 9 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0063] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0064] The event detection method described in the embodiments of the present disclosure is applicable to electronic devices such as mobile phone smart terminals, game consoles, laptop computers, PADs, etc.
[0065] Figure 1 FIG. 1 is a flow chart of an event detection method according to an embodiment of the present disclosure. Figure 1 As shown, the event detection method of the embodiment of the present disclosure includes the following steps:
[0066] S11. Transmit a detection signal.
[0067] In an embodiment of the present disclosure, two detection signals with a frequency greater than a set threshold are transmitted; the frequencies of the two detection signals are different. The set threshold here can be 20000 Hz. Generally speaking, a detection signal with a frequency greater than 20000 Hz is an ultrasonic signal. In an embodiment of the present disclosure, the use of ultrasonic signals can improve the accuracy of event detection.
[0068] S12: Receive an echo signal of the detection signal.
[0069] In an embodiment of the present disclosure, echo detection is also performed on the transmitted detection signal, a reflection signal of the detection signal is received, and event detection is performed based on the received echo signal.
[0070] S13: Obtain characteristic values of the echo signal.
[0071] In an embodiment of the present disclosure, obtaining the characteristic value of the echo signal includes:
[0072] The echo signal is frequency-shifted, and the frequency-shifted echo signal is low-pass filtered; the echo signal after low-pass filtering is transformed in the frequency domain to obtain the frequency component of the echo signal; the amplitude of the frequency component of the echo signal and a set number of adjacent frequency components in the frequency component are calculated, and a characteristic vector is formed by the calculated amplitude to form a frequency shift spectrum, and the frequency shift spectrum serves as the characteristic value of the echo signal.
[0073] Before performing frequency domain transformation on the echo signal after low-pass filtering, the echo signal after low-pass filtering may also be subjected to downsampling rate processing to reduce the sampling rate of the echo signal after low-pass filtering. By reducing the sampling rate of the echo signal, the efficiency of determining the characteristic value of the echo signal may be improved.
[0074] In an embodiment of the present disclosure, a frequency domain transform is performed on the echo signal after low-pass filtering, including: dividing the echo signal after low-pass filtering into frames according to a set time length, and multiplying the echo signal after framing by a window function to perform windowing; performing Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
[0075] S14. Calculate a decision parameter based on the characteristic value, and determine an event that occurs based on the decision parameter.
[0076] In the disclosed embodiment, a neural network can be used to determine whether an event has occurred, a neural network model or a combination of neural network models is set, and the model coefficients of each network layer in the neural network model or the combination of neural network models are trained and generated, and the decision parameters are generated based on the correlation between the feature values and the model coefficients. As an example, the neural network model can be composed of an n-layer convolutional neural network model (CNN) and a layer of fully connected composite neural network, or it can be a neural network model of various other forms or a combination thereof. The coefficients of each layer of the neural network are pre-trained model coefficients. The classification result is obtained by calculating the input feature quantity through the neural network, thereby obtaining the approach / distance event recognition result. In the disclosed embodiment, the type of neural network and its training method are not limited. Those skilled in the art should understand that it is easy to determine whether the event to be detected has occurred through a large amount of training on the correlation between the feature value and the distance / approach event.
[0077] In the embodiment of the present disclosure, as another implementation method, it can also be:
[0078] Assume that the frequencies of the two detection signals are f1 and f2, where f2>f1, and set two thresholds T1 and T2;
[0079] Among the characteristic values of the echo signal, the frequency band f lower than the frequency f1 is calculated. 11 to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to f 22 The ratio r2 of the RMS value or mean of the amplitude of the echo signal within and the amplitude of the echo signal at the frequency f2;
[0080] If r1>T1, a moving away event occurs; if r2>T2, an approaching event occurs.
[0081] When an electronic device detects a proximity event, that is, when the distance between the electronic device and an obstacle such as a face is close, the touch response of the touch screen of the electronic device can be turned off to prevent the user from accidentally touching the display screen when answering a call. In the disclosed embodiment, the proximity event can also be combined with the current service to limit the touch response of the touch screen. For example, when the electronic device is in a call, live video broadcast or video call, it can detect whether a proximity event has occurred and limit the touch response of the touch screen. Similarly, when the electronic device detects a distance event, the touch response limit for the touch screen of the electronic device can be lifted.
[0082] The essence of the technical solution of the embodiment of the present disclosure is further illustrated below through specific examples.
[0083] In the embodiment of the present disclosure, a sound-emitting device and a sound-receiving device are provided in the electronic device, the sound-emitting device sends ultrasonic signals with two different frequencies, and the sound-receiving device receives the ultrasonic waves transmitted from the air, and judges the event of the device approaching / moving away from an obstacle by analyzing the time-frequency characteristics of the ultrasonic signal. The frequency shift spectrum of the ultrasonic echo signal is calculated to characterize the difference when an electronic device such as a mobile phone approaches or moves away from an obstacle, and the frequency shift feature is used as the input of the neural network model for state recognition. When detecting the event of approaching / moving away from an obstacle, the embodiment of the present disclosure can use a neural network for event detection.
[0084] Figure 2 FIG. 1 is a schematic diagram showing an example of an event detection method according to an embodiment of the present disclosure. Figure 2 As shown, when the embodiment of the present disclosure is implemented, the electronic device needs to have an ultrasonic generator, a sound wave receiver, an analyzer and an identifier. The ultrasonic generator generates a bandpass ultrasonic signal, which is emitted by a sound wave transmitter such as a speaker, and then the sound wave receiver such as a microphone receives the ultrasonic echo signal propagated from the air. The analyzer analyzes the received ultrasonic echo signal and extracts the corresponding feature quantity of the ultrasonic echo signal, and the identifier identifies the event of the electronic device approaching / moving away from an obstacle based on the feature quantity extracted by the analyzer.
[0085] Figure 3 FIG. 1 is a schematic diagram of the structure of the ultrasonic generator of the embodiment of the present disclosure. Figure 3 As shown, the ultrasonic generator of the embodiment of the present disclosure includes a signal exciter, a DAC analog-to-digital converter and a signal transmitter, etc., wherein the signal transmitter includes a speaker, an earpiece and an ultrasonic transmitter, etc. The ultrasonic signal exciter includes an exciter and a filter, and the ultrasonic signal exciter generates a bandpass ultrasonic signal, which is converted into an analog signal by the digital-to-analog converter and then emitted to the outside by the signal transmitter.
[0086] Figure 4 Schematic diagram of two ultrasonic signals emitted by the signal transmitter of the embodiment of the present disclosure, such as Figure 4 As shown, the upper half of the waveform pattern in the figure is the time domain waveform of the transmitted signal, and the lower half is the spectrum diagram of the transmitted signal.
[0087] Figure 5 FIG. 1 is a schematic diagram of the structure of the sound wave receiver according to an embodiment of the present disclosure. Figure 5 As shown, the sound wave receiver of the embodiment of the present disclosure includes a signal receiver such as a microphone and an ADC digital-to-analog converter. After the signal receiver receives the sound wave signal, it is converted into a digital signal through the ADC analog-to-digital converter and input into the analyzer of the embodiment of the present disclosure for analysis to determine whether an event of approaching / moving away from an obstacle occurs.
[0088] Figure 6The schematic diagram of the structure of the analyzer shown in the embodiment of the present disclosure is as follows: Figure 6 As shown, the analyzer of the embodiment of the present disclosure includes a frequency shift unit, a downsampling unit, a frequency domain transformation unit, a feature quantity calculation unit and a feature quantity combination unit, wherein:
[0089] The frequency shift unit performs frequency shift on the received echo signal W, the purpose of which is to shift the center frequency of the echo signal of the ultrasonic signal to zero frequency, and then perform low-pass filtering to extract the sound wave signal of the frequency band required for subsequent processing. After this processing, the frequency-shifted sound wave signal Wshift is obtained. The frequency shift calculation formula is as follows:
[0090] b=2×pi×(f0-ft)×r / fs, r=0,1,2,…
[0091] Wshift=W×exp(-i×b)
[0092] Among them, f0 is the original frequency, ft is the target frequency, b is the phase value of the echo signal, and exp is the exponential function with the natural constant e as the base.
[0093] Where exp(-i×b) is converted from Euler's formula into the following form:
[0094] exp(-i×θ)=cos(-θ)+i×sin(-θ)=cosθ–i×sinθ
[0095] Analysis shows that when the target spectrum is determined, the calculation results of the trigonometric function in the above formula are periodic. Therefore, the trigonometric function values of a period can be stored to obtain the trigonometric function values of the corresponding sound wave phase, and obtain the frequency-shifted sound wave signal, which reduces processing power consumption.
[0096] After being processed by the frequency shift unit, the frequency of the sound wave signal is distributed in a lower frequency band. Then the ultrasonic signal Wshift is passed to the downsampling unit for downsampling to obtain the sampled sound signal Wdown, so as to reduce the amount of data and simplify the calculation.
[0097] The frequency domain transformation unit performs frequency domain transformation on the downsampled acoustic wave signal Wdown to obtain the frequency components of the signal for calculation by the feature quantity calculation unit. First, the signal Wdown needs to be framed and windowed. The frame processing is to frame the object to be processed according to the set time length. The set time length here can be 10ms, 20ms, etc. The echo signal after framing is multiplied by the window function for windowing. In the disclosed embodiment, framing is to ensure the short-term nature of the processed data, and windowing is to reduce spectrum energy leakage. In the disclosed embodiment, the window functions that can be used are such as the Black-Harris window, the triangular window, the Hamming window, etc. Then, a frequency domain transformation is performed. The frequency domain transformation can use fast Fourier transform (FFT), discrete cosine transform (DCT), etc., and the transformed signal is F. Here, the frequency domain resolution after the frequency domain transformation is assumed to be n (n-point FFT), that is, each frame of F contains F(1)...F(n)n frequency components.
[0098] The frequency shift spectrum calculation unit calculates the amplitudes of the two frequency components corresponding to the ultrasonic transmission signal of each frame of audio data and the m frequency components around them to form a frequency shift spectrum. The specific calculation method is as follows:
[0099] The calculation formula for the amplitude of each frequency component is as follows:
[0100]
[0101] Wherein, k represents the kth frequency component in the frequency domain transformation result, re(k) represents the real part of the frequency component, and im(k) represents the imaginary part of the frequency component.
[0102] The amplitudes corresponding to a total of 2m+2 frequency components are obtained by the above calculation method to form a 2m+2-dimensional feature vector. The feature vector calculated using L consecutive frames of audio data constitutes a frequency shift spectrum, which is used as the input of the subsequent identifier to identify events of approaching or moving away from obstacles.
[0103] When the device approaches an obstacle, the frequency of the received signal will move toward the high frequency direction. When the device moves away from the obstacle, the frequency of the received signal will move toward the low frequency direction. This feature can be used to distinguish and identify events of the device approaching / moving away from an obstacle.
[0104] Figure 7 FIG. 1 is a schematic diagram of the structure of the identifier according to an embodiment of the present disclosure. Figure 7 As shown, the recognizer of the embodiment of the present disclosure can be a neural network. The neural network model can be composed of an n-layer convolutional neural network model (CNN) and a layer of fully connected composite neural network, or it can be a neural network model of various other forms or a combination thereof. The coefficients of each layer of the neural network are pre-trained model coefficients. The classification result is obtained by calculating the input feature quantity through the neural network, thereby obtaining the approach / distance event recognition result.
[0105] The recognizer can also be a calculation and discrimination unit, which uses the frequency shift features calculated in the analyzer and combines some judgment method, such as threshold judgment, to obtain the final event recognition result. The specific method is as follows:
[0106] Assume that the frequencies of the two ultrasonic waves emitted are f1 and f2 respectively, where f2>f1, and set two thresholds T1 and T2.
[0107] Calculate the frequency band f that is lower than f1 11 ~f 12 The ratio r1 of the root mean square value or mean of the internal ultrasonic signal amplitude to the ultrasonic signal amplitude at the frequency f1.
[0108] Mean method:
[0109]
[0110] Wherein, F(·) represents the amplitude of the corresponding ultrasonic signal at the corresponding frequency;
[0111] RMS method:
[0112]
[0113] If r1>T1, a run-away event occurs, otherwise no run-away event occurs.
[0114] Calculate the frequency band f with higher frequency than f2 21 ~f 22 The ratio r2 of the root mean square value or mean of the internal ultrasonic signal amplitude and the ultrasonic signal amplitude at the frequency f2.
[0115] Mean method:
[0116]
[0117] Wherein, F(·) represents the amplitude of the corresponding ultrasonic signal at the corresponding frequency;
[0118] RMS method:
[0119]
[0120] If r2>T2, a proximity event occurs, otherwise no proximity event occurs.
[0121] The embodiment of the present disclosure transmits two ultrasonic signals of different frequency bands, and the receiving end receives the echo signals of the two detection signals, and extracts the spectrum information around the specific frequency band of the two echo signals to form a frequency shift spectrum. When a mobile terminal device such as a mobile phone approaches or moves away, obvious stripes will appear on the frequency shift spectrum. The present application improves the recognition effect of approaching or moving away events by effectively utilizing the frequency shift information. The embodiment of the present application can detect the approaching or moving away events between the electronic device and the user's face, and can control the touch response of the screen of the electronic device accordingly based on the detection event. When the electronic device is close to the human face, the screen touch response of the electronic device is temporarily turned off, which will not affect the user's services such as answering calls, thereby improving the user's experience.
[0122] Figure 8 FIG. 1 is a schematic diagram showing the structure of an event detection device according to an embodiment of the present disclosure. Figure 8 As shown, the event detection device of the embodiment of the present disclosure includes:
[0123] A transmitting unit 80, used for transmitting a detection signal;
[0124] A receiving unit 81, configured to receive an echo signal of the detection signal;
[0125] An acquisition unit 82, configured to acquire a characteristic value of the echo signal;
[0126] A calculation unit 83, configured to calculate a decision parameter based on the characteristic value;
[0127] The determination unit 84 is configured to determine an event that has occurred based on the decision parameter.
[0128] Optionally, the transmitting unit 80 is further used for:
[0129] Two detection signals with a frequency greater than a set threshold are transmitted; the frequencies of the two detection signals are different.
[0130] Optionally, the acquiring unit 82 is further configured to:
[0131] Performing frequency shift on the echo signal, and performing low-pass filtering on the frequency-shifted echo signal;
[0132] Performing frequency domain transformation on the echo signal after low-pass filtering to obtain the frequency component of the echo signal;
[0133] The amplitudes of the frequency component of the echo signal and a set number of adjacent frequency components in the frequency component are calculated, and a characteristic vector is formed by the calculated amplitudes to form a frequency shift spectrum, and the frequency shift spectrum is used as a characteristic value of the echo signal.
[0134] Optionally, the acquisition unit 82 is further used to: before performing frequency domain transformation on the echo signal after low-pass filtering, perform downsampling processing on the echo signal after low-pass filtering to reduce the sampling rate of the echo signal after low-pass filtering.
[0135] Optionally, the acquiring unit 82 is further configured to:
[0136] The echo signal after low-pass filtering is framed according to a set time length, and the echo signal after frame is multiplied by a window function to perform windowing;
[0137] Perform Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
[0138] Optionally, the computing unit 83 is further configured to:
[0139] A neural network model or a combination of neural network models is set, and model coefficients of each network layer in the neural network model or the combination of neural network models are generated through training, and a decision parameter is generated based on the correlation between the characteristic value and the model coefficient.
[0140] Optionally, the computing unit 83 is further configured to:
[0141] The frequencies of the two detection signals are f1 and f2, where f2>f1; and detection thresholds T1 and T2 are set;
[0142] Among the characteristic values of the echo signal, the frequency band f lower than the frequency f1 is calculated. 11 to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to f 22 The ratio r2 of the RMS value or mean of the amplitude of the echo signal within and the amplitude of the echo signal at the frequency f2;
[0143] Correspondingly, the determining unit 84 is further configured to: if r1>T1, a moving away event occurs; and if r2>T2, a moving approach event occurs.
[0144] In an exemplary embodiment, the transmitting unit 80, the receiving unit 81, the acquiring unit 82, the calculating unit 83, the determining unit 84, etc. may be implemented by one or more central processing units (CPU), graphics processing units (GPU), baseband processors (BP), application specific integrated circuits (ASIC), digital signal processors (DSP), programmable logic devices (PLD), complex programmable logic devices (CPLD), field programmable gate arrays (FPGA), general-purpose processors, controllers, microcontrollers (MCU), microprocessors, or other electronic components, and may also be implemented in combination with one or more radio frequency (RF) antennas to execute the communication methods of the aforementioned embodiments.
[0145] In the disclosed embodiment, Figure 8 The specific manner in which each unit in the display processing device shown performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0146] Fig. 9 is a block diagram of an electronic device 800 according to an exemplary embodiment. Fig. 9 As shown, the electronic device 800 supports multi-screen output, and the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0147] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0148] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0149] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0150] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0151] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0152] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0153] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0154] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0155] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the event detection methods of the above-described embodiments.
[0156] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to complete the event detection method of the above embodiment. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0157] The embodiment of the present disclosure also records a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform a control method. The method includes:
[0158] transmitting a detection signal;
[0159] receiving an echo signal of the detection signal;
[0160] Acquiring a characteristic value of the echo signal;
[0161] A decision parameter is calculated based on the feature value, and an occurred event is determined based on the decision parameter.
[0162] The embodiment of the present disclosure also records a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform a control method. The method includes:
[0163] transmitting a detection signal;
[0164] receiving an echo signal of the detection signal;
[0165] Acquiring a characteristic value of the echo signal;
[0166] A decision parameter is calculated based on the feature value, and an occurred event is determined based on the decision parameter.
[0167] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0168] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An event detection method, applied to an electronic device, characterized in that: The method comprises: Two detection signals having a transmission frequency greater than a set threshold value; the two detection signals have different frequencies; receiving an echo signal of the detection signal; Based on the echo signal, a characteristic value of the echo signal is obtained; the characteristic value is: a characteristic value obtained by forming a frequency shift spectrum according to the amplitudes of a center frequency component and a set number of frequency components around the center frequency component; the center frequency component is obtained according to the frequency component of the echo signal; Calculating a decision parameter based on the characteristic value, and determining whether the electronic device is close to or far away from the target object based on the decision parameter, including: The frequencies of the two detection signals are f1 and f2, where f2>f1; and detection thresholds T1 and T2 are set; Among the characteristic values of the echo signal, the frequency band f lower than the frequency f1 is calculated. 11 to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to the ratio r2 of the RMS value or mean of the amplitude of the echo signal within f2 to the amplitude of the echo signal at the frequency f2; If r1>T1, it is determined that the electronic device is far away from the target object; if r2>T2, it is determined that the electronic device is close to the target object.
2. The method according to claim 1, characterized in that The acquiring the characteristic value of the echo signal comprises: Performing frequency shift on the echo signal, and performing low-pass filtering on the frequency-shifted echo signal; Performing frequency domain transformation on the echo signal after low-pass filtering to obtain the frequency component of the echo signal; The frequency component corresponding to the frequency of the detection signal is used as the central frequency component, and the frequency shift spectrum is formed by forming a characteristic vector with the amplitude, and the frequency shift spectrum is used as a characteristic value of the echo signal.
3. The method according to claim 2, characterized in that Before performing frequency domain transformation on the echo signal after low-pass filtering, obtaining the characteristic value of the echo signal further includes: The sampling rate of the echo signal after the low-pass filtering is reduced to reduce the sampling rate of the echo signal after the low-pass filtering.
4. The method according to claim 2, characterized in that: The performing frequency domain transformation on the echo signal after low-pass filtering comprises: The echo signal after low-pass filtering is framed according to a set time length, and the framed echo signal is multiplied by a window function to perform windowing on the framed echo signal; Perform Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
5. The method according to claim 1, characterized in that The calculating the decision parameter based on the characteristic value comprises: A neural network model or a combination of neural network models is set, and model coefficients of each network layer in the neural network model or the combination of neural network models are generated through training, and a decision parameter is generated based on the correlation between the characteristic value and the model coefficient.
6. An event detection device, applied to an electronic device, characterized in that: The device comprises: A transmitting unit, used for transmitting two detection signals with frequencies greater than a set threshold; the two detection signals have different frequencies; A receiving unit, used for receiving an echo signal of the detection signal; an acquisition unit, configured to acquire a characteristic value of the echo signal based on the echo signal; the characteristic value is a characteristic value obtained by forming a frequency shift spectrum according to the amplitudes of a center frequency component and a set number of frequency components around the center frequency component; the center frequency component is obtained according to the frequency component of the echo signal; A calculation unit, configured to calculate a decision parameter based on the characteristic value; A determination unit, for determining whether the electronic device is close to or far from a target object based on the decision parameter; comprising: the frequencies of the two detection signals are f1 and f2, wherein f2>f1; and setting detection thresholds T1 and T2; in the characteristic value of the echo signal, calculating a frequency band f lower than the frequency f1 11 to f 12 The ratio r1 of the amplitude root mean square value or mean of the echo signal within the frequency band f1 to the amplitude of the echo signal at the frequency f1; calculate the frequency band f2 with a frequency higher than f2. 21 to f 22 The ratio r2 of the RMS value or mean of the amplitude of the echo signal within and the amplitude of the echo signal at the frequency f2; correspondingly, the determination unit is also used to: if r1>T1, determine that the electronic device is far away from the target object; if r2>T2, determine that the electronic device is close to the target object.
7. The device according to claim 6, characterized in that The acquisition unit is further used for: Performing frequency shift on the echo signal, and performing low-pass filtering on the frequency-shifted echo signal; Performing frequency domain transformation on the echo signal after low-pass filtering to obtain the frequency component of the echo signal; The frequency component corresponding to the frequency of the detection signal is used as the central frequency component, and the frequency shift spectrum is formed by forming a characteristic vector with the amplitude, and the frequency shift spectrum is used as a characteristic value of the echo signal.
8. The device according to claim 7, characterized in that The acquisition unit is further used to: before performing frequency domain transformation on the echo signal after low-pass filtering, perform downsampling rate processing on the echo signal after low-pass filtering to reduce the sampling rate of the echo signal after low-pass filtering.
9. The device according to claim 7, characterized in that The acquisition unit is further used for: The echo signal after low-pass filtering is framed according to a set time length, and the framed echo signal is multiplied by a window function to perform windowing on the framed echo signal; Perform Fourier transform or discrete cosine transform on the windowed echo signal to obtain the frequency component of the echo signal.
10. The device according to claim 6, characterized in that The computing unit is further used for: A neural network model or a combination of neural network models is set, and model coefficients of each network layer in the neural network model or the combination of neural network models are generated through training, and a decision parameter is generated based on the correlation between the characteristic value and the model coefficient.
11. An electronic device, characterized in that: The electronic device comprises: a processor and a memory for storing processor executable instructions, wherein the processor is configured to execute the event detection method according to any one of claims 1 to 5 when calling the executable instructions in the memory. 12 . A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the event detection method as claimed in any one of claims 1 to 5.
