An accidental touch prevention method, an accidental touch prevention device, an electronic device, and a storage medium
By adjusting the algorithm parameters of the PIR sensor to enhance the filtering intensity, the problem of accidental activation of the PIR sensor was solved, thus saving resources and reducing accidental activation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 杭州普联系统技术有限公司
- Filing Date
- 2023-09-05
- Publication Date
- 2026-05-29
AI Technical Summary
PIR sensors are susceptible to environmental interference such as light sources and heat sources, leading to frequent false triggering and wasted resources.
By adjusting the preset algorithm parameters when the number of false touches of the PIR sensor reaches a preset threshold, the filtering strength for false touches is enhanced, and the judgment rigor is improved.
Reduce the possibility of false triggering of PIR sensors, save product resources, and achieve a balance between filtration strength and prevention of false triggering.
Smart Images

Figure CN117198024B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of security technology, and in particular relates to a method, device, electronic device and computer-readable storage medium for preventing accidental touch. Background Technology
[0002] Currently, pyroelectric infrared (PIR) sensors are widely used in human motion detection functions of products such as smart doorbells, smart locks, and network cameras. They use a Fresnel lens to focus 10μm wavelength infrared light emitted by a human body onto the PIR sensor, dividing the space in front into multiple adjacent sensitive detection areas (bright areas) and non-sensitive detection areas (dark areas). When a human body crosses the edge of the bright / dark area, the infrared light focused on the PIR sensor generates a weak electrical signal through the pyroelectric effect. After post-filtering and amplification, the signal waveform is obtained and used for logical judgment in human motion detection.
[0003] Because of its low power consumption, the PIR sensor can continue to operate even in the product's low-power state. Once the logic determines that human movement has been detected, the PIR sensor outputs a trigger signal to activate other modules in the product for further processing based on the detected human movement. It's important to understand that PIR sensor operation and PIR sensor triggering are different concepts: PIR sensor operation refers to the PIR sensor being in a working state; PIR sensor triggering refers to the PIR sensor confirming that human movement has been detected.
[0004] Currently, because the signal waveform of PIR sensors is easily affected by environmental interference such as light sources and heat sources, false triggering often occurs, resulting in a waste of product resources. Summary of the Invention
[0005] This application provides a method, device, electronic device, and computer-readable storage medium for preventing accidental touches, which can reduce the possibility of accidental touches on PIR sensors and save product resources.
[0006] Firstly, this application provides a method for preventing accidental touches, including:
[0007] Within a first preset time period, the number of times the pyroelectric infrared (PIR) sensor was accidentally touched was obtained;
[0008] If the number of accidental touches reaches a preset threshold, the filtering strength of the PIR sensor for accidental touch scenarios is enhanced by adjusting the preset algorithm parameters of the PIR sensor.
[0009] Secondly, this application provides a device for preventing accidental touches, comprising:
[0010] The acquisition module is used to acquire the number of times the pyroelectric infrared (PIR) sensor is accidentally touched within a first preset time period.
[0011] The control module is used to enhance the filtering strength of the PIR sensor for accidental touch scenarios by adjusting the preset algorithm parameters of the PIR sensor when the number of accidental touches reaches a preset threshold.
[0012] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect.
[0013] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.
[0014] Fifthly, this application provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the method described in the first aspect.
[0015] The advantages of this application compared to existing technologies are as follows: To avoid frequent false triggering of the PIR sensor, this application proposes a flexible adjustment of the PIR sensor's filtering intensity, specifically referring to the filtering intensity for false trigger scenarios. Specifically, when the number of false triggers of the PIR sensor reaches a preset threshold, i.e., when the PIR sensor is falsely triggered multiple times, the filtering intensity of the PIR sensor can be increased by adjusting the preset algorithm parameters of the PIR sensor, making the PIR sensor's determination of whether a trigger has occurred more stringent. This process helps reduce the possibility of false triggering of the PIR sensor and saves product resources.
[0016] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram illustrating the implementation process of the anti-accidental touch method provided in the embodiments of this application;
[0019] Figure 2 This is a structural block diagram of the anti-accidental touch device provided in the embodiments of this application;
[0020] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0021] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0022] To illustrate the technical solution proposed in this application, specific embodiments are described below.
[0023] The method for preventing accidental touches provided in this application can be applied to electronic devices. Specifically, the electronic device can be a device integrating a PIR sensor, such as a smart doorbell, smart lock, or network camera; or it can be other devices used to control the device integrating the PIR sensor. This application does not limit the specific type of the electronic device. The following description uses a device integrating a PIR sensor as an example to illustrate the method for preventing accidental touches, and its implementation process is detailed below:
[0024] Step 101: Within the first preset time period, obtain the number of times the PIR sensor is accidentally touched.
[0025] The electronic device may have a pre-set statistical duration and divide the first preset time period based on the statistical duration; or, the electronic device may also divide the first preset time period into multiple first preset time periods based on the statistical duration. The embodiments of this application do not limit the way the first preset time period is divided.
[0026] In some examples, the first preset time period can be a time period with the current time as the end time and the statistical duration as the span; or, the first preset time period can be a time period with the preset algorithm parameter setting / update time as the start time and the statistical duration as the span, which is not limited here.
[0027] Within a first preset time period, each time the PIR sensor of the electronic device is triggered, the electronic device can determine whether the trigger is a false trigger. If it is determined that the PIR sensor has been falsely triggered, the number of false triggers for the PIR sensor can be updated, that is, the number of false triggers is incremented by one.
[0028] In some embodiments, considering that accidental touches of the PIR sensor cannot be completely avoided, users can generally tolerate a small number of intermittent accidental touches of the PIR sensor. Based on this, in the embodiments of this application, the number of accidental touches can specifically be: the number of consecutive accidental touches. That is, during the process of counting the number of accidental touches within a first preset time period, as long as the current trigger of the PIR sensor is a normal trigger (not an accidental touch), the electronic device can immediately reset the number of accidental touches to 0.
[0029] It should be noted that the number of accidental touches can be initialized to 0 after the electronic device is powered on and started.
[0030] Step 102: When the number of accidental touches reaches a preset threshold, the filtering strength of the PIR sensor for accidental touch scenarios is enhanced by adjusting the preset algorithm parameters of the PIR sensor.
[0031] The triggering algorithm of a PIR sensor consists of one or more judgment conditions. Whether or not these conditions are met determines whether the PIR sensor has been triggered. These judgment conditions are each set by their respective preset algorithm parameters. Therefore, the triggering algorithm (specifically, the preset algorithm parameters) is actually related to the PIR sensor's filtering strength for accidental touch scenarios.
[0032] To prevent frequent accidental touches on electronic devices, a preset threshold number of touches can be set. This threshold is used to determine whether the accidental touches of the PIR sensor have reached a serious level. If the number of accidental touches on the PIR sensor has reached this threshold, it can be considered that the current accidental touches of the PIR sensor are quite serious, meaning that the triggering algorithm used by the PIR sensor has a certain judgment error. In this case, the electronic device can adjust the preset algorithm parameters of the PIR sensor to enhance the filtering strength of the PIR sensor for accidental touch scenarios. After adjusting the preset algorithm parameters, the number of accidental touches on the PIR sensor can be reset to zero, and the process returns to step 101 to determine whether it is necessary to continue adjusting the preset algorithm parameters, that is, whether it is necessary to further enhance the filtering strength of the PIR sensor for accidental touch scenarios.
[0033] In some embodiments, the electronic device may be configured with accidental touch levels, wherein different accidental touch levels correspond to different preset algorithm parameters, and the accidental touch level is positively correlated with the filtering strength of the PIR sensor for accidental touch scenarios; that is, the higher the accidental touch level, the greater the filtering strength of the PIR sensor for accidental touch scenarios based on the preset algorithm parameters corresponding to that accidental touch level. In this way, when the number of accidental touches reaches a preset threshold, the electronic device can increase its accidental touch level, thereby enabling the triggering algorithm to enhance the filtering strength of the PIR sensor for accidental touch scenarios by selecting the preset algorithm parameters corresponding to that accidental touch level.
[0034] In some embodiments, environmental interference with the PIR sensor is typically not long-lasting. Therefore, the electronic device may also be configured with the following control strategy to reduce false touch levels, i.e., to reduce the filtering strength of the PIR sensor for false touch scenarios, in order to reduce missed and delayed alarms caused by high false touch levels:
[0035] If the false touch level is not at the default level, as long as the current trigger of the PIR sensor is a normal trigger (not a false touch), the false touch level can be immediately reset to the default level. This restores the filtering strength of the PIR sensor for false touch scenarios to the default filtering strength, so as to minimize missed detections.
[0036] If the electronic device remains in the false touch level for a duration corresponding to the first duration threshold, and the number of consecutive false touches of the PIR sensor during this period does not reach the preset number threshold, the false touch level can be immediately reset to the default level. This restores the filtering strength of the PIR sensor for false touch scenarios to the default false touch level, thus avoiding the inability to exit the high false touch level or the fluctuation between two adjacent false touch levels.
[0037] If the electronic device is in a false touch level that is not the default level, and the duration of the false touch level reaches the corresponding second duration threshold, and the PIR sensor is not triggered during this process, the false touch level can be immediately reduced. Specifically, the false touch level is lowered by one level, thereby reducing the filtering intensity of the PIR sensor for false touch scenarios to a certain extent, so as to achieve slow adaptation.
[0038] In this embodiment, the first duration threshold corresponding to each accidental touch level other than the default level can be different or the same; similarly, the second duration threshold corresponding to each accidental touch level other than the default level can be different or the same. Specifically, the first duration threshold and the second duration threshold corresponding to each accidental touch level other than the default level can be determined based on one or more of the following evaluation factors: the sleep / wake-up power consumption of the electronic device, the wake-up duration, the trigger interval of the PIR sensor, the battery power, and the target battery life. This embodiment does not limit these factors. For example, in extreme cases, without using the anti-accidental touch method proposed in this embodiment, the electronic device can last for 5 days under continuous triggering of the PIR sensor; if the target battery life is 60 days, the first duration threshold and the second duration threshold corresponding to each accidental touch level other than the default level can be calculated using the selected evaluation factors to achieve the target battery life.
[0039] It should be noted that the accidental touch level can be initialized to the default level after the electronic device is powered on and started. This default level can be the lowest level. Correspondingly, the filtering strength corresponding to the lowest accidental touch level is the lowest strength. That is, the default filtering strength for accidental touch scenarios when the electronic device is powered on and started is actually the lowest strength.
[0040] As an example only, the accidental touch levels of an electronic device can be set to four levels: level 0 to level 4. Level 0 is the default level, and level 4 is the highest level. Taking a preset duration of 60 minutes, a threshold of 3 touches, a first duration threshold of 6 hours for each accidental touch level, and a second duration threshold of 60 minutes for each accidental touch level as an example, the control of the accidental touch levels of the electronic device based on the accidental touch prevention method proposed in this application is as follows:
[0041] After powering on, the electronic device defaults to level 0 and starts a timer. If its PIR sensor experiences three consecutive false touches within 60 minutes, it will be upgraded to level 1; otherwise, it will remain at level 0.
[0042] Upon entering Level 1, a new timer is started. If the PIR sensor is accidentally triggered 3 times consecutively within 60 minutes, the system will be upgraded to Level 2; if the PIR sensor is triggered normally, or the electronic device remains in Level 1 for 6 hours, the system will be downgraded to Level 0; if the PIR sensor is not triggered within 60 minutes, the system will be downgraded by 1 level to Level 0; otherwise, the system will remain in Level 1.
[0043] Upon entering Level 2, a new timer is initiated. If the PIR sensor experiences three consecutive false triggers within 60 minutes, the system will be upgraded to Level 3. If the PIR sensor is triggered normally, or the electronic device remains in Level 2 for 6 hours, the system will be downgraded to Level 0. If the PIR sensor is not triggered within 60 minutes, the system will be downgraded by one level to Level 1. Otherwise, the system will remain in Level 2.
[0044] Upon entering Level 3, a new timer is initiated. If the PIR sensor is triggered normally, or the electronic device remains in Level 3 for 6 hours, the sensor will be directly downgraded to Level 0; if the PIR sensor is not triggered within 60 minutes, it will be downgraded by 1 level to Level 2; otherwise, it will remain in Level 3.
[0045] Therefore, the solution of this application can adaptively adjust the level of accidental touch based on the situation of accidental touch of the PIR sensor of the electronic device, including intelligently increasing the level of accidental touch and intelligently decreasing the level of accidental touch. Since different levels of accidental touch correspond to different preset algorithm parameters, and these preset algorithm parameters are directly related to the filtering intensity of the PIR sensor for accidental touch scenarios, the PIR sensor can operate at a filtering intensity that does not cause too many accidental touches, thus achieving a balance between filtering intensity and preventing accidental touches.
[0046] In some embodiments, an electronic device may determine whether the triggering of its PIR sensor is a false triggering by means of the following process:
[0047] A1. By using a preset triggering algorithm, the sampling amplitude of the PIR sensor is triggered to determine whether the PIR sensor has been triggered.
[0048] As described earlier, the triggering algorithm actually consists of more than one judgment condition, and these judgment conditions are each set by their respective preset algorithm parameters. Based on this, the electronic device can determine whether the PIR sensor has been triggered by judging the sampling amplitude of the PIR sensor according to the preset algorithm parameters currently used by the triggering algorithm.
[0049] In some examples, when an electronic device has a set accidental touch level, the device can determine the current accidental touch level, and then determine the algorithm processing flow and the preset algorithm parameters to be used in the accidental touch algorithm. Based on the determined triggering algorithm, the electronic device can perform a trigger judgment on the sampling amplitude value collected by the PIR sensor to determine whether the PIR sensor has been triggered.
[0050] A2. Analyze the video obtained by the image sensor after confirming that the PIR sensor has been triggered.
[0051] In addition to integrating a PIR sensor, electronic devices may also integrate other sensors. These other sensors generally have higher detection accuracy than PIR sensors, but lower detection efficiency. In some examples, these other sensors may be image sensors; this application does not limit this. After the PIR sensor is triggered, to determine whether the trigger is false or normal, real-time video can be acquired through an image sensor, and the video can be analyzed using image processing technology. Specifically, this involves analyzing whether the video contains a user-defined target object to be detected, such as a moving human body.
[0052] A3. If the analysis results indicate that there is no target object in the video, the triggering of the PIR sensor is determined to be a false trigger.
[0053] It is understandable that if the analysis results indicate that there is no target object in the video, it means that there is actually no target object that the user is interested in. In this case, the PIR sensor should not actually be triggered, that is, the triggering of the PIR sensor this time should be a false trigger.
[0054] A4. If the analysis results indicate that a target object exists in the video, the PIR sensor triggering is determined to be normal.
[0055] It is understandable that if the analysis results indicate the presence of a target object in the video, it means that there is actually a target that the user is interested in detecting. In this case, the PIR sensor should indeed be triggered, that is, the triggering of the PIR sensor this time should be a normal triggering.
[0056] In some examples, electronic devices can consist of two types of chips: a low-power chip and a main control chip. To conserve resources, the main control chip can be in sleep mode, with only the low-power chip remaining operational. When the low-power chip determines that the PIR sensor has been triggered, it can wake up the main control chip. After the main control chip starts up, it can determine the presence of a target object through real-time video obtained from the image sensor. If a target object is present, it can notify the low-power chip. In this way, as long as the low-power chip receives this notification before the main control chip is powered off and put into sleep mode, it knows that the PIR sensor triggering was normal; otherwise, it is a false triggering.
[0057] In some embodiments, when the false touch level is the default level, a simpler triggering algorithm can be used. In some examples, this simpler triggering algorithm can be specifically defined as follows: if the difference between the number of sample amplitudes exceeding a specified threshold and the number of sample amplitudes not exceeding the specified threshold within a certain period of time is greater than a specified value, it can be determined that the PIR sensor has been triggered; otherwise, it can be determined that the PIR sensor has not been triggered.
[0058] In some embodiments, when the false touch level is not the default level, a more complex triggering algorithm may be used. In some examples, this more complex triggering algorithm may specifically be as follows: determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet a preset judgment condition; if the preset number of consecutive sampling amplitudes meet the judgment condition, determine that the PIR sensor has been triggered; otherwise, if the preset number of consecutive sampling amplitudes do not meet the judgment condition, determine that the PIR sensor has not been triggered.
[0059] Specifically, the second preset time period is a time period ending at the current time and spanning a preset duration; that is, the second preset time period is the most recent period that has just passed. Therefore, the first preset number of consecutive sampling amplitudes of the PIR sensor within the second preset time period actually refers to the latest consecutive first preset number of sampling amplitudes obtained by the PIR sensor.
[0060] It is understood that this number of consecutive presets is one of the preset algorithm parameters mentioned above; that is, this number of consecutive presets can be set according to the level of accidental touch. Generally speaking, the higher the level of accidental touch, the larger the number of consecutive presets can be set.
[0061] In the first application scenario, the electronic device can determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet the preset judgment conditions in the following way:
[0062] B1. Determine whether the PIR sensor's consecutive first preset number of sampling amplitudes within the second preset time period are all within the first amplitude range.
[0063] The preset quantity includes: a first preset quantity; the first amplitude interval can be composed of a first upper limit value and a first lower limit value; that is, the two endpoints of the first amplitude interval are the first upper limit value and the first lower limit value, respectively. Let the first lower limit value be A_min, the first upper limit value be B_max, and the first preset quantity be N_max, then the first amplitude interval can be expressed as [A_min, B_max]. The above process is actually: the electronic device determines whether all N_max consecutive sampled amplitude values are less than A_min or greater than B_max.
[0064] It is understood that, in addition to the first preset quantity, the first upper limit and the first lower limit are also among the preset algorithm parameters mentioned above; that is, the first upper limit and the first lower limit can be dynamically set according to the level of accidental touch. However, it should be noted that the first upper limit should be close to the upper limit of the sampling amplitude that the PIR sensor can obtain, and the first lower limit should be close to the lower limit of the sampling amplitude that the PIR sensor can obtain.
[0065] B2. If none of the first preset number of consecutive sampling amplitudes are within the first amplitude range, determine that the first preset number of consecutive sampling amplitudes obtained by the PIR sensor within the second preset time period meet the judgment condition.
[0066] For each of the first preset number of consecutive sampled amplitudes, if all of them are less than A_min or greater than B_max, then it can be determined that these first preset number of consecutive sampled amplitudes are not within the first amplitude range, that is, they are all close to the upper and lower limits of the sampled amplitudes that the PIR sensor can obtain. In this case, it can be determined that these first preset number of consecutive sampled amplitudes of the PIR sensor within the second preset time period meet the judgment condition, and it can be confirmed that the PIR sensor has been triggered.
[0067] In the second application scenario, electronic devices can also determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions in the following way:
[0068] C1. Determine the number of the first amplitude and the number of the second amplitude in the current buffered data frame.
[0069] The preset quantity includes a second preset quantity. The electronic device can pre-create a buffer array, the size of which is determined according to the second consecutive preset quantity. It can be understood that each time the electronic device reads a sample amplitude value, it stores that sample amplitude value in the buffer array until the buffer array is full, thus obtaining a buffered data frame. Afterwards, the buffer array can be cleared to obtain the next buffered data frame; this will not be elaborated further here. Based on the process of acquiring the buffered data frame, the current buffered data frame refers to a data frame composed of a second preset quantity of consecutive sample amplitude values from the PIR sensor within a second preset time period.
[0070] After receiving each buffered data frame, the electronic device compares each sampled amplitude in the buffered data frame with the second upper limit and the second lower limit, thereby obtaining the first amplitude count and the second amplitude count. The first amplitude count is the number of sampled amplitudes greater than the second lower limit, and the second amplitude count is the number of sampled amplitudes less than the second upper limit. Let the second lower limit be A, the second upper limit be B, and the second preset count be x. Then, the first amplitude count is actually the number of sampled amplitudes greater than A among x consecutive sampled amplitudes included in the buffered data frame; the second amplitude count is actually the number of sampled amplitudes less than B among x consecutive sampled amplitudes included in the buffered data frame.
[0071] C2. Sum the number of first values in the current cached data frame with the number of first values in the historical cached data frames to obtain the first sum value.
[0072] C3. Sum the number of second amplitude values in the current cached data frame with the number of second amplitude values in the historical cached data frames to obtain the second sum value.
[0073] The historical cached data frame is the frame preceding the current cached data frame. Clearly, upon receiving this historical cached data frame, as the most recently obtained cached data frame, the electronic device also obtains the first and second amplitude counts of that historical cached data frame. The electronic device can sum the first amplitude counts corresponding to the current cached data frame and the historical cached data frame respectively, thus obtaining a first sum; similarly, the electronic device can also sum the second amplitude counts corresponding to the current cached data frame and the historical cached data frame respectively, thus obtaining a second sum.
[0074] Let the number of the first amplitude be n_up and the number of the second amplitude be n_down. Then the number of the first amplitude of the current buffered data frame can be expressed as: n_up p The number of second values in the current cached data frame can be expressed as: n_down p The number of the first amplitude values of a historical cached data frame can be expressed as: n_uph The number of second values in the current cached data frame can be expressed as: n_down h The first sum is: n_up p +n_up h The second sum is: n_down p +n_down h .
[0075] C4. When the target sum is greater than the sum threshold, determine that the second consecutive preset number of sampling amplitudes of the PIR sensor within the second preset time period meet the judgment condition.
[0076] The target sum is the larger of the first and second sums. That is, after obtaining the first and second sums, the electronic device compares them and determines the larger value as the target sum. This determined target sum can then be compared with a sum threshold. If the target sum is greater than the sum threshold, the electronic device can determine that a second preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period satisfy the judgment condition.
[0077] It is understandable that, in addition to the second preset quantity, the second upper limit, the second lower limit, and the sum threshold are also among the preset algorithm parameters proposed above; that is, the second upper limit, the second lower limit, and the sum threshold can all be dynamically set according to the level of accidental touch.
[0078] In the third application scenario, electronic devices can also determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions in the following way:
[0079] D1. In the current buffered data frame, count the number of the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair.
[0080] The concept of a buffered data frame has been described previously and will not be repeated here. In the current buffered data frame, two sampling amplitudes with adjacent acquisition times constitute an amplitude pair. For each amplitude pair, the electronic device can determine whether it is one of the first target amplitude pair, the second target amplitude pair, or the third target amplitude pair. This determination process depends on the average amplitude and the first amplitude fluctuation value. Specifically, when the current buffered data frame is the first frame, the average amplitude is a specified initial value; when the current buffered data frame is not the first frame, the average amplitude is the value obtained through iteration; that is, the average amplitude can adaptively update as the buffered data frame is updated.
[0081] For ease of explanation, the sampled amplitude with an earlier acquisition time in each amplitude pair can be denoted as T1, the sampled amplitude with a later acquisition time can be denoted as T2, the average amplitude can be denoted as avg, and the first amplitude fluctuation value can be denoted as minifluc.
[0082] For the first target amplitude pair, each amplitude pair belonging to the first target amplitude pair needs to satisfy the following condition: T1 < avg and T2 > avg, or T1 > avg and T2 < avg; this condition can be expressed as the amplitude interval (i.e. (T1, T2)) formed by the first target amplitude pair includes avg, or it can be expressed as avg being within the amplitude interval (i.e. (T1, T2)) formed by the first target amplitude pair.
[0083] For the second target amplitude pair, each amplitude pair belonging to the second target amplitude pair needs to satisfy the following condition: T1 < avg + minifluc and T2 > avg + minifluc, or T1 > avg + minifluc and T2 < avg + minifluc; this condition can be expressed as the amplitude interval (i.e. (T1, T2)) formed by the second target amplitude pair includes avg + minifluc, or it can be expressed as avg + minifluc being within the amplitude interval (i.e. (T1, T2)) formed by the second target amplitude pair.
[0084] For the third target amplitude pair, each amplitude pair belonging to the third target amplitude pair needs to satisfy the following condition: T1 < avg-minifluc and T2 > avg-minifluc, or T1 > avg-minifluc and T2 < avg-minifluc; this condition can be expressed as the amplitude interval (i.e. (T1, T2)) formed by the third target amplitude pair includes avg-minifluc, or it can be expressed as avg-minifluc being within the amplitude interval (i.e. (T1, T2)) formed by the third target amplitude pair.
[0085] D2. Determine the largest quantity among the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair as the target quantity.
[0086] For ease of explanation, the quantities of the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair can be denoted as m1, m2, and m3, respectively. The electronic device can compare m1, m2, and m3 and take the maximum value as the target quantity, which can be denoted as m.
[0087] D3. Compare the target quantity with the first threshold.
[0088] The electronic device continues to compare the target quantity with the first threshold to determine the quantitative relationship between the target quantity and the first threshold.
[0089] D4. Update the intermediate values based on the comparison results.
[0090] An electronic device can create an intermediate value with a preset number of bits. This intermediate value is initially set to 0, meaning all data bits are initially 0. Specifically, when updating the intermediate value, the electronic device can shift it one bit to the right and insert the target value into its highest bit. If the comparison result indicates that the target quantity is less than a first threshold, the target value is 1; that is, the electronic device will shift the intermediate value one bit to the right and then insert a 1 into its highest bit. Conversely, if the comparison result indicates that the target quantity is greater than or equal to the first threshold, the target value is 0; that is, the electronic device will shift the intermediate value one bit to the right and then insert a 0 into its highest bit.
[0091] D5. If the updated median value is greater than the second threshold, determine that the second preset number of consecutive sampling amplitudes of the PIR sensor within the second preset time period meet the judgment condition.
[0092] It is understandable that the first threshold, the second threshold, the preset number of bits, and the first amplitude fluctuation value are all among the preset algorithm parameters proposed above; that is, the first threshold, the second threshold, the preset number of bits, and the first amplitude fluctuation value can all be dynamically set according to the level of accidental touch. It should be noted that the second threshold and the preset number of bits must also meet certain conditions; let the second threshold be Q, and the preset number of bits be y, then this certain condition can be specifically expressed as: Q < 2. y-1 .
[0093] In some embodiments, when the target number is greater than a third threshold, and all sampled amplitudes in the current cached data frame are within the second amplitude range, and the current cached data frame is not the first frame, the electronic device may update the average amplitude to be used in the current cached data frame before step D1. The update process specifically involves: calculating the sum of all sampled amplitudes in the current cached data frame to obtain a third sum; and calculating the average amplitude to be used in the current cached data frame based on this third sum, the forgetting factor, and the average amplitude used in historical cached data frames. The endpoints of the second amplitude range are the sum and difference between the average amplitude used in historical cached data frames and the second amplitude fluctuation value, respectively.
[0094] Let the third sum be sum, the third threshold be P, the forgetting factor be β, and the average amplitude used by the historical cached data frames be avg. h The average amplitude to be used for the current cached data frame is avg pIf the second amplitude fluctuation value is fluc, then: when m > P, and all sampled amplitudes in the current buffered data frame are within the interval [avg-fluc, avg+fluc], avg p =β×avg h +(1-β)×sum.
[0095] It is understandable that the forgetting factor and the second amplitude fluctuation value are also among the preset algorithm parameters proposed above; that is, the forgetting factor and the second amplitude fluctuation value can be dynamically set according to the level of accidental touch.
[0096] In some embodiments, the electronic device may choose to determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet the preset judgment conditions based on any method provided by any application scenario; alternatively, the electronic device may also combine the methods provided by the above three application scenarios to determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet the preset judgment conditions. For example: first, the judgment is made using the method of the first application scenario; if the result obtained by the method of the first application scenario is satisfied, the final judgment result is directly determined to be satisfied; if the result obtained by the method of the first application scenario is not satisfied, a comprehensive judgment is made using the methods of the second and third application scenarios; only if the results obtained by the method of the second and third application scenarios are both satisfied, the final judgment result is determined to be satisfied; otherwise, if either the result obtained by the method of the second and third application scenarios is not satisfied, the final judgment result is determined to be unsatisfied. It should be noted that when making a comprehensive judgment, the second upper limit value should be less than the first upper limit value, and the second lower limit value should be greater than the first lower limit value.
[0097] As can be seen from the above, to avoid frequent false triggering of the PIR sensor, this application proposes a flexible adjustment of the PIR sensor's filtering intensity, specifically referring to the filtering intensity for false trigger scenarios. Specifically, when the number of false triggers of the PIR sensor reaches a preset threshold, i.e., when the PIR sensor is falsely triggered multiple times, the filtering intensity of the PIR sensor can be increased by adjusting the preset algorithm parameters of the PIR sensor, making the PIR sensor's determination of whether a trigger has occurred more stringent. This process helps reduce the possibility of false triggering of the PIR sensor and saves product resources.
[0098] Corresponding to the accidental touch prevention method provided above, this application embodiment also provides an accidental touch prevention device. For example... Figure 2 As shown, the anti-accidental touch device 2 includes:
[0099] The acquisition module 201 is used to acquire the number of times the pyroelectric infrared PIR sensor is accidentally touched within a first preset time period.
[0100] The control module 202 is used to enhance the filtering strength of the PIR sensor for accidental touch scenarios by adjusting the preset algorithm parameters of the PIR sensor when the number of accidental touches reaches a preset threshold.
[0101] In some embodiments, the anti-accidental touch device 2 further includes:
[0102] The judgment module uses a preset triggering algorithm to determine whether the PIR sensor has been triggered by triggering the sampling amplitude.
[0103] The analysis module is used to analyze the video obtained by the image sensor when it is determined that the PIR sensor has been triggered.
[0104] The module determines whether the PIR sensor triggering is a false trigger if the analysis results indicate that there is no target object in the video, and whether the PIR sensor triggering is a normal trigger if the analysis results indicate that there is a target object in the video.
[0105] In some embodiments, the preset algorithm parameters include: a preset quantity; the judgment module includes:
[0106] The judgment unit is used to judge whether the PIR sensor's consecutive preset number of sampling amplitudes within a second preset time period meet the preset judgment conditions, wherein the end time of the second preset time period is the current time, and the duration is a preset duration.
[0107] The determination unit is used to determine that the PIR sensor is triggered when a preset number of consecutive sampling amplitude values meet the judgment conditions.
[0108] In some embodiments, the preset quantity includes: a first preset quantity; the preset algorithm parameters further include: a first upper limit value and a first lower limit value; the judgment unit includes:
[0109] The first determining subunit is used to determine whether a first preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period are all within a first amplitude range, wherein the first amplitude range is composed of a first upper limit value and a first lower limit value.
[0110] The second determining subunit is used to determine that the PIR sensor satisfies the judgment condition if the consecutive first preset number of sampling amplitudes are not in the first amplitude range.
[0111] In some embodiments, the preset quantity includes: a second preset quantity; the preset algorithm parameters further include: a second upper limit value, a second lower limit value, and a sum threshold value; the judgment unit includes:
[0112] The third determining subunit is used to determine the number of first amplitudes and the number of second amplitudes in the current buffered data frame. The current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes of the PIR sensor within a second preset time period. The number of first amplitudes is the number of sampled amplitudes greater than the second lower limit value, and the number of second amplitudes is the number of sampled amplitudes less than the second upper limit value.
[0113] The first summation subunit is used to sum the number of first amplitude values in the current cached data frame and the number of first amplitude values in the historical cached data frame to obtain the first sum value, wherein the historical cached data frame is the frame preceding the current cached data frame;
[0114] The second summation subunit is used to sum the number of second amplitude values in the current cached data frame and the number of second amplitude values in the historical cached data frames to obtain the second sum value;
[0115] The fourth determining subunit is used to determine whether the second preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period satisfy the judgment condition when the target sum is greater than the sum threshold, wherein the target sum is the larger of the first sum and the second sum.
[0116] In some embodiments, the preset quantity includes: a second preset quantity; the preset algorithm parameters include: a first threshold, a second threshold, a preset number of bits, and a first amplitude fluctuation value; the judgment unit includes:
[0117] The statistics subunit is used to count the number of the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair in the current buffered data frame. The current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes of the PIR sensor within a second preset time period. The first target amplitude pair, the second target amplitude pair, and the third target amplitude pair are all composed of two sampled amplitudes with adjacent acquisition times. The amplitude interval based on the first target amplitude pair includes the average amplitude value. The amplitude interval based on the second target amplitude pair includes the sum of the average amplitude value and the first amplitude fluctuation value. The amplitude interval based on the third target amplitude pair includes the difference between the average amplitude value and the first amplitude fluctuation value.
[0118] The fifth determining subunit is used to determine the largest quantity among the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair as the target quantity;
[0119] The comparison subunit is used to compare the number of targets with a first threshold.
[0120] The update sub-unit is used to update the intermediate value based on the comparison result, wherein the number of bits in the intermediate value is a preset number of bits;
[0121] The sixth determining subunit is used to determine whether the second preset number of consecutive sampling amplitudes of the PIR sensor within the second preset time period satisfy the judgment condition when the updated intermediate value is greater than the second threshold.
[0122] In some embodiments, the update subunit is specifically used to shift the intermediate value one bit to the right and fill the highest bit of the intermediate value with the target value, wherein the target value is 1 when the comparison result indicates that the number of targets is less than the first threshold, and the target value is 0 when the comparison result indicates that the number of targets is greater than or equal to the first threshold.
[0123] As can be seen from the above, to avoid frequent false triggering of the PIR sensor, this application proposes a flexible adjustment of the PIR sensor's filtering intensity, specifically referring to the filtering intensity for false trigger scenarios. Specifically, when the number of false triggers of the PIR sensor reaches a preset threshold, i.e., when the PIR sensor is falsely triggered multiple times, the filtering intensity of the PIR sensor can be increased by adjusting the preset algorithm parameters of the PIR sensor, making the PIR sensor's determination of whether a trigger has occurred more stringent. This process helps reduce the possibility of false triggering of the PIR sensor and saves product resources.
[0124] Corresponding to the accidental touch prevention method provided above, this application also provides an electronic device. Please refer to... Figure 3 The electronic device 3 in this application embodiment includes: a memory 301, and one or more processors 302. Figure 3 (Only one is shown) and a computer program stored in memory 301 and executable on the processor. Memory 301 stores software programs and units. The processor 302 executes various functional applications and anti-accidental touch measures by running the software programs and units stored in memory 301 to obtain resources corresponding to the aforementioned preset events. Specifically, the processor 302 performs the following steps when running the aforementioned computer program stored in memory 301:
[0125] Within a first preset time period, the number of times the PIR sensor is accidentally touched is obtained;
[0126] If the number of accidental touches reaches a preset threshold, the filtering strength of the PIR sensor for accidental touch scenarios is enhanced by adjusting the preset algorithm parameters of the PIR sensor.
[0127] Assuming the above is the first possible implementation, in the second possible implementation based on the first possible implementation, the processor 302 further performs the following steps when running the computer program stored in the memory 301:
[0128] The PIR sensor is triggered by a preset triggering algorithm, which determines whether the PIR sensor has been triggered.
[0129] Analyze the video obtained by the image sensor after confirming that the PIR sensor has been triggered.
[0130] If the analysis results indicate that there is no target object in the video, the triggering of the PIR sensor is determined to be a false trigger.
[0131] If the analysis results indicate the presence of a target object in the video, the PIR sensor's triggering is determined to be normal.
[0132] In a third possible implementation based on the second possible implementation described above, the preset algorithm parameters include: a preset quantity; and a preset triggering algorithm is used to determine whether the PIR sensor is triggered by triggering the sampling amplitude of the PIR sensor, including:
[0133] Determine whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions, wherein the end time of the second preset time period is the current time, and the duration is a preset duration;
[0134] If a preset number of consecutive sampling amplitudes meet the judgment conditions, the PIR sensor is determined to be triggered.
[0135] In the fourth possible implementation provided based on the third possible implementation described above, the preset quantity includes: a first preset quantity; the preset algorithm parameters further include: a first upper limit value and a first lower limit value; determining whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions includes:
[0136] Determine whether a first preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period are all within a first amplitude range, the first amplitude range consisting of a first upper limit value and a first lower limit value;
[0137] If a predetermined number of consecutive sampling amplitudes are not within the first amplitude range, it is determined that a predetermined number of consecutive sampling amplitudes of the PIR sensor within a second predetermined time period meet the judgment condition.
[0138] In the fifth possible implementation provided based on the third possible implementation described above, the preset quantity includes: a second preset quantity; the preset algorithm parameters further include: a second upper limit value, a second lower limit value, and a sum value threshold; determining whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions includes:
[0139] Determine the number of first amplitudes and the number of second amplitudes in the current buffered data frame. The current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes of the PIR sensor within a second preset time period. The number of first amplitudes is the number of sampled amplitudes greater than the second lower limit value, and the number of second amplitudes is the number of sampled amplitudes less than the second upper limit value.
[0140] The sum of the number of first values in the current cached data frame and the number of first values in the historical cached data frames is obtained to obtain the first sum value, where the historical cached data frame is the frame preceding the current cached data frame;
[0141] The sum of the number of second values in the current cached data frame and the number of second values in the historical cached data frames is used to obtain the second sum value;
[0142] If the target sum is greater than the sum threshold, determine that the PIR sensor has a second preset number of consecutive sampling amplitudes within a second preset time period that meet the judgment condition, wherein the target sum is the larger of the first sum and the second sum.
[0143] In the sixth possible implementation provided based on the third possible implementation described above, the preset quantity includes: a second preset quantity; the preset algorithm parameters further include: a first threshold, a second threshold, a preset number of bits, and a first amplitude fluctuation value; determining whether a preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period meet preset judgment conditions includes:
[0144] In the current buffered data frame, the number of the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair are counted. The current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes of the PIR sensor within a second preset time period. The first target amplitude pair, the second target amplitude pair, and the third target amplitude pair are all composed of two sampled amplitudes with adjacent acquisition times. The amplitude interval formed based on the first target amplitude pair includes the average amplitude value. The amplitude interval formed based on the second target amplitude pair includes the sum of the average amplitude value and the first amplitude fluctuation value. The amplitude interval formed based on the third target amplitude pair includes the difference between the average amplitude value and the first amplitude fluctuation value.
[0145] The largest quantity among the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair is determined as the target quantity;
[0146] Compare the target quantity with the first threshold;
[0147] Based on the comparison results, update the median value, where the number of bits in the median value is the preset number of bits;
[0148] If the updated median value is greater than the second threshold, it is determined that the second preset number of consecutive sampling amplitudes of the PIR sensor within the second preset time period meet the judgment condition.
[0149] In the seventh possible implementation provided based on the sixth possible implementation described above, updating the intermediate value according to the comparison result includes:
[0150] Shift the middle value one position to the right and fill the highest position of the middle value with the target value. The target value is 1 if the comparison result indicates that the number of targets is less than the first threshold, and the target value is 0 if the comparison result indicates that the number of targets is greater than or equal to the first threshold.
[0151] It should be understood that, in the embodiments of this application, the processor 302 may be a central processing unit (CPU), but it may also 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 may be a microprocessor or any conventional processor.
[0152] Memory 301 may include read-only memory and random access memory, and provides instructions and data to processor 302. Some or all of memory 301 may also include non-volatile random access memory. For example, memory 301 may also store device category information.
[0153] As can be seen from the above, to avoid frequent false triggering of the PIR sensor, this application proposes a flexible adjustment of the PIR sensor's filtering intensity, specifically referring to the filtering intensity for false trigger scenarios. Specifically, when the number of false triggers of the PIR sensor reaches a preset threshold, i.e., when the PIR sensor is falsely triggered multiple times, the filtering intensity of the PIR sensor can be increased by adjusting the preset algorithm parameters of the PIR sensor, making the PIR sensor's determination of whether a trigger has occurred more stringent. This process helps reduce the possibility of false triggering of the PIR sensor and saves product resources.
[0154] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0155] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0156] 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 external device 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.
[0157] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units described above is only a logical functional division, and 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 coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0158] The units described above 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.
[0159] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing associated hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer-readable storage device, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the contents of the aforementioned computer-readable storage media may be appropriately added to or subtracted from the contents according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media may not include electrical carrier signals and telecommunication signals.
[0160] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for preventing accidental touches, characterized in that, include: The sampling amplitude of the pyroelectric infrared (PIR) sensor is triggered by a preset triggering algorithm to determine whether the PIR sensor has been triggered. If the PIR sensor is determined to be triggered, the video obtained by the image sensor is analyzed. If the analysis results indicate that there is no target object in the video, the triggering of the PIR sensor is determined to be a false trigger. If the analysis results indicate that the target object exists in the video, the triggering of the PIR sensor is determined to be normal triggering; Within a first preset time period, the number of times the PIR sensor was accidentally touched is obtained; When the number of accidental touches reaches a preset threshold, the filtering strength of the PIR sensor for accidental touch scenarios is enhanced by adjusting the preset algorithm parameters of the PIR sensor.
2. The method for preventing accidental touches as described in claim 1, characterized in that, The preset algorithm parameters include: a preset quantity; the step of using a preset triggering algorithm to determine whether the PIR sensor is triggered by triggering the sampling amplitude of the PIR sensor includes: Determine whether the PIR sensor's consecutive preset number of sampling amplitudes within a second preset time period meet preset judgment conditions, wherein the end time of the second preset time period is the current time, and the duration is a preset duration; If the predetermined number of consecutive sample amplitudes satisfy the judgment condition, it is determined that the PIR sensor is triggered.
3. The method for preventing accidental touches as described in claim 2, characterized in that, The preset quantity includes: a first preset quantity; the preset algorithm parameters further include: a first upper limit value and a first lower limit value; the step of determining whether the PIR sensor's consecutive preset quantity of sampling amplitudes within a second preset time period meets the preset judgment conditions includes: Determine whether the consecutive first preset number of sampling amplitudes of the PIR sensor within a second preset time period are all less than the first lower limit or all greater than the first upper limit; If the first preset number of consecutive sampling amplitudes are all less than the first lower limit or all are greater than the first upper limit, it is determined that the first preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period satisfy the judgment condition.
4. The method for preventing accidental touches as described in claim 2, characterized in that, The preset quantity includes: a second preset quantity; the preset algorithm parameters also include: a second upper limit value, a second lower limit value, and a sum value threshold; the step of determining whether the PIR sensor's consecutive preset quantity of sampling amplitudes within a second preset time period meets the preset judgment conditions includes: Determine the first amplitude count and the second amplitude count in the current buffered data frame, wherein the current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes of the PIR sensor within a second preset time period, the first amplitude count is the number of sampled amplitudes greater than the second lower limit value, and the second amplitude count is the number of sampled amplitudes less than the second upper limit value; The first sum is obtained by summing the number of first values in the current cached data frame and the number of first values in the historical cached data frame, wherein the historical cached data frame is the frame preceding the current cached data frame; The second sum is obtained by summing the number of second amplitude values in the current cached data frame and the number of second amplitude values in the historical cached data frames; If the target sum is greater than the sum threshold, it is determined that the second preset number of consecutive sampling amplitudes of the PIR sensor within a second preset time period satisfy the judgment condition, wherein the target sum is the larger of the first sum and the second sum.
5. The method for preventing accidental touches as described in claim 2, characterized in that, The preset quantity includes: a second preset quantity; the preset algorithm parameters include: a first threshold, a second threshold, a preset number of bits, and a first amplitude fluctuation value; the step of determining whether the PIR sensor's consecutive preset number of sampling amplitudes within a second preset time period meet preset judgment conditions includes: In the current buffered data frame, the number of the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair are counted. The current buffered data frame is a data frame consisting of a second preset number of consecutive sampled amplitudes from the PIR sensor within a second preset time period. Each of the first, second, and third target amplitude pairs consists of two sampled amplitudes with adjacent acquisition times. The amplitude interval formed by the first target amplitude pair includes the average amplitude, and the amplitude interval formed by the second target amplitude pair includes the average amplitude and the first amplitude float. The sum of the amplitude values, based on the amplitude range formed by the third target amplitude pair, includes the difference between the average amplitude value and the first amplitude fluctuation value; when the current cached data frame is the first frame, the average amplitude value is a specified initial value; when the current cached data frame is not the first frame, the average amplitude value is an iteratively obtained value, including: calculating the sum of all sampled amplitude values in the current cached data frame to obtain a third sum; and calculating the average amplitude value to be used in the current cached data frame based on the third sum, the forgetting factor, and the average amplitude value used in historical cached data frames. The largest quantity among the first target amplitude pair, the second target amplitude pair, and the third target amplitude pair is determined as the target quantity; The target quantity is compared with the first threshold. Based on the comparison results, the intermediate value is updated, wherein the number of bits in the intermediate value is a preset number of bits; If the updated intermediate value is greater than the second threshold, it is determined that the PIR sensor satisfies the judgment condition for a consecutive second preset number of sampling amplitudes within a second preset time period.
6. The method for preventing accidental touches as described in claim 5, characterized in that, The step of updating the intermediate value based on the comparison results includes: The intermediate value is shifted one position to the right, and the target value is added to the highest position of the intermediate value. The target value is 1 when the comparison result indicates that the number of targets is less than the first threshold, and the target value is 0 when the comparison result indicates that the number of targets is greater than or equal to the first threshold.
7. A device for preventing accidental touch, characterized in that, include: The judgment module is used to determine whether the PIR sensor has been triggered by using a preset triggering algorithm to judge the sampling amplitude of the pyroelectric infrared PIR sensor. The analysis module is used to analyze the video obtained by the image sensor when it is determined that the PIR sensor has been triggered; The determination module is used to determine that the triggering of the PIR sensor is a false trigger when the analysis result indicates that there is no target object in the video, and to determine that the triggering of the PIR sensor is a normal trigger when the analysis result indicates that there is target object in the video. The acquisition module is used to acquire the number of times the PIR is accidentally touched within a first preset time period; The control module is used to enhance the filtering strength of the PIR sensor for accidental touch scenarios by adjusting the preset algorithm parameters of the PIR sensor when the number of accidental touches reaches a preset threshold.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.