A control method and apparatus
Patent Information
- Application Number
- CN202610969484.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-09-18
AI Technical Summary
但是,现有动作识别方案存在识别准确率不足的问题,影响交互可靠性
Smart Images

Figure CN122778073A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a control method and apparatus. Background Technology
[0002] In electronic device interactions, specific actions can trigger associated operations. However, existing action recognition solutions suffer from insufficient recognition accuracy, affecting the reliability of the interaction. Summary of the Invention
[0003] The technical solution provided in this application is as follows:
[0004] The first aspect of this application provides a control method, comprising:
[0005] Acquire a similarity data stream of a first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within a target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping a target object within a fixed time period;
[0006] If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action;
[0007] Based on the first electronic device performing the target action, the second electronic device performs the target operation; the second electronic device establishes a communication connection with the first electronic device.
[0008] In one possible implementation, obtaining the similarity data stream of the first electronic device includes:
[0009] Acquire a target motion data set of a first electronic device, the target motion data set including motion data corresponding to multiple moments within a target duration;
[0010] Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, the similarity data stream of the first electronic device is obtained;
[0011] The similarity data stream includes at least the similarity between the target motion data group and the target template data.
[0012] In one possible implementation, the control method further includes:
[0013] If the similarity data stream does not meet the matching conditions, it is determined that the first electronic device has performed an interference action; the interference action indicates that the first electronic device is shaken multiple times within the target duration.
[0014] In one possible implementation, acquiring the target motion data set of the first electronic device includes:
[0015] In response to the target motion data set satisfying the first condition, the target motion data set of the first electronic device is acquired;
[0016] Wherein, the first condition indicates that within a first time period before the first motion data is collected, the rotation amplitude of the first electronic device is higher than the target amplitude; the target action indicates that the first electronic device repeatedly strikes the target object with the target end within a fixed time period.
[0017] In one possible implementation, determining that the first electronic device has performed a target action if the similarity data stream satisfies the matching condition includes:
[0018] The target motion data stream and the similarity data stream are input into the target model;
[0019] Based on the output of the target model, which characterizes the first electronic device as being in a state of knocking vibration, it is determined that the first electronic device has performed the target action;
[0020] The target motion data stream includes multiple motion data groups, and the multiple motion data groups include at least the target motion data group, which includes motion data corresponding to multiple moments within the target duration.
[0021] In one possible implementation, the target motion data set includes an acceleration data set consisting of a first acceleration data set, a second acceleration data set, and a third acceleration data set, wherein the first acceleration data set, the second acceleration data set, and the third acceleration data set correspond to acceleration data along different axes.
[0022] The control method further includes:
[0023] The amplitude synthesis processing is performed on the axial acceleration data contained in the target motion data group to obtain the second motion data group;
[0024] The second motion data set is subjected to low-frequency filtering to obtain a third motion data set. The low-frequency filtering is used to filter out slowly varying components from the second motion data set.
[0025] The similarity between the target motion data group and the target template data is obtained based on the similarity between the third motion data group and the target template data.
[0026] In one possible implementation, there are multiple target template data, and the multiple target template data correspond to the data obtained by repeatedly striking the target object with different striking forces within a fixed time period;
[0027] The step of obtaining the similarity data stream of the first electronic device based on the similarity between the target motion data group and the target template data being higher than the target similarity threshold includes:
[0028] The target motion data set is matched with multiple target template data sets respectively to obtain multiple candidate similarities;
[0029] If at least one of the candidate similarities is higher than the target similarity threshold, then the similarity data stream of the first electronic device is obtained.
[0030] In one possible implementation, inputting the target motion data stream and the similarity data stream into the target model includes:
[0031] The target motion data stream and the similarity data stream are input into the target model deployed in the second electronic device.
[0032] In one possible implementation, the target operation includes saving the content currently displayed on the screen of the second electronic device.
[0033] In another aspect, this application provides a control device, comprising:
[0034] The acquisition module is used to acquire a similarity data stream of a first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within a target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping a target object within a fixed time period;
[0035] The first determining module is used to determine that the first electronic device has performed the target action if the similarity data stream meets the matching conditions;
[0036] An execution module is used to execute the target action on a second electronic device based on the first electronic device performing the target action; the second electronic device has a communication connection with the first electronic device. Attached Figure Description
[0037] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0038] Figure 1 This is a schematic flowchart of a control method provided in Embodiment 1 of this application;
[0039] Figure 2 This is a schematic flowchart of a control method provided in Embodiment 2 of this application;
[0040] Figure 3 A flowchart illustrating a control method provided in Embodiment 5 of the application;
[0041] Figure 4 This is a schematic flowchart of a control method provided in Embodiment 6 of this application;
[0042] Figure 5 A schematic diagram of the structure of a first electronic device provided in this application. Detailed Implementation
[0043] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0044] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0045] The terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0046] In the embodiments of this application, reference is made to Figure 1 This is a flowchart illustrating a control method provided in Embodiment 1 of this application, as shown below. Figure 1 As shown, the method may include, but is not limited to, the following steps:
[0047] Step S101: Obtain the similarity data stream of the first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within the target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping the target object within a fixed time period.
[0048] In this embodiment, the first electronic device can be any portable electronic device with motion data acquisition and communication functions, such as a stylus, stylus, demonstration pen, smart ring, wearable controller, etc. The second electronic device can be a terminal device such as a mobile phone, tablet computer, laptop computer, smart display screen, etc., that establishes a communication connection with the first electronic device.
[0049] The target template data can be pre-acquired and stored reference data. To obtain the target template data, the operator can perform the action of striking the target object multiple times, and the electronic device collects the motion data during these multiple strikes. The motion sample data collected from multiple strikes is processed (e.g., averaged after alignment) to obtain the target template data. By processing the data from multiple strikes, the random interference that may exist in a single acquisition can be reduced, making the target template data more reliably reflect the changes in motion data caused by the striking action.
[0050] The target object can be any object that can be struck by an electronic device and thus generate motion data. For example, it can be a hard surface such as a desktop, book, whiteboard, or wall, or a part of the human body (such as the palm or arm) or other object surface that can be struck.
[0051] The fixed duration can be understood as the length of the data acquisition window corresponding to each tapping action, or as the duration of the entire multiple tapping process, depending on the settings in the actual application.
[0052] For example, the target template data can include motion sample data from multiple moments within a fixed duration. This motion sample data can be presented as a sequence of peaks that rise and fall over time, with the peak value corresponding to the maximum motion intensity at the moment of impact, and the subsequent decreasing values corresponding to the gradual decay of the vibration. The time span of the entire sequence is the fixed duration, which covers the process from the occurrence of a single impact action to the basic end of the vibration.
[0053] In practical use, the first electronic device collects its own motion data and continuously compares this data with the target template data, calculating the similarity between the two. Each comparison generates a similarity score, representing the degree of matching between the motion state of the first electronic device and the tapping action represented by the target template data at the corresponding moment. As the comparison process continues, multiple similarity scores are obtained in chronological order, forming a similarity data stream. This similarity data stream reflects how the degree of matching between the motion state of the first electronic device and the tapping action changes over time.
[0054] In the above comparison process, the time span of the motion data involved in each similarity calculation is the target duration. Since the target template data itself is a process of motion data change collected within a fixed duration, to calculate the similarity between the motion data and the target template data, it is necessary to take a segment of motion data whose duration corresponds to the fixed duration of the target template data. Therefore, the target duration can be determined based on the duration of the target template data, and is used to define the time range of the motion data on which each comparison is based, so that the similarity calculation can be performed on the corresponding time scale.
[0055] In the aforementioned multiple striking processes, each strike can be performed with the same force. By averaging the data from multiple strikes with the same force, the resulting target template data can more accurately reflect the striking motion characteristics under that specific force. Alternatively, each strike can be performed with different forces, such as striking the target object with light, medium, and heavy forces respectively. In this case, by comprehensively processing the data from multiple strikes with various forces, the resulting target template data can reflect the common motion characteristics of striking actions with different forces.
[0056] It is understandable that even without a tapping action, the motion data of the first electronic device may occasionally show a high instantaneous similarity to the target template data. If a tapping action is determined solely based on a single high-similarity data point, misjudgment may occur. The similarity data stream reflects the persistence of the matching degree over time. When a tapping action is performed, the tapping action itself causes vibration for a continuous period, during which a high similarity is usually generated continuously; while occasional instantaneous high similarity only occurs at individual moments and lacks temporal persistence. Judging based on the similarity data stream can distinguish between continuous high matches and isolated high matches, thus more reliably identifying genuine tapping actions and reducing the probability of misjudgment.
[0057] Step S102: If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action.
[0058] In this embodiment, the matching conditions can be set according to actual application requirements, and no restrictions are imposed in this application.
[0059] In one possible implementation, the matching condition could be that multiple consecutive similar data points in the similarity data stream exceed a preset similarity threshold, meaning that a high degree of matching is maintained throughout a continuous time period.
[0060] In another possible implementation, the matching condition could be that the variation pattern of similarity data in the similarity data stream matches the typical pattern of a tapping action (such as a peak appearing first and then gradually decaying), which can be identified by a pre-trained model.
[0061] The matching criteria and the degree of matching reflected in the similarity data stream are related to the persistence of the matching over time. When the first electronic device actually performs a tapping action, the vibration caused by the tap will persist continuously over a period of time. Consequently, multiple consecutive similarity data will consistently show a high degree of matching. However, when only an occasional, instantaneous match occurs, the similarity data stream will only contain isolated high-similarity data, which lacks persistence.
[0062] The target action may include the action of the first electronic device colliding with an external object and thus causing a change in specific motion data.
[0063] The execution of a target action by the first electronic device can be either a situation where the user actively operates the first electronic device to tap a target object, or a situation where the first electronic device is passively moved due to being tapped by another object. For example, taking a stylus as an example, if the user actively holds the stylus and taps it on a table, it is considered that the stylus is actively performing a target action; if the stylus is placed on the table and is hit by another object, causing it to vibrate, it is considered that the stylus is passively performing a target action. Regardless of whether it is active or passive, as long as the change in the motion data of the first electronic device matches the tapping action represented by the target template data, it can be identified as a target action.
[0064] Step S103: Based on the first electronic device performing the target action, the second electronic device performs the target operation; the second electronic device establishes a communication connection with the first electronic device.
[0065] In this embodiment, a communication connection is established between the first electronic device and the second electronic device, such as a Bluetooth connection or a wireless local area network connection. The determination that the first electronic device has performed the target action, and the entire process that triggers the second electronic device to perform the target operation, can be completed collaboratively by the first and second electronic devices in different ways.
[0066] In one possible implementation, steps S101 and S102 are both performed by the first electronic device. Specifically, the first electronic device collects its own motion data, generates a similarity data stream, and determines whether the matching conditions are met based on the similarity data stream. Once it determines that it has performed the target action, the first electronic device sends a notification message to the second electronic device via a communication connection, informing the second electronic device that the target action has occurred. This notification message can be a specially defined instruction message or an indication message sent in conjunction with motion data or similarity data. Upon receiving the notification message, the second electronic device executes the target operation associated with the target action.
[0067] In another possible implementation, steps S101 and S102 are performed by the second electronic device, or jointly by the first and second electronic devices. For example, the first electronic device collects its own motion data and sends it to the second electronic device via a communication connection. After receiving the motion data, the second electronic device generates a similarity data stream and determines whether the matching conditions are met based on the similarity data stream, thereby determining whether the first electronic device has performed the target action. Once it is determined that the first electronic device has performed the target action, the second electronic device directly executes the target operation associated with the target action. In this implementation, the second electronic device undertakes the main calculation and judgment work.
[0068] Regardless of the implementation method used, the target operation is an operation pre-associated with the target action. This association can be pre-set by the user according to their own needs, or it can be set by default by the operating system or application of the second electronic device. In this way, the user can conveniently trigger the second electronic device to perform the corresponding operation by operating the first electronic device.
[0069] In this embodiment, by acquiring a similarity data stream reflecting the degree of matching between motion data and target template data over a continuous period of time, and determining whether the matching conditions are met based on the similarity data stream, it is possible to effectively distinguish between genuine tapping actions and instantaneous high similarity matches caused by gripping and shaking. Since the vibrations caused by genuine tapping actions are continuous in time, they will form a sustained high match in the similarity data stream, while the matches generated by interference actions such as shaking usually only occur at individual moments and are not continuous. Therefore, judging based on the similarity data stream can significantly reduce the probability of misidentifying shaking actions as tapping actions, improve the accuracy of action recognition, reduce the occurrence of false triggers, and enhance the user interaction experience.
[0070] As another optional embodiment of this application, refer to Figure 2 This is a flowchart illustrating a control method provided in Embodiment 2 of this application. In this embodiment, it mainly describes one implementation of step S101 above, such as... Figure 2 As shown, the specific steps may include, but are not limited to, the following:
[0071] Step S1011: Obtain the target motion data set of the first electronic device, wherein the target motion data set includes motion data corresponding to multiple times within the target duration.
[0072] In practical applications, the first electronic device can continuously collect motion data at a preset frequency, acquiring motion data for one moment at a time. As the collection process continues, the first electronic device continuously acquires new motion data, grouping the motion data from each moment within the target duration into a target motion data set. Over time, the first electronic device can continuously acquire multiple target motion data sets, each corresponding to a time window of the target duration. The time windows corresponding to adjacent target motion data sets can be consecutive or partially overlapping, depending on the settings in the actual application.
[0073] For example, assuming the target duration is 500 milliseconds, and the first electronic device collects motion data every 10 milliseconds, then a target motion data set contains motion data from 50 moments, with each motion data point corresponding to a moment and reflecting the motion state of the first electronic device at that moment. The first electronic device acquires a new target motion data set at regular intervals (e.g., every 50 milliseconds) and continuously performs similarity calculations and judgments.
[0074] Step S1012: Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, obtain the similarity data stream of the first electronic device.
[0075] The similarity data stream includes at least the similarity between the target motion data group and the target template data.
[0076] In this embodiment, the target duration can be set to be longer than a fixed duration. This corresponds to an implementation where the target template data includes motion sample data from multiple moments within a fixed duration, and the length of the target motion data group is greater than the length of the target template data. In this case, a cross-correlation operation can be performed between the target motion data group and the target template data to obtain multiple similarity values. Specifically, using the length of the target template data as a window, multiple motion data subgroups of the same length as the target template data are sequentially extracted from the target motion data group. The similarity between each motion data subgroup and the target template data is calculated. This process is the cross-correlation operation, and the resulting multiple similarity values are the results of the cross-correlation operation.
[0077] After obtaining these multiple similarity values, the first electronic device can determine one of them as the similarity between the target motion data set and the target template data, and use it for comparison with a target similarity threshold. For example, the maximum value among multiple similarity values, or the average value among multiple similarity values, can be determined as the similarity for comparison.
[0078] When the similarity between the target motion data set and the target template data is higher than the target similarity threshold, it indicates that there is motion data in the target motion data set that highly matches the tapping action. At this time, the first electronic device arranges the multiple similarity values obtained in the above cross-correlation process according to the order of their corresponding motion data subgroups in the target motion data set, thus forming a similarity data stream.
[0079] Understandably, the vibrations caused by a striking action typically persist continuously over a period of time. Therefore, in addition to the similarity data within the current target motion data set, the cross-correlation results of previous target motion data sets can also reflect the matching status between the previous motion data and the target template data. Including these previous similarity data in the similarity data stream provides more complete information on how the matching degree changes over time, which helps to more accurately determine whether the matching conditions are met. Therefore, the similarity data stream can also include the similarity data corresponding to other target motion data sets preceding the current target motion data set.
[0080] When the similarity between the target motion data set and the target template data does not exceed the target similarity threshold, it indicates that there is no motion data in the target motion data set that highly matches the tapping action, and the first electronic device may not be performing a tapping action. In this case, it is unnecessary to use the multiple similarity values obtained from cross-correlation as a similarity data stream for subsequent matching condition judgment, thereby reducing unnecessary subsequent processing.
[0081] It should be noted that the target similarity threshold can be set according to actual application needs. For example, based on the distribution of cross-correlation results between a large number of tapping motion sample data and non-tapping motion sample data, a value that can effectively distinguish between the two can be selected as the threshold. In practical applications, it can also be adaptively adjusted for different users or different usage environments.
[0082] In this embodiment, cross-correlation calculations are used to perform a sliding comparison of the target template data against the target motion data set. This allows for a comprehensive assessment of the matching degree between the two in terms of overall change trends, rather than simply comparing individual values or local features. The sliding comparison method precisely identifies the position within the target motion data set that best matches the target template data, resulting in a more accurate similarity score. This matching method based on overall change trends effectively avoids misjudgments caused by local data fluctuations or occasional noise interference, improving the accuracy of tapping action recognition.
[0083] Furthermore, in this embodiment, the similarity data stream is acquired and subsequent matching condition judgments are performed only when the similarity between the target motion data group and the target template data is higher than the target similarity threshold. This hierarchical processing mechanism ensures that subsequent refined judgments are triggered only when motion data that may highly match the tapping action is detected, thereby avoiding unnecessary calculations and processing when there is no tapping action.
[0084] As another optional embodiment of this application, a control method provided in embodiment 3 of this application may include, but is not limited to, the following steps:
[0085] Step S201: Obtain the target motion data set of the first electronic device, wherein the target motion data set includes motion data corresponding to multiple times within the target duration.
[0086] Step S202: Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, obtain the similarity data stream of the first electronic device.
[0087] The similarity data stream includes at least the similarity between the target motion data group and the target template data.
[0088] For a detailed description of steps S201-S202, please refer to the relevant description of steps S1011-S1012 in Example 2, which will not be repeated here.
[0089] Step S203: If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action.
[0090] Step S204: Based on the first electronic device executing the target action, the second electronic device executes the target operation; the second electronic device establishes a communication connection with the first electronic device.
[0091] For a detailed description of steps S203-S204, please refer to the relevant description of steps S102-S103 in Example 1, which will not be repeated here.
[0092] Step S205: If the similarity data stream does not meet the matching conditions, it is determined that the first electronic device has performed an interference action; the interference action indicates that the first electronic device is shaken multiple times within the target duration.
[0093] In this embodiment, when the similarity data stream does not meet the matching conditions, it means that although the similarity between the target motion data group and the target template data is higher than the target similarity threshold, that is, there is a local high similarity, the matching degree is not continuous in time from the perspective of the overall similarity data stream, which is inconsistent with the continuous matching situation generated by the tapping action.
[0094] This situation typically corresponds to scenarios where the first electronic device is repeatedly shaken. The first electronic device may shake when held, moved, or subjected to other external forces. The motion data from this shaking at certain moments may have a high similarity to the target template data, resulting in a high similarity value between the corresponding motion data subgroup and the target template data. However, the similarity generated by this shaking is usually scattered and discontinuous in temporal distribution; high-similarity data appear isolated in the similarity data stream and cannot form a distribution of multiple consecutive high-similarity data. Therefore, the matching conditions are not met in the similarity data stream, and this situation is explicitly identified as an interfering action.
[0095] Taking a stylus as an example, when a user holds the stylus to write or moves it, the stylus vibrates due to hand movement. Because the stylus is lightweight, the waveform of this vibration may be similar to the waveform of tapping on a table at certain moments, resulting in a high similarity value at that instant, exceeding the target similarity threshold. However, since the shaking is random and intermittent, high similarity values only appear sporadically in the similarity data stream, and the similarity values before and after are usually low, failing to form a continuous high similarity distribution corresponding to a tapping action. Therefore, the similarity data stream does not meet the matching conditions, and the action is correctly identified as a distracting action, without triggering the second electronic device to perform the target operation.
[0096] In this embodiment, when the similarity between the target motion data group and the target template data exceeds a target similarity threshold, a similarity data stream is further acquired. The target action and interfering actions are then distinguished based on whether the similarity data stream meets the matching conditions. Since the vibration generated by a striking action is continuous in time, it forms a continuous high-similarity distribution in the similarity data stream. In contrast, the vibration generated by interfering actions such as shaking is random and intermittent, with high similarity appearing only in isolated instances. Therefore, secondary judgment using the similarity data stream effectively distinguishes between genuine striking actions and instantaneous high similarity caused by gripping and shaking, avoiding misjudging shaking actions as the target action, reducing the false trigger rate, and improving the accuracy of action recognition and the reliability of user experience.
[0097] As another optional embodiment of this application, the control method provided in Embodiment 4 of this application is mainly an implementation of the above-mentioned step S1011, which may include but is not limited to the following steps:
[0098] Step S10111: In response to the target motion data group satisfying the first condition, acquire the target motion data group of the first electronic device.
[0099] Wherein, the first condition indicates that within a first time period before the first motion data is collected, the rotation amplitude of the first electronic device is higher than the target amplitude; the target action indicates that the first electronic device repeatedly strikes the target object with the target end within a fixed time period.
[0100] The target end may include a specific end on the first electronic device relative to the operating end. Taking a stylus as an example, a stylus typically has a first end and a second end. The first end is provided with a device (such as a capacitive stylus tip) that can be sensed by the screen of the second electronic device for writing or drawing on the screen; the second end is opposite to the first end and generally does not have a device that can sense writing, which is the target end defined in this embodiment.
[0101] In normal writing scenarios, users hold the stylus and use the first end to touch the screen to operate it; however, in scenarios requiring a target action, users flip the stylus so that the second end faces the target object and use the second end to perform a tapping action. By setting the target end to a different end than the writing end, the target action (tapping) can be clearly distinguished from the normal writing action in terms of movement pattern, thereby further reducing the probability of misidentification.
[0102] In this embodiment, in addition to collecting motion data, the first electronic device can also collect its own attitude data. The attitude data reflects the orientation and rotation of the first electronic device in space. The first electronic device can acquire attitude data through a built-in attitude sensor (such as a gyroscope).
[0103] If, within the initial time period before motion data is collected, the rotation amplitude of the first electronic device exceeds a preset target amplitude, it indicates that the first electronic device may have undergone a flipping motion. The rotation amplitude can be the magnitude of the rotation angle or the magnitude of the rotation angular velocity, which can be set according to the actual application requirements.
[0104] Taking a stylus as an example, when a user needs to trigger operations such as saving screen content, they will first flip the stylus so that the tail of the stylus faces the table, and then tap the table with the tail. Therefore, the flipping action can be used as a pre-action for the tapping action. This embodiment determines whether the stylus has been flipped by detecting whether the rotation amplitude is higher than the target amplitude. Only after the flipping action is detected is the target motion data set acquired for subsequent similarity calculation and judgment.
[0105] In this embodiment, the target end can be set according to the actual form of the first electronic device and the user's operating habits. Taking a stylus as an example, a stylus typically has a writing end and a tail opposite the writing end. During normal use, the user holds the stylus with the writing end facing the screen to write. If the user wants to trigger quick operations such as saving, they can flip the stylus over and tap the table with the tail, which is an action distinct from normal writing and has a clear operational intent. Therefore, setting the tail as the target end can make the target action significantly different from the normal writing action in terms of movement pattern.
[0106] In this embodiment, by acquiring the target motion data group of the first electronic device in response to the target motion data group satisfying the first condition, the first electronic device can avoid continuously collecting motion data and calculating similarity when no flipping action occurs (such as during normal writing by the user), thereby reducing unnecessary consumption of computing resources and lowering power consumption.
[0107] Meanwhile, using a larger rotation amplitude as a predictive condition for a tapping action can further reduce the false trigger rate—because users typically don't frequently rotate their primary electronic devices significantly during normal use, and such rotation itself carries a strong indication of intent. Taking a stylus as an example, a user first flips the stylus so the tail faces the table, then taps the table with the tail. This complete sequence of actions rarely occurs during daily writing or holding, thus effectively distinguishing between intentional tapping and unconscious shaking, further reducing the possibility of false triggers.
[0108] As another optional embodiment of this application, refer to Figure 3 This is a flowchart illustrating a control method provided in Embodiment 5 of this application. In this embodiment, it mainly describes an implementation of step S102 in Embodiment 1, such as... Figure 3 As shown, the specific steps may include, but are not limited to, the following:
[0109] Step S1021: Input the target motion data stream and the similarity data stream into the target model.
[0110] In this embodiment, the structure of the target model can be set as needed, and no restrictions are imposed in this application. For example, the target model can be any model structure suitable for time series classification, such as a deep learning-based convolutional neural network, recurrent neural network, or lightweight fully connected network.
[0111] The target motion data stream can contain multiple motion data sets arranged chronologically. It must include at least the current target motion data set, and may also include one or more motion data sets preceding it. Each motion data set contains motion data corresponding to multiple moments within the target duration.
[0112] The target motion data stream and the similarity data stream can both serve as input to the target model. The target motion data stream provides the raw motion information of the first electronic device over a period of time, reflecting the changes in the motion data itself. The similarity data stream provides information on the degree of matching between the motion data and the target template data within the same time period. Both describe the motion state of the first electronic device from different perspectives and complement each other.
[0113] Step S1022: Based on the target model, output the result representing the first electronic device being in a knocking vibration state, and determine that the first electronic device has performed the target action.
[0114] The target motion data stream includes multiple motion data groups, and the multiple motion data groups include at least the target motion data group, which includes motion data corresponding to multiple moments within the target duration.
[0115] The training of the target model can be completed offline. During training, a large amount of positive and negative sample data can be collected. Positive sample data consists of motion data streams and corresponding similarity data streams collected when the first electronic device performs a tapping action, while negative sample data consists of motion data streams and corresponding similarity data streams collected when the first electronic device is in a non-tapping state (such as holding and shaking, normal writing, or being placed still). Each set of sample data is labeled to indicate whether it belongs to a tapping action or a non-tapping action.
[0116] The motion data streams and similarity data streams of positive and negative samples are input into the target model, which outputs the prediction results. The difference between the predicted results and the true labels is calculated using a loss function, and the model parameters are adjusted based on this difference. Through repeated training on a large amount of sample data, the model gradually learns that: when a knocking action occurs, specific changes corresponding to the knocking action appear in the motion data stream, and a consistently high similarity value appears in the similarity data stream; however, in the case of non-knocking actions, even if local changes similar to knocking occur in the motion data stream, a consistently high similarity distribution does not form in the similarity data stream. By learning the difference between the knocking vibration states simultaneously exhibited by these two types of data during a knocking action and the inability to simultaneously exhibit knocking vibration states in the case of non-knocking actions, the target model can effectively distinguish between knocking and non-knocking actions, thus enabling accurate classification in practical applications.
[0117] When the classification result output by the target model indicates that the first electronic device is in a state of knocking vibration, it is determined that the first electronic device has performed the target action, thereby triggering the second electronic device to perform the corresponding target operation.
[0118] In this embodiment, by inputting both the target motion data stream and the similarity data stream into the target model, the target model can classify the tapping action based on multi-dimensional information, thus more accurately identifying the tapping action. Compared to a method that relies solely on the similarity data stream for threshold judgment, the target model can learn more complex classification patterns, such as the time interval between peaks in the similarity data stream and the correlation between peaks and corresponding data in the motion data stream, thereby further improving the accuracy of recognition and reducing the probability of misjudgment.
[0119] As another optional embodiment of this application, refer to Figure 4 This is a flowchart illustrating a control method provided in Embodiment 6 of this application, as shown below. Figure 4 As shown, the method may include, but is not limited to, the following steps:
[0120] Step S301: Obtain the target motion data set of the first electronic device. The target motion data set includes an acceleration data set composed of first acceleration data, second acceleration data, and third acceleration data. The first acceleration data, second acceleration data, and third acceleration data correspond to acceleration data along different axes.
[0121] In this embodiment, the first electronic device has a built-in acceleration sensor to detect the linear acceleration experienced by the first electronic device in space.
[0122] The accelerometer can simultaneously output acceleration components along three mutually orthogonal axes, denoted as the first acceleration data, the second acceleration data, and the third acceleration data, respectively. Since the spatial orientation of the first electronic device during the striking action is arbitrary and the striking direction is unpredictable, the acceleration components along different axes for the same striking event will change depending on the pen's posture. Therefore, relying solely on acceleration data along a single axis is insufficient to fully reflect the acceleration changes caused by the striking action. By collecting acceleration data along three axes, the acceleration changes of the striking action in three-dimensional space can be completely recorded, providing a comprehensive data foundation for subsequent processing.
[0123] The target motion data set consists of acceleration data sets from multiple moments within a target duration. The target duration determines the time span covered by this set of acceleration data, consistent with the meaning of the target duration in the previous embodiment. At each moment, the acceleration data set contains acceleration data along three axes: a first acceleration data set, a second acceleration data set, and a third acceleration data set. These three acceleration data sets correspond to three different spatial axes, such as the X-axis, Y-axis, and Z-axis. The acceleration data along these three axes collectively reflect the motion state of the first electronic device in three-dimensional space at that moment.
[0124] Step S301 is an implementation of step S1011 in Example 2.
[0125] Step S302: Perform amplitude synthesis processing on the axial acceleration data contained in the target motion data group to obtain the second motion data group.
[0126] Since the orientation of the first electronic device in space is arbitrary, the distribution of the acceleration signal generated by the tapping action along each axis will change with the device's orientation. If the acceleration data along a certain axis is directly used to match the target template data, the matching effect will be affected when the device's orientation is inconsistent with the orientation at the time of template acquisition.
[0127] To address this issue, this embodiment performs amplitude synthesis processing on the axial acceleration data in the target motion data set. Amplitude synthesis processing can be understood as combining the three axial acceleration data at the same moment to obtain a composite value related to the vibration intensity at that moment, regardless of the orientation of the device in space.
[0128] In this embodiment, the specific method of amplitude synthesis processing is not limited. For example, the square root of the sum of squares of the three-axis acceleration data can be calculated, i.e., modulo operation. Through amplitude synthesis processing, the acceleration data set originally containing data in three axes is converted into one-dimensional synthesized data. This synthesized data can reflect the overall vibration intensity of the first electronic device at that moment, without being affected by the orientation of the device.
[0129] Step S303: Perform low-frequency filtering on the second motion data group to obtain a third motion data group. The low-frequency filtering is used to filter out slowly varying components from the second motion data group.
[0130] The second set of motion data includes both rapidly changing vibration components caused by the striking action and slowly varying components caused by gravitational acceleration and / or slow changes in the device's posture. These slowly varying components are not directly caused by the striking action; retaining them in the data would increase interference when matching with the target template data, affecting matching accuracy.
[0131] Therefore, this embodiment performs low-frequency filtering on the second motion data set to remove slowly varying components. Low-frequency filtering can be implemented, but is not limited to, using a high-pass filter. A high-pass filter allows high-frequency signals to pass through while attenuating low-frequency signals. By setting an appropriate cutoff frequency, the rapid vibration components (high-frequency components) caused by the striking motion can be retained, while the slowly varying components (low-frequency components) caused by gravitational acceleration and / or slow attitude changes can be filtered out.
[0132] The third motion data group mainly retains the vibration components caused by dynamic events such as tapping, which can more accurately reflect the dynamic vibration state of the first electronic device.
[0133] Step S304: Based on the similarity between the third motion data group and the target template data, obtain the similarity between the target motion data group and the target template data.
[0134] In this embodiment, the target template data can be reference data that has been acquired and processed in the same manner as steps S301 to S303. Specifically, when acquiring the target template data, triaxial acceleration data within a fixed duration during the striking action is also collected, and the triaxial acceleration data undergoes the same amplitude synthesis processing as in step S302 and the same low-frequency filtering processing as in step S303 to obtain the processed target template data. In this way, the target template data and the third motion data are consistent in data format and physical meaning, both being numerical sequences reflecting changes in vibration intensity.
[0135] Based on this, the similarity between the third motion data and the target template data can be determined. The specific method for determining the similarity between the third motion data and the target template data can be found in the relevant description of similarity determination in Example 2, for example, it can be obtained through cross-correlation calculations, etc., and will not be elaborated further here.
[0136] Since the third motion data is obtained by processing the target motion data group through amplitude synthesis and low-frequency filtering, and both reflect the motion state of the first electronic device within the same time period, the similarity between the third motion data and the target template data can be used as the similarity between the target motion data group and the target template data.
[0137] Step S305: Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, obtain the similarity data stream of the first electronic device.
[0138] The similarity data stream includes at least the similarity between the target motion data group and the target template data.
[0139] For a detailed description of step S305, please refer to the relevant description of step S1012 in Example 2, which will not be repeated here.
[0140] Step S306: If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action.
[0141] Step S307: Based on the first electronic device executing the target action, the second electronic device executes the target operation; the second electronic device establishes a communication connection with the first electronic device.
[0142] For a detailed description of steps S306-S307, please refer to the relevant description of steps S102-S103 in Example 1, which will not be repeated here.
[0143] In this embodiment, by performing amplitude synthesis processing on the triaxial acceleration data in the target motion data group, the acceleration data of each axis are synthesized into vibration intensity data independent of the device's orientation. This avoids the problem of the same tapping action affecting the matching effect due to changes in the distribution of acceleration components in different axes caused by different holding postures of the first electronic device. Simultaneously, by performing low-frequency filtering processing on the amplitude-synthesized data, slowly varying components caused by gravity or slow changes in the device's posture are removed, while retaining the rapid vibration components caused by the tapping action. This allows the third motion data used for similarity calculation to more accurately reflect the dynamic vibration state of the first electronic device. Similarity calculation based on the preprocessed third motion data and the target template data can effectively improve the accuracy and stability of the similarity calculation, providing a more reliable basis for subsequent matching condition judgment based on the similarity data stream, thereby further improving the accuracy of tapping action recognition.
[0144] Next, the control method will be explained using a stylus as the first electronic device. For example, the stylus has a built-in three-axis accelerometer. During the user's writing or holding of the stylus, the accelerometer continuously collects acceleration data of the stylus along three mutually orthogonal axes, which are denoted as the first acceleration data, the second acceleration data, and the third acceleration data, respectively. The acceleration data collected at each moment constitutes an acceleration data set. Multiple consecutive acceleration data sets are arranged in chronological order to form multiple motion data sets, which may include a target motion data set.
[0145] Amplitude synthesis is performed on the axial acceleration data contained in the target motion data set to obtain the second motion data set. Amplitude synthesis combines the three axial acceleration data at the same moment into a single value related to the vibration intensity at that moment, for example, by calculating the square root of the sum of the squares of the three axial acceleration data (modulo operation). After amplitude synthesis, the original acceleration data set containing three axial data is converted into one-dimensional composite data, which reflects the overall vibration intensity of the stylus at that moment and is unaffected by the stylus's orientation.
[0146] The second motion data set undergoes low-frequency filtering to obtain the third motion data set. Low-frequency filtering removes slowly varying components caused by gravitational acceleration and slow changes in the stylus's posture from the second motion data set, while retaining rapid vibration components caused by dynamic events such as tapping. After low-frequency filtering, the third motion data set more accurately reflects the dynamic vibration state of the stylus.
[0147] The similarity between the target motion data set and the target template data is obtained based on the similarity between the third motion data set and the target template data. The target template data is reference data obtained by pre-collecting acceleration data when a stylus repeatedly taps a table, and then performing the same amplitude synthesis and low-frequency filtering processes as described above. Since both have undergone the same preprocessing steps and have consistent data characteristics, similarity calculation can be performed directly. The similarity calculation can be implemented using cross-correlation. By sliding the target template data across the third motion data set, multiple similarity values are obtained, and a value (such as the maximum or average value) is determined from these similarity values as the similarity between the two.
[0148] When the similarity between the target motion data set and the target template data is higher than the target similarity threshold, it indicates that the stylus may have made a tapping motion within the target duration. At this time, the similarity data stream of the stylus is acquired. This similarity data stream includes at least the similarity between the target motion data set and the target template data, and may also include the similarity data corresponding to other target motion data sets preceding this target motion data set.
[0149] The target motion data stream and similarity data stream of the stylus are input into the target model. The target motion data stream includes multiple motion data sets, which include at least the current target motion data set, and may also include one or more motion data sets preceding it. The target model processes the target motion data stream and similarity data stream, and outputs a classification result characterizing whether the stylus is in a tapping vibration state.
[0150] When the classification result output by the target model indicates that the stylus is in a tapping vibration state, it is determined that the stylus has performed the target action. The target action can be the action of tapping the table twice with the tail of the stylus. This action is a specific gesture performed by the user after writing with the stylus to trigger the second electronic device to perform the target operation.
[0151] The target action is executed based on the stylus, and a second electronic device (such as a mobile phone or tablet computer) that has established a communication connection with the stylus executes the target operation.
[0152] Through the above process, the stylus pen performs amplitude synthesis and low-frequency filtering preprocessing, and combines the target template data to calculate similarity and generate a similarity data stream. Then, the target model judges the target motion data stream and the similarity data stream, which can effectively distinguish between the user's intentional tapping action and unintentional hand shaking. While ensuring the tapping action recognition rate, it significantly reduces the false touch rate and improves the user experience.
[0153] As another optional embodiment of this application, the control method provided in Embodiment 7 of this application is mainly an implementation of step S1012 in Embodiment 2. In this embodiment, there can be multiple target template data, and the multiple target template data correspond to the data obtained by repeatedly striking the target object with different striking forces within a fixed time.
[0154] Step S1012 may specifically include, but is not limited to, the following steps:
[0155] Step S10121: Match the target motion data group with multiple target template data respectively to obtain multiple candidate similarities.
[0156] In actual use, the force with which a user performs a tapping action may vary due to usage habits, usage scenarios, or individual user differences. For example, some users are accustomed to tapping the table lightly, while others may use more force. The acceleration data generated by different tapping forces differs in amplitude and vibration duration. If only a single target template data is used for matching, when the user's tapping force is inconsistent with the force collected from the template, it may lead to low similarity, thus failing to accurately identify the tapping action.
[0157] To address this issue, this embodiment can pre-set multiple target template data, each corresponding to a specific striking force. For example, acceleration data when a user strikes a target object with light, medium, and heavy force can be collected, and the data can be processed according to the same amplitude synthesis and low-frequency filtering procedures as steps S302 to S303 in Embodiment 6 to generate three target template data, corresponding to light, medium, and heavy striking forces, respectively.
[0158] After obtaining the current target motion data set, the target motion data set is matched with each target template data set, and the similarity between the target motion data set and each target template data set is calculated to obtain multiple candidate similarities. Each candidate similarity reflects the degree of matching between the target motion data set and the target template data set under the corresponding striking force.
[0159] The matching method can be implemented by cross-correlation operation. For details, please refer to the relevant introduction of step S1012 in Example 2, which will not be repeated here.
[0160] Step S10122: If at least one of the multiple candidate similarities is higher than the target similarity threshold, then the similarity data stream of the first electronic device is obtained.
[0161] Step S10122: If at least one of the multiple candidate similarities is higher than the target similarity threshold, then the similarity data stream of the first electronic device is obtained.
[0162] After obtaining multiple candidate similarities, the first electronic device compares each candidate similarity with a target similarity threshold. If at least one candidate similarity exceeds the target similarity threshold, it indicates a high degree of matching between the target motion data set and the target template data corresponding to a certain striking force, suggesting that the first electronic device may be performing a striking action at that force. At this point, the acquisition of the similarity data stream is triggered for subsequent matching condition determination.
[0163] The striking force represented by the target template data corresponding to the maximum similarity among the candidates is the force that best matches the current target motion data set. When acquiring the similarity data stream, the target template data corresponding to this best-matching force can be used as a reference for subsequent matching and judgment.
[0164] In this embodiment, multiple target template data corresponding to different striking intensities are set, and the target motion data group is matched with each of the multiple target template data. As long as the similarity with any one of the target template data is higher than a threshold, the subsequent process is triggered. This method can adapt to different users' striking habits and changes in striking intensity in different scenarios, avoiding missed identifications caused by mismatch between the user's striking intensity and a single template, thus improving the reliability of striking action recognition.
[0165] As another optional embodiment of this application, the control method provided in Embodiment 8 of this application is mainly an implementation of step S1021 in Embodiment 5, which may include, but is not limited to, the following steps:
[0166] Step S10211: Input the target motion data stream and the similarity data stream into the target model deployed in the second electronic device.
[0167] After acquiring the target motion data stream and similarity data stream, the first electronic device sends them to the second electronic device via an established communication connection (such as Bluetooth or Wi-Fi). Upon receiving this data, the second electronic device inputs it into a locally deployed target model, which processes the data and outputs the classification result.
[0168] In this embodiment, before sending the target motion data stream and similarity data stream to the second electronic device, the first electronic device can first determine whether the similarity data stream meets the matching conditions. Only when the similarity data stream meets the matching conditions is the target motion data stream and similarity data stream sent to the second electronic device, where the target model in the second electronic device performs further judgment. This hierarchical processing mechanism ensures that the first electronic device only triggers the second electronic device to execute model inference when it initially determines that a tapping action may exist, thereby reducing the amount of data transmission between the first and second electronic devices, reducing communication power consumption, and also reducing unnecessary computational overhead for the second electronic device.
[0169] Corresponding to the first electronic device (such as a stylus) being a low-power, lightweight device, the second electronic device (such as a mobile phone or tablet) possesses a more complete operating system, stronger network communication capabilities, and application management framework implementation methods. Updates to the target model are typically performed through application upgrades or silent updates of model files, which can be achieved using the existing software update mechanisms of the second electronic device without user intervention. However, the first electronic device usually lacks independent network connectivity and complex software management capabilities; upgrades often require firmware flashing or relaying through the second electronic device, resulting in a complex process and the risk of communication interruption. Therefore, deploying the target model in the second electronic device allows for updates using its mature software management channels, decoupling the algorithm from the low-power peripheral, simplifying the maintenance process, and avoiding frequent modifications to the firmware of the first electronic device.
[0170] In this embodiment, the first electronic device (such as a stylus) is typically small in size, has limited battery capacity, and relatively weak processor performance. If the target model is deployed in the first electronic device, the model inference process will consume a lot of computing resources and power, affecting the battery life and response speed of the first electronic device. By delegating the model inference task to a second electronic device (such as a mobile phone or tablet), the stronger computing power and sufficient power supply of the second electronic device can be utilized, reducing the burden on the first electronic device and extending its battery life.
[0171] Furthermore, the computing power and storage space of the second electronic device are typically far superior to those of the first, allowing for the deployment of more complex and accurate target models (such as deeper neural networks), thereby improving the accuracy of tapping action recognition. The first electronic device does not need to undertake complex model inference tasks, but only needs to complete data acquisition and preliminary processing, reducing the requirements for its hardware performance.
[0172] Next, the control method will be explained using a stylus as the first electronic device. For example, the stylus has a built-in three-axis accelerometer. During the user's writing or holding of the stylus, the accelerometer continuously collects acceleration data of the stylus along three mutually orthogonal axes, which are denoted as the first acceleration data, the second acceleration data, and the third acceleration data, respectively. The acceleration data collected at each moment constitutes an acceleration data set. Multiple consecutive acceleration data sets are arranged in chronological order to form multiple motion data sets, which may include a target motion data set.
[0173] Amplitude synthesis is performed on the axial acceleration data contained in the target motion data set to obtain the second motion data set. Amplitude synthesis combines the three axial acceleration data at the same moment into a single value related to the vibration intensity at that moment, for example, by calculating the square root of the sum of the squares of the three axial acceleration data (modulo operation). After amplitude synthesis, the original acceleration data set containing three axial data is converted into one-dimensional composite data, which reflects the overall vibration intensity of the stylus at that moment and is unaffected by the stylus's orientation.
[0174] The second motion data set undergoes low-frequency filtering to obtain the third motion data set. Low-frequency filtering removes slowly varying components caused by gravitational acceleration and slow changes in the stylus's posture from the second motion data set, while retaining rapid vibration components caused by dynamic events such as tapping. After low-frequency filtering, the third motion data set more accurately reflects the dynamic vibration state of the stylus.
[0175] The similarity between the target motion data set and the target template data is obtained based on the similarity between the third motion data set and the target template data. The target template data is reference data obtained by pre-collecting acceleration data when a stylus repeatedly taps a table, and then performing the same amplitude synthesis and low-frequency filtering processes as described above. Since both have undergone the same preprocessing steps and have consistent data characteristics, similarity calculation can be performed directly. The similarity calculation can be implemented using cross-correlation. By sliding the target template data across the third motion data set, multiple similarity values are obtained, and a value (such as the maximum or average value) is determined from these similarity values as the similarity between the two.
[0176] When the similarity between the target motion data set and the target template data is higher than the target similarity threshold, it indicates that the stylus may have made a tapping motion within the target duration. At this time, the similarity data stream of the stylus is acquired. This similarity data stream includes at least the similarity between the target motion data set and the target template data, and may also include the similarity data corresponding to other target motion data sets preceding this target motion data set.
[0177] The stylus transmits target motion data streams and similarity data streams to a second electronic device via an established communication connection. The target motion data streams include three data streams: a first acceleration data stream, a second acceleration data stream, and a third acceleration data stream. The similarity data stream is sent as a fourth data stream, for a total of four data streams sent to the second electronic device. Upon receiving these four data streams, the second electronic device inputs them into a locally deployed target model. The target model processes the data and outputs a classification result indicating whether the stylus is experiencing a tapping vibration.
[0178] When the classification result output by the target model indicates that the stylus is in a tapping vibration state, it is determined that the stylus has performed the target action. The target action can be the action of tapping the table twice with the tail of the stylus. This action is a specific gesture performed by the user after writing with the stylus to trigger the second electronic device to perform the target operation.
[0179] The target action is performed based on the stylus, and a second electronic device (such as a mobile phone or tablet computer) that has established a communication connection with the stylus performs the target operation, such as saving the content currently displayed on the screen of the second electronic device.
[0180] Through the above process, the stylus pen performs amplitude synthesis and low-frequency filtering preprocessing, and combines this with target template data to calculate similarity and generate a similarity data stream. The triaxial acceleration data and the similarity data stream are then sent as four data streams to a second electronic device, where the target model performs a comprehensive judgment. This division of labor fully leverages the low power consumption advantage of the stylus pen in data acquisition and preliminary processing, as well as the high performance advantage of the second electronic device in complex calculations and model inference. While ensuring a high recognition rate for tapping actions, it significantly reduces the false touch rate and improves the user experience.
[0181] As another optional embodiment of this application, the control method provided in Embodiment 9 of this application is mainly an implementation method for the above-mentioned target operation, and may specifically include, but is not limited to:
[0182] Save the content currently displayed on the screen of the second electronic device.
[0183] The target operation can be pre-associated with the target action (such as a tapping action) performed by the first electronic device. Once it is determined that the first electronic device has performed the target action, the second electronic device will automatically perform the save operation without requiring manual triggering by the user.
[0184] Let's take a scenario where the first electronic device is a stylus and the second electronic device is a foldable phone as an example. When a user writes or draws on the foldable phone, the writing end of the stylus touches the screen, and the user leaves handwriting on the screen. After the user finishes writing or drawing, they want to save the handwriting on the screen.
[0185] At this point, the user operates according to preset gestures. Specifically, the stylus can be flipped so that the tail of the stylus (the end opposite the writing end) faces the table, and then the tail of the stylus can be tapped twice on the table. The stylus's built-in accelerometer collects the motion data during the tapping process. After preprocessing such as amplitude synthesis and low-frequency filtering, it is cross-correlated with the pre-stored target template data to generate a similarity data stream.
[0186] When the similarity data stream meets the matching conditions, it is determined that the stylus has performed the target action.
[0187] Subsequently, the stylus sends the target motion data stream and similarity data stream to the foldable screen phone, where the target model on the phone makes further judgments. When the classification result output by the target model confirms that the stylus is in a tapping vibration state, the phone automatically performs a save operation, saving the handwriting content currently displayed on the screen to local storage or the cloud.
[0188] In this embodiment, users do not need to put down the stylus or perform any additional touch or button operations on the phone screen. They can quickly save the screen content simply by flipping and tapping the stylus. This operation method conforms to the user's natural behavior when using a stylus, simplifies the operation process, and improves interaction efficiency and user experience.
[0189] The save operation in this embodiment can be implemented in various ways. For example, the save operation can be to save the content on the current screen as an image file (such as PNG or JPEG format), or to save the handwriting data during the writing process as a vector file or a note file in a specific format, or to copy the screen content to the clipboard for later pasting. The specific save method used can be set according to the actual application requirements.
[0190] It should be noted that the target operation is not limited to saving the content displayed on the screen. In other embodiments, the target operation can also be other operations in the second electronic device that are associated with the target action, such as switching application interfaces, starting a specified function, sending instructions, or executing user-defined macro commands, as long as the operation is pre-associated with the target action and is executed by the second electronic device after it is determined that the first electronic device has executed the target action.
[0191] The control device provided in this application will be described below. The control device described below can be referred to in correspondence with the control method described above.
[0192] The control device includes:
[0193] The acquisition module is used to acquire a similarity data stream of a first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within a target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping a target object within a fixed time period.
[0194] The first determining module is used to determine that the first electronic device has performed the target action if the similarity data stream meets the matching conditions.
[0195] An execution module is used to execute the target action on a second electronic device based on the first electronic device performing the target action; the second electronic device has a communication connection with the first electronic device.
[0196] In this embodiment, the acquisition module can be specifically used for:
[0197] Acquire a target motion data set of a first electronic device, the target motion data set including motion data corresponding to multiple moments within a target duration;
[0198] Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, the similarity data stream of the first electronic device is obtained;
[0199] The similarity data stream includes at least the similarity between the target motion data group and the target template data.
[0200] In this embodiment, the control device may further include:
[0201] The second determining module is used to determine that the first electronic device has performed an interference action if the similarity data stream does not meet the matching conditions; the interference action indicates that the first electronic device is shaken multiple times within the target duration.
[0202] In this embodiment, the acquisition module acquires the target motion data set of the first electronic device, which may specifically include:
[0203] In response to the target motion data set satisfying the first condition, the target motion data set of the first electronic device is acquired;
[0204] Wherein, the first condition indicates that within a first time period before the first motion data is collected, the rotation amplitude of the first electronic device is higher than the target amplitude; the target action indicates that the first electronic device repeatedly strikes the target object with the target end within a fixed time period.
[0205] In this embodiment, the first determining module can be specifically used for:
[0206] The target motion data stream and the similarity data stream are input into the target model;
[0207] Based on the output of the target model, which characterizes the first electronic device as being in a state of knocking vibration, it is determined that the first electronic device has performed the target action;
[0208] The target motion data stream includes multiple motion data groups, and the multiple motion data groups include at least the target motion data group, which includes motion data corresponding to multiple moments within the target duration.
[0209] In this embodiment, the target motion data set may include an acceleration data set consisting of a first acceleration data set, a second acceleration data set, and a third acceleration data set, wherein the first acceleration data set, the second acceleration data set, and the third acceleration data set correspond to acceleration data along different axes.
[0210] The control device may further include:
[0211] The first processing module is used to perform amplitude synthesis processing on the axial acceleration data contained in the target motion data group to obtain the second motion data group.
[0212] The second processing module is used to perform low-frequency filtering on the second motion data group to obtain a third motion data group. The low-frequency filtering is used to filter out slowly varying components from the second motion data group.
[0213] The third determining module is used to obtain the similarity between the target motion data group and the target template data based on the similarity between the third motion data group and the target template data.
[0214] In this embodiment, there may be multiple target template data, and the multiple target template data correspond to the data obtained by repeatedly striking the target object with different striking forces within a fixed time.
[0215] The acquisition module, based on the similarity between the target motion data group and the target template data being higher than a target similarity threshold, acquires a similarity data stream of the first electronic device, which may specifically include:
[0216] The target motion data set is matched with multiple target template data sets respectively to obtain multiple candidate similarities;
[0217] If at least one of the candidate similarities is higher than the target similarity threshold, then the similarity data stream of the first electronic device is obtained.
[0218] In this embodiment, the first determining module inputs the target motion data stream and the similarity data stream into the target model, which may specifically include:
[0219] The target motion data stream and the similarity data stream are input into the target model deployed in the second electronic device.
[0220] In this embodiment, the target operation may include saving the content currently displayed on the screen of the second electronic device.
[0221] In another embodiment of this application, reference is made to Figure 5 A first electronic device is provided, which may include:
[0222] Sensor 100 is used to collect motion data.
[0223] Memory 200 is used to store program instructions.
[0224] Processor 300 is configured to read and execute program instructions from memory 200 via a bus to perform the following steps:
[0225] Acquire the similarity data stream of the first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within a target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping the target object within a fixed time period;
[0226] If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action;
[0227] Based on the fact that the first electronic device has performed the target action, a notification message is sent to the second electronic device so that the second electronic device can perform the target operation; the second electronic device has established a communication connection with the first electronic device.
[0228] In this embodiment, the first electronic device can specifically be a stylus. The stylus can have a cylindrical structure with a first end and a second end. The first end is provided with a device (such as a capacitive stylus tip) that can be sensed by the screen of the second electronic device for writing or drawing on the screen; the second end is opposite to the first end and generally does not have a device that can sense writing, which is the target end defined in the aforementioned embodiment.
[0229] In normal use cases, users hold the stylus and use the first end to touch the screen to write. In scenarios requiring a specific action, users flip the stylus so that the second end faces the target object and use the second end to perform a tapping motion. By detecting the stylus's flipping motion and subsequent tapping motion, the system can accurately identify the user's intent and avoid accidental triggering.
[0230] In another embodiment of this application, a second electronic device is provided. In this embodiment, the second electronic device may specifically be a terminal device such as a mobile phone, tablet computer, laptop computer, or smart display screen. The second electronic device establishes a communication connection with a first electronic device (such as a stylus pen) and is used to receive data sent by the first electronic device and perform target operations.
[0231] The second electronic device may include:
[0232] A communication module is used to establish a communication connection with a first electronic device and receive a target motion data stream and a similarity data stream sent by the first electronic device. The target motion data stream includes multiple motion data groups, and the multiple motion data groups include at least a target motion data group. The target motion data group includes motion data corresponding to multiple moments within a target duration. The similarity data stream includes multiple similarity data, and each similarity data corresponds to the similarity between the motion data of the first electronic device within the target duration and the target template data. The target template data is data obtained by the electronic device repeatedly tapping a target object within a fixed duration.
[0233] The memory is used to store program instructions and a target model; the target model is used to output a classification result characterizing whether the first electronic device is in a knocking vibration state based on the input target motion data stream and the similarity data stream.
[0234] A processor, configured to read and execute the program instructions to perform the following steps:
[0235] The communication module receives the target motion data stream and the similarity data stream sent by the first electronic device.
[0236] The target motion data stream and the similarity data stream are input into the target model;
[0237] Based on the output of the target model, which characterizes the first electronic device as being in a state of knocking vibration, it is determined that the first electronic device has performed the target action;
[0238] The target operation is performed based on the first electronic device executing the target action.
[0239] In another embodiment of this application, a control system is provided, which may include:
[0240] First electronic device, used for:
[0241] Acquire the similarity data stream of the first electronic device; the similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within a target time period and the target template data, the target template data being the data obtained by the electronic device repeatedly tapping the target object within a fixed time period;
[0242] If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action;
[0243] Based on the fact that the first electronic device has performed the target action, a notification message is sent to the second electronic device.
[0244] The second electronic device, having established a communication connection with the first electronic device, is used for:
[0245] Receive the notification information;
[0246] In response to the notification information, perform the target operation.
[0247] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0248] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0249] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0250] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A control method, comprising: Obtain the similarity data stream of the first electronic device; The similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within the target time period and the target template data. The target template data is the data obtained by the electronic device repeatedly tapping the target object within a fixed time period. If the similarity data stream meets the matching conditions, it is determined that the first electronic device has performed the target action; Based on the first electronic device performing the target action, the second electronic device performs the target operation; the second electronic device establishes a communication connection with the first electronic device.
2. The control method according to claim 1, wherein acquiring the similarity data stream of the first electronic device includes: Acquire a target motion data set of a first electronic device, the target motion data set including motion data corresponding to multiple moments within a target duration; Based on the fact that the similarity between the target motion data group and the target template data is higher than the target similarity threshold, the similarity data stream of the first electronic device is obtained; The similarity data stream includes at least the similarity between the target motion data group and the target template data.
3. The control method according to claim 2, further comprising: If the similarity data stream does not meet the matching conditions, it is determined that the first electronic device has performed an interference action; the interference action indicates that the first electronic device is shaken multiple times within the target duration.
4. The control method according to claim 2, wherein acquiring the target motion data set of the first electronic device includes: In response to the target motion data set satisfying the first condition, the target motion data set of the first electronic device is acquired; Wherein, the first condition indicates that within a first time period before the first motion data is collected, the rotation amplitude of the first electronic device is higher than the target amplitude; the target action indicates that the first electronic device repeatedly strikes the target object with the target end within a fixed time period.
5. The control method according to claim 1, wherein determining that the first electronic device has performed a target action if the similarity data stream satisfies the matching condition includes: The target motion data stream and the similarity data stream are input into the target model; Based on the output of the target model, which characterizes the first electronic device as being in a state of knocking vibration, it is determined that the first electronic device has performed the target action; The target motion data stream includes multiple motion data groups, and the multiple motion data groups include at least the target motion data group, which includes motion data corresponding to multiple moments within the target duration.
6. The control method according to claim 2, wherein the target motion data set comprises an acceleration data set consisting of a first acceleration data set, a second acceleration data set, and a third acceleration data set, wherein the first acceleration data set, the second acceleration data set, and the third acceleration data set correspond to acceleration data along different axes, respectively; The control method further includes: The amplitude synthesis processing is performed on the axial acceleration data contained in the target motion data group to obtain the second motion data group; The second motion data set is subjected to low-frequency filtering to obtain a third motion data set. The low-frequency filtering is used to filter out slowly varying components from the second motion data set. The similarity between the target motion data group and the target template data is obtained based on the similarity between the third motion data group and the target template data.
7. The control method according to claim 2, wherein there are multiple target template data, and the multiple target template data correspond to data obtained by repeatedly striking a target object with different striking forces within a fixed time period; The step of obtaining the similarity data stream of the first electronic device based on the similarity between the target motion data group and the target template data being higher than the target similarity threshold includes: The target motion data set is matched with multiple target template data sets respectively to obtain multiple candidate similarities; If at least one of the candidate similarities is higher than the target similarity threshold, then the similarity data stream of the first electronic device is obtained.
8. The control method according to claim 5, wherein inputting the target motion data stream and the similarity data stream into the target model comprises: The target motion data stream and the similarity data stream are input into the target model deployed in the second electronic device.
9. The control method according to claim 1, wherein the target operation includes saving the content currently displayed on the screen of the second electronic device.
10. A control device, comprising: The acquisition module is used to acquire the similarity data stream of the first electronic device; The similarity data stream includes multiple similarity data, each similarity data corresponding to the similarity between the motion data of the first electronic device within the target time period and the target template data. The target template data is the data obtained by the electronic device repeatedly tapping the target object within a fixed time period. The first determining module is used to determine that the first electronic device has performed the target action if the similarity data stream meets the matching conditions; An execution module is used to execute the target action on a second electronic device based on the first electronic device performing the target action; the second electronic device has a communication connection with the first electronic device.