Method for quickly recognizing gestures based on greedy heuristic algorithm
Through the method based on greedy heuristic algorithm, the problems of data and computing resource consumption, development cycle and real-time performance in gesture recognition technology are solved, and fast, transparent and efficient gesture recognition is achieved, suitable for resource-constrained devices and real-time interactions Scene.
Patent Information
- Application Number
- CN202410936084.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-12
AI Technical Summary
Existing gesture recognition technologies face large data requirements, high computing resource consumption, long training time, model complexity and real-time performance challenges, especially in small sample sizes and specific scenarios with poor recognition results.
Using a method based on greedy heuristic algorithm, the user's gesture track point set is collected for resampling, normalization and translation, and the gesture matching is used for greedy algorithm, and the matching distance between the candidate point set and the template point set is calculated to achieve rapid identification. .
Reliance on a large amount of training data is reduced, computing resource requirements is reduced, development cycle is shortened, model transparency and real-time recognition performance are improved, and real-time interaction needs are met.
Smart Images

Figure CN118968611A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of gesture recognition, and in particular to a method for quickly recognizing gestures based on a greedy heuristic algorithm. Background Art
[0002] Gesture recognition technology enables an intuitive human-computer interaction method that controls computers or other smart devices by analyzing and understanding user gestures. This technology has greatly enriched the diversity of interactive interfaces, especially in mobile devices, virtual reality environments, interactive games, and smart home systems. Although traditional gesture recognition methods rely on precise feature extraction and powerful classification algorithms, they still face challenges such as improving accuracy, supporting a wider range of gestures, and achieving real-time feedback without delay.
[0003] The existing technical solutions mainly use neural networks to recognize gestures and use deep learning methods to achieve automatic recognition of complex gestures. This process usually includes the following steps:
[0004] 1. Data preparation: Collect a comprehensive gesture dataset that includes diverse gesture images or paths and corresponding category labels. Make sure the dataset covers a wide range of gesture types and user differences.
[0005] 2. Data preprocessing: Perform necessary preprocessing operations on the collected data, such as image normalization, filtering, and enhancement, to improve the efficiency and accuracy of neural network learning.
[0006] 3. Network design: Build a neural network architecture suitable for gesture recognition tasks. Commonly used network models include convolutional neural networks (CNNs) and recurrent neural networks (RNNs), as well as their derivatives, which can effectively extract gesture features.
[0007] 4. Network training: Use the prepared data set to train the neural network. During the training process, the network parameters are adjusted through the back propagation algorithm so that the network can learn the key features to distinguish different gestures.
[0008] 5. Network evaluation: Use an independent test set to evaluate the performance of the trained neural network. By calculating indicators such as accuracy, recall, and F1 score, the recognition effect is measured.
[0009] 6. Real-time recognition: Integrate the trained neural network into the actual application for real-time gesture recognition. During the application process, the network will process the input gesture data in real time and output the predicted gesture category.
[0010] The advantage of the neural network method lies in its excellent feature extraction ability and adaptability. The network can automatically recognize patterns in complex gestures. However, this method usually requires a large amount of labeled data and high computing resources for effective training. It may face certain challenges for the recognition of some gesture categories or specific scenes with small sample sizes.
[0011] In summary, the shortcomings of the prior art mainly include:
[0012] 1. Large data requirements: Neural network gesture recognition technology requires a large amount of labeled data to train the model, and has high requirements for data collection and preprocessing.
[0013] 2. High computing resource consumption: Deep learning models usually require significant computing resources, including high-performance GPUs and large amounts of memory, which is a limitation on resource-constrained devices.
[0014] 3. Long training and tuning time: The training and tuning of neural network models may take a long time, which affects the development cycle and iteration speed.
[0015] 4. Model complexity and opacity: The black-box nature of deep learning models makes it difficult to understand and explain the model decision-making process.
[0016] 5. Real-time performance challenge: Although existing technologies are capable of processing complex gestures, the inference speed of the model may become a bottleneck in scenarios that require real-time feedback.
[0017] Based on the above defects, we propose a method for quickly recognizing gestures based on a greedy heuristic algorithm. Summary of the invention
[0018] 1. Technical issues to be resolved
[0019] In view of the shortcomings of the prior art, the present invention provides a method for quickly recognizing gestures based on a greedy heuristic algorithm, which solves the challenges of the prior art in terms of data, computing resources, development cycle, model transparency and real-time performance.
[0020] (II) Technical solution
[0021] To achieve the above-mentioned purpose, the present invention provides the following technical solution: a method for quickly recognizing gestures based on a greedy heuristic algorithm, comprising the following steps:
[0022] Step 1: Collect the point set of the user's gesture trajectory;
[0023] Step 2: Resample the given point set;
[0024] Step 3: Normalize the sampled point set so that all points are uniformly scaled to a predetermined range;
[0025] Step 4: Translate the scaled point set to the origin of the coordinate system;
[0026] Step 5: Use the greedy algorithm for gesture matching and select the best match by calculating the matching distance between the candidate point set and the template point set.
[0027] Preferably, the second step includes the following contents:
[0028] Compute the total path length of consecutive points:
[0029]
[0030] Where d(pi,pi+1) is the Euclidean distance between point pi and point pi+1, and N is the number of points in the original point set;
[0031] Calculate the interval length I:
[0032]
[0033] Where n is the number of points after resampling;
[0034] Traverse each pair of consecutive points. If the cumulative distance D+d between the two points is greater than or equal to the interval length I, insert a new point q between the two points. The coordinates of the new point (qx, qy) are obtained by linear interpolation between the two points. The formula is:
[0035]
[0036] Where D is the cumulative distance from the last resampled point to the current point pi-1, and d is the distance between point pi-1 and point pi;
[0037] If a new point is inserted, the cumulative distance D is reset to 0, otherwise, D is updated to D+d;
[0038] If the last point is not added due to rounding error, add the last point of the original point set to the resampled point set.
[0039] Preferably, the third step includes the following contents:
[0040] Find the minimum bounding box that contains all the points, by calculating the minimum and maximum X and Y coordinates of all the points in the point set:
[0041]
[0042] Where i traverses all points;
[0043] Determine the scaling size:
[0044] size=max(maxX-minX,maxY-minY)
[0045] For each point pi in the point set, calculate its new coordinates (qx, qy) within the normalized square;
[0046]
[0047] Construct a new point set where each point has the same stroke ID.
[0048] Preferably, the fourth step includes the following contents:
[0049] Calculate the centroid:
[0050]
[0051] Where N is the total number of points in the point set;
[0052] Calculate new coordinates;
[0053]
[0054] Construct a new point set.
[0055] Preferably, the fifth step includes the following contents:
[0056] S1: Initialize the best matching variables: set the index u of the best matching template to -1 and the best matching score b to positive infinity;
[0057] S2: traverse the template point set set: for each point set Pi in the point set template set, where i = 0, 1, ..., n-1, and n is the number of all template point sets;
[0058] S3: Calculate the matching distance di between the candidate point set C and the template point set Pi:
[0059] d = Match(C.Points,P.Points)
[0060] S4: If di is less than the current best matching score b, update b to di, and update the index u of the best matching template to the index i of the current template;
[0061] If no matching template is found (i.e. u = -1), a no-match result is returned. Otherwise, the name of the best matching template and the matching score are returned. The matching score is calculated based on the value of b.
[0062]
[0063] Construct result: Construct a result object. If u=-1, it means there is no match. Otherwise, it contains the name and score of the best matching template:
[0064]
[0065] Among them, C is the candidate point set, Pu is the best matching point set template, u is the index of the best matching template, b is the minimum matching distance, and score is the matching score calculated based on b.
[0066] Preferably, Match is calculated as follows:
[0067] (4) Define greedy matching parameters: Let e be a parameter between 0 and 1, which is used to determine the step length. Step is a power function based on the length of the point set, calculated as follows:
[0068]
[0069] (5) Initialize the minimum distance: Set the minimum distance min to positive infinity initially;
[0070] (6) Traversing the point set: Starting from index i=0, traverse the point set points with a step length of step, and perform the following steps: a. Calculate the distance d1 between the point set points starting from point points[i] and the point set P.Points:
[0071] d1=PointsDistance(points, P.Points, i)
[0072] b. Calculate the distance d2 between the point set P.Points starting from point P.Points[i] and the point set points:
[0073] d2=PointsDistance(P.Points, points, i)
[0074] c. Update the minimum distance min to the smaller value of d1 and d2;
[0075] (4) Return the minimum distance: the last calculated minimum distance min;
[0076] in, PointsDistance is a minimum operator, which calculates the minimum weighted distance sum between two point sets.
[0077] Preferably, the PointsDistance calculation process is as follows:
[0078] (2) Initialize the matching array: Create a Boolean array matched, whose length is equal to the length of pts1, and all elements are initialized to false;
[0079] Calculate the weighted distance sum: Initialize the sum to 0. Then, iterate from the starting point start until you return to start:
[0080]
[0081] Where wi is the weight, defined as:
[0082]
[0083] And UnmatchedUnmatched is the set of all points in pts2 that have not been matched;
[0084] Return the sum of weighted distances: When the iteration returns to the starting point start, the sum is returned;
[0085] The Distance function calculates the Euclidean distance between two points:
[0086]
[0087] (III) Beneficial effects
[0088] Compared with the prior art, the present invention provides a method for quickly recognizing gestures based on a greedy heuristic algorithm, which has the following beneficial effects:
[0089] 1. Compared with the neural network method which requires a large amount of labeled data, the method of the present invention represents gestures as point sets, which reduces the dependence on a large amount of training data and reduces the workload of data collection and labeling.
[0090] 2. The method for quickly recognizing gestures based on a greedy heuristic algorithm uses a greedy heuristic algorithm for point set matching. It has relatively low complexity and can be run under low computing resources. It does not require significant computing resources and a large amount of memory.
[0091] 3. The method for quickly recognizing gestures based on a greedy heuristic algorithm can speed up the development and iteration of a gesture recognition system and reduce the development cycle due to the simplicity and ease of implementation of the algorithm.
[0092] 4. Compared with the black box characteristics of deep learning models, the method of the present invention adopts a greedy heuristic algorithm to quickly recognize gestures. The decision-making process is more transparent and easy to understand, debug and optimize.
[0093] 5. This method of quickly recognizing gestures based on a greedy heuristic algorithm quickly matches by accumulating Euclidean distance, which helps to achieve high-speed gesture recognition and meet the needs of real-time interaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0095] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0096] See also Figure 1 , a method for quickly recognizing gestures based on a greedy heuristic algorithm, comprising the following steps:
[0097] 1. Preprocessing
[0098] (1) Resample the given point set to adjust the number of points to the specified 32 points while trying to maintain the characteristics of the original shape. The following is the specific process:
[0099] 1. Calculate the total path length: First, we calculate the total length L of the point set path, and calculate the cumulative sum of the Euclidean distances between consecutive points:
[0100]
[0101] where d(pi,pi+1) is the Euclidean distance between point pi and point pi+1, and N is the number of points in the original point set.
[0102] 2. Calculate the interval length: Next, calculate the equal interval length I, which is the total path length divided by the number of points after resampling minus one (because the starting point of the path is already included):
[0103]
[0104] Where n is the number of points after resampling.
[0105] 3. Point interpolation: Traverse each pair of consecutive points. If the cumulative distance D+d between two points is greater than or equal to the interval length I, insert a new point q between the two points. The coordinates of the new point (qx, qy) are obtained by linear interpolation between the two points. The mathematical formula is:
[0106]
[0107] Where D is the cumulative distance from the last resampled point to the current point pi-1, and d is the distance between point pi-1 and point pi.
[0108] 4. Update the cumulative distance: If a new point is inserted, the cumulative distance D is reset to 0; otherwise, D is updated to D+d.
[0109] 5. Handle boundary cases: Finally, if the last point was not added due to rounding error, add the last point of the original point set to the resampled point set.
[0110] (2) Normalize the sampled point set so that all points are uniformly scaled to a predetermined range, usually a unit square. This eliminates differences in gesture size, allowing the recognition algorithm to focus on the shape of the gesture rather than its size:
[0111] 1. Calculate the bounding box: First, we need to find the minimum bounding box that contains all the points. This is done by calculating the minimum and maximum X and Y coordinates of all the points in the point set:
[0112]
[0113] Where i traverses all points.
[0114] 2. Determine the scaled size: Next, we determine the scaled size, which is the maximum of the width and height of the bounding box:
[0115] size=max(maxX-minX,maxY-minY)
[0116] 3. Scale the points: Then, for each point pi in the point set, we calculate its new coordinates (qx,qy) within the normalized square. This is done by subtracting the minimum coordinate and dividing by the scale size:
[0117]
[0118] 4. Construct a new point set: Finally, we use the newly calculated coordinates (qx, qy) to construct a new point set, where each point has the same stroke ID.
[0119] Through the above steps, the points in the sampled point set are converted into normalized coordinates so that all gestures are scaled to the same size range.
[0120] (3) Translate the scaled point set to the origin of the coordinate system. This eliminates the differences in gesture positions, allowing the recognition algorithm to focus on the shape of the gesture rather than its position:
[0121] 1. Calculate the centroid: First, we need to calculate the centroid (center point) of the point set. This is done by averaging the X and Y coordinates of all points:
[0122]
[0123] Where N is the total number of points in the point set.
[0124] 2. Calculate new coordinates: Next, for each point pi in the point set, we calculate its new coordinates (qx, qy) relative to the center of mass translated to the origin (0,0):
[0125]
[0126] Constructing a new point set: Finally, we use the newly calculated coordinates (qx, qy) to construct a new point set, where each point has the same stroke ID.
[0127] 2. Gesture Matching
[0128] Define the candidate point set: Let C be the input point set, given by the parameter points.
[0129] Initialize the best matching variables: set the index u of the best matching template to -1 and the best matching score b to positive infinity.
[0130] Traverse the template point set set: For each point set Pi in the point set template set, where i = 0, 1, ..., n-1, and n is the number of all template point sets, perform the following steps:
[0131] a. Calculate the matching distance di between the candidate point set C and the template point set Pi:
[0132] di=Match(C.Points,P.Points)
[0133] b. If di is less than the current best matching score b, update b to di, and update the index u of the best matching template to the index i of the current template.
[0134] Return result: If no matching template is found (i.e. u = -1), a no-match result is returned; otherwise, the name of the best matching template and the matching score are returned. The matching score is calculated based on the value of b, as follows:
[0135]
[0136] Construct result: Construct a result object. If u=-1, it means there is no match. Otherwise, it contains the name and score of the best matching template:
[0137]
[0138] Among them, C is the candidate point set, Pu is the best matching point set template, u is the index of the best matching template, b is the minimum matching distance, and score is the matching score calculated based on b.
[0139] Match is calculated as follows:
[0140] (7) Define greedy matching parameters: Let e be a parameter between 0 and 1, which is used to determine the step length. Step is a power function based on the length of the point set, calculated as follows:
[0141]
[0142] (8) Initialize the minimum distance: Set the minimum distance min to positive infinity initially.
[0143] (9) Traversing the point set: Starting from index i=0, traverse the point set points with a step length of step, and perform the following steps: a. Calculate the distance d1 between the point set points starting from point points[i] and the point set P.Points:
[0144] d1=PointsDistance(points, P.Points, i)
[0145] b. Calculate the distance d2 between the point set P.Points starting from point P.Points[i] and the point set points:
[0146] d2=PointsDistance(P.Points, points, i)
[0147] c. Update the minimum distance min to the smaller value of d1 and d2.
[0148] (4) Return the minimum distance: the last calculated minimum distance min.
[0149] in, Is a minimum operator, PointsDistance calculates the minimum weighted distance sum between two point sets, which is a greedy algorithm because it selects the currently available minimum distance at each step. This process is very efficient because it reduces the amount of calculation while maintaining robustness to shape changes.
[0150] The PointsDistance calculation process is as follows:
[0151] (3) Initialize the matching array: Create a Boolean array matched whose length is equal to the length of pts1 and all elements are initialized to false.
[0152] Calculate the weighted distance sum: Initialize the sum to 0. Then, iterate from the starting point start until you return to start:
[0153]
[0154] Where wi is the weight, defined as:
[0155]
[0156] And UnmatchedUnmatched is the set of all points in pts2 that have not been matched.
[0157] Returns the weighted distance sum: When the iteration returns to the starting point start, returns the sum sum.
[0158] The Distance function calculates the Euclidean distance between two points:
[0159]
[0160] In summary, the advantages of the present invention include reducing data requirements, reducing computing resource consumption, shortening development cycles, improving model transparency, and enhancing real-time performance. These advantages make the gesture recognition method of the present invention more efficient and feasible in practical applications.
[0161] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for quickly recognizing gestures based on a greedy heuristic algorithm, characterized in that: The following steps are involved: Step 1: Collect the point set of the user's gesture trajectory; Step 2: Resample the given point set; Step 3: Normalize the sampled point set so that all points are uniformly scaled to a predetermined range; Step 4: Translate the scaled point set to the origin of the coordinate system; Step 5: Use the greedy algorithm for gesture matching and select the best match by calculating the matching distance between the candidate point set and the template point set.
2. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 1, characterized in that: The second step includes the following: Compute the total path length of consecutive points: Where d(pi,pi+1) is the Euclidean distance between point pi and point pi+1, and N is the number of points in the original point set; Calculate the interval length I: Where n is the number of points after resampling; Traverse each pair of consecutive points. If the cumulative distance D+d between the two points is greater than or equal to the interval length I, insert a new point q between the two points. The coordinates of the new point (qx, qy) are obtained by linear interpolation between the two points. The formula is: Where D is the cumulative distance from the last resampled point to the current point pi-1, and d is the distance between point pi-1 and point pi; If a new point is inserted, the cumulative distance D is reset to 0, otherwise, D is updated to D+d; If the last point is not added due to rounding error, add the last point of the original point set to the resampled point set.
3. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 1, characterized in that: The third step includes the following: Find the minimum bounding box that contains all the points, by calculating the minimum and maximum X and Y coordinates of all the points in the point set: Where i traverses all points; Determine the scaling size: size=max(maxX-minX,maxY-minY) For each point pi in the point set, calculate its new coordinates (qx, qy) within the normalized square; Construct a new point set where each point has the same stroke ID.
4. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 1, characterized in that: The fourth step includes the following contents: Calculate the centroid: Where N is the total number of points in the point set; Calculate new coordinates; Construct a new point set.
5. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 1, characterized in that: The fifth step includes the following contents: S1: Initialize the best matching variables: set the index u of the best matching template to -1 and the best matching score b to positive infinity; S2: traverse the template point set set: for each point set Pi in the point set template set, where i = 0, 1, ..., n-1, and n is the number of all template point sets; S3: Calculate the matching distance di between the candidate point set C and the template point set Pi: d = Match(C.Points,P.Points) S4: If di is less than the current best matching score b, update b to di, and update the index u of the best matching template to the index i of the current template; If no matching template is found (i.e. u = -1), a no-match result is returned. Otherwise, the name of the best matching template and the matching score are returned. The matching score is calculated based on the value of b. Construct result: Construct a result object. If u=-1, it means there is no match. Otherwise, it contains the name and score of the best matching template: Among them, C is the candidate point set, Pu is the best matching point set template, u is the index of the best matching template, b is the minimum matching distance, and score is the matching score calculated based on b.
6. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 5, characterized in that: Match is calculated as follows: (1) Define greedy matching parameters: Let e be a parameter between 0 and 1, which is used to determine the step length. Step is a power function based on the length of the point set, calculated as follows: (2) Initialize the minimum distance: Set the minimum distance min to positive infinity initially; (3) Traversing the point set: Starting from index i=0, traverse the point set points with a step length of step and perform the following steps: a. Calculate the distance d1 between the point set points starting from point points[i] and the point set P.Points: d1=PointsDistance(points, P.Points, i) b. Calculate the distance d2 between the point set P.Points starting from point P.Points[i] and the point set points: d2=PointsDistance(P.Points, points, i) c. Update the minimum distance min to the smaller value of d1 and d2; (4) Return the minimum distance: the last calculated minimum distance min; in, PointsDistance is a minimum operator, which calculates the minimum weighted distance sum between two point sets.
7. The method for quickly recognizing gestures based on a greedy heuristic algorithm according to claim 6, characterized in that: The PointsDistance calculation process is as follows: (1) Initialize the matching array: create a Boolean array matched, whose length is equal to the length of pts1, and all elements are initialized to false; Calculate the weighted distance sum: Initialize the sum to 0. Then, iterate from the starting point start until you return to start: Where wi is the weight, defined as: And UnmatchedUnmatched is the set of all points in pts2 that have not been matched; Return the sum of weighted distances: When the iteration returns to the starting point start, the sum is returned; The Distance function calculates the Euclidean distance between two points:
Citation Information
Patent Citations
A customer path tracking method and system
CN109544595A
Hash learning method based on an evolutionary tree and an unsupervised online Hash learning method thereof
CN109829549A
Railway dispatcher bad state identification method based on eye features
CN114170588A
Randomly stacked workpiece positioning method based on point cloud pose estimation
CN115512137A
Handwriting optimization display method based on searching of better control point
CN115686239A
