A dynamic gesture recognition method and device based on attention mechanism
Through the dynamic gesture recognition method based on the attention mechanism, the video frame sequence and the Euclidean distance matrix are used to extract spatial and temporal features, which solves the problem of poor accuracy and real-time performance of dynamic gesture recognition in the existing technology, and realizes the low-cost hardware Efficient recognition effect.
Patent Information
- Application Number
- CN202411088959.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-08-09
AI Technical Summary
It is difficult for the existing technology to achieve high accuracy and efficiency of dynamic gesture recognition under low-cost hardware conditions, and the cost is high and the real-time performance is poor.
Using a dynamic gesture recognition method based on the attention mechanism, a video frame sequence of hand key points is obtained through a video collection device, the Euclidean distance matrix is calculated, and a lightweight convolutional neural network and a two-way long short-term memory network are used to extract spatial and temporal features, combined with The attention mechanism enhances feature attention.
It improves the accuracy and real-time performance of dynamic gesture recognition, reduces hardware costs, avoids the risk of over-fitting, and enhances the generalization ability of the gesture recognition model.
Smart Images

Figure CN118629095B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of gesture recognition, and in particular to a method and device for dynamic gesture recognition based on an attention mechanism. Background Art
[0002] With the development of related industries that require human-computer interaction, such as autonomous driving and consumer electronics, users have increasingly higher requirements for operational convenience and speed, and gesture recognition technology has effectively met user needs.
[0003] The existing public technology uses information such as overlap rate, distance or joint information entropy as the basis for dynamic gesture recognition, which can simply identify gesture features with small movement amplitudes. However, since the temporal and spatial variation characteristics of the gesture itself are not considered, the recognition accuracy is not high. In order to improve the accuracy of gesture recognition, the existing technology uses three-dimensional convolution and GRU (Gated Recurrent Unit) networks to perform dynamic gesture recognition, but this method has high technical costs, long calculation time, and is not conducive to implementation in low-end hardware facilities.
[0004] Therefore, in the face of the challenge of recognizing multiple complex gestures of users, how to ensure the accuracy of dynamic gesture recognition while ensuring recognition efficiency under low hardware cost conditions has become a technical problem that needs to be solved at present. Summary of the invention
[0005] The present application provides a dynamic gesture recognition method and device based on an attention mechanism to solve the technical problems of low accuracy, high cost and poor real-time performance of dynamic gesture recognition.
[0006] In order to solve the above technical problems, in a first aspect, an embodiment of the present application provides a dynamic gesture recognition method based on an attention mechanism, comprising:
[0007] By means of a video acquisition device, a preset number of first video frames containing key points of the hand are acquired in time sequence to obtain a first video frame sequence;
[0008] Traversing the first video frame sequence, calculating the Euclidean distance between each of the hand key points in each of the first video frames, and obtaining a two-dimensional distance matrix;
[0009] The two-dimensional distance matrix is input into a preset gesture recognition model to obtain a gesture recognition result; the gesture recognition model is constructed by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module.
[0010] Compared with the prior art, the embodiment of the present application has the following beneficial effects: by generating a video frame sequence consisting of video frames containing hand key points in chronological order, retaining the time information features in the dynamic gesture change process, and then extracting a two-dimensional distance matrix containing the hand spatial information features based on the Euclidean distance between the hand key points. At this time, the two-dimensional distance matrix contains the feature information of the dynamic gesture changes in time and space. Next, the spatial information features in the two-dimensional distance matrix are extracted through a lightweight convolutional neural network, and further through the attention mechanism, the feature data of the part that needs to be focused on in the spatial information features are strengthened. Since the bidirectional long short-term memory network can process sequence data and maintain long-term memory, and the two-dimensional distance matrix is obtained according to the video frame sequence sorted in chronological order, the strengthened spatial information features are input into the bidirectional long short-term memory network, and the spatiotemporal feature information containing time information can be extracted from the spatial information features, thereby improving the accuracy of subsequent dynamic gesture recognition.
[0011] In some embodiments of the first aspect of the present application, inputting the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result includes:
[0012] Performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information;
[0013] By using the attention mechanism module, the first feature information is enhanced to obtain the second feature information;
[0014] Extracting features from the second feature information using a bidirectional long short-term memory network model to obtain third feature information;
[0015] Through a fully connected layer, the third feature information is mapped to the gesture recognition result.
[0016] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by performing feature extraction through a lightweight convolutional neural network, the efficiency of the spatial information feature extraction process can be improved, so that the hand recognition model can be built on lightweight hardware facilities, thereby improving the real-time performance of dynamic gesture recognition; through the attention mechanism module, the attention of important features is enhanced, and the enhanced features are input into the bidirectional long short-term memory network model in the order in which the corresponding video frames are acquired, and the feature information of the dynamic gesture in the time dimension is extracted, thereby obtaining feature information containing time and space dimension information, thereby improving the accuracy of subsequent gesture recognition results.
[0017] In some embodiments of the first aspect of the present application, extracting features from the two-dimensional distance matrix using the lightweight convolutional neural network to obtain first feature information includes:
[0018] The lightweight convolutional neural network includes: a plurality of convolution kernels of different scales;
[0019] By using convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted;
[0020] All the spatial information features are integrated to obtain the first feature information.
[0021] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by using convolution kernels of different scales, feature information of details at different levels is captured, and feature fusion of feature information at different levels is performed to obtain more generalized features, thereby reducing the risk of overfitting in subsequent dynamic gesture recognition results.
[0022] In some embodiments of the first aspect of the present application, traversing the first video frame sequence, calculating the Euclidean distance between each of the hand key points in each of the first video frames, and obtaining a two-dimensional distance matrix includes:
[0023] sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points;
[0024] Calculating a first Euclidean distance between any two of the hand key points in each of the first video frames, and a second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames;
[0025] The two-dimensional distance matrix is obtained according to all the first Euclidean distances and all the second Euclidean distances corresponding to each first video frame.
[0026] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by calculating the Euclidean distance between the key points of the hand, the spatial information characteristics of the gesture can be clearly represented, which is conducive to the subsequent convolutional neural network to extract effective spatial information feature vectors of dynamic gestures therefrom, and the generated two-dimensional distance matrix is obtained by traversing the first video frame sequence obtained in time order and calculating the Euclidean distance, so the two-dimensional distance matrix actually also contains the characteristics of the dynamic gesture in the time dimension, thereby improving the efficiency of subsequent data processing.
[0027] In some embodiments of the first aspect of the present application, the step of acquiring a preset number of first video frames containing hand key points in chronological order by a video acquisition device to obtain a first video frame sequence includes:
[0028] sequentially determining whether the video frames currently captured by the video capture device contain the hand key points until the length of the first video frame sequence meets a first preset threshold;
[0029] If so, determining that the currently captured video frame is the first video frame, and adding the first video frame to the first video frame sequence;
[0030] If it does not exist and the first video frame sequence is not empty, delete the first video frame that was added earliest in the first video frame sequence.
[0031] Compared with the prior art, the embodiments of the present application have the following beneficial effects: by generating a first video frame sequence in the order in which the video device captures video frames, the temporal information characteristics of dynamic gestures can be effectively retained; at the same time, if the current video frame does not have a hand key point, by deleting the earliest added video frame in the current first video frame sequence, a large number of connected video frames with a large time span in the same first video frame sequence can be avoided, which can effectively ensure the continuity of dynamic gesture changes in time and space, and improve the accuracy of dynamic gesture recognition.
[0032] In a second aspect, an embodiment of the present application further provides a dynamic gesture recognition device based on an attention mechanism, comprising: a first video frame sequence acquisition module, a two-dimensional distance matrix acquisition module, and a gesture recognition result acquisition module;
[0033] The first video frame sequence acquisition module is used to acquire a preset number of first video frames containing hand key points in time sequence through a video acquisition device to acquire a first video frame sequence;
[0034] The two-dimensional distance matrix acquisition module is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and acquire a two-dimensional distance matrix;
[0035] The gesture recognition result acquisition module is used to input the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result; the gesture recognition model is built by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module.
[0036] In some embodiments of the second aspect of the present application, the gesture recognition result acquisition module is used to input the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result, including:
[0037] Performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information;
[0038] By using the attention mechanism module, the first feature information is enhanced to obtain the second feature information;
[0039] Extracting features from the second feature information using a bidirectional long short-term memory network model to obtain third feature information;
[0040] Through a fully connected layer, the third feature information is mapped to the gesture recognition result.
[0041] In some embodiments of the second aspect of the present application, the step of performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information includes:
[0042] The lightweight convolutional neural network includes: a plurality of convolution kernels of different scales;
[0043] By using convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted;
[0044] All the spatial information features are integrated to obtain the first feature information.
[0045] In some embodiments of the second aspect of the present application, the two-dimensional distance matrix acquisition module is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and acquire the two-dimensional distance matrix, including:
[0046] sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points;
[0047] Calculating a first Euclidean distance between any two of the hand key points in each of the first video frames, and a second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames;
[0048] The two-dimensional distance matrix is obtained according to all the first Euclidean distances and all the second Euclidean distances corresponding to each first video frame.
[0049] In some embodiments of the second aspect of the present application, the first video frame sequence acquisition module is used to acquire a preset number of first video frames containing hand key points in chronological order through a video acquisition device to acquire a first video frame sequence, including:
[0050] sequentially determining whether the video frames currently captured by the video capture device contain the hand key points until the length of the first video frame sequence meets a first preset threshold;
[0051] If so, determining that the currently captured video frame is the first video frame, and adding the first video frame to the first video frame sequence;
[0052] If it does not exist and the first video frame sequence is not empty, delete the first video frame that was added earliest in the first video frame sequence. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flowchart of a dynamic gesture recognition method based on an attention mechanism provided in some embodiments of the present application;
[0054] Figure 2 A schematic flow chart of a method for acquiring a first video sequence provided in some embodiments of the present application;
[0055] Figure 3 A schematic diagram of a data processing flow of a gesture recognition model provided in some embodiments of the present application;
[0056] Figure 4 This is a schematic diagram of the structure of a dynamic gesture recognition device based on an attention mechanism provided in some embodiments of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] Embodiment 1
[0059] Please refer to Figure 1 , a dynamic gesture recognition method based on an attention mechanism provided in an embodiment of the present application, including S10 to S30, specifically:
[0060] S10: Using a video acquisition device, a preset number of first video frames containing hand key points are acquired in chronological order to obtain a first video frame sequence.
[0061] In some embodiments of the present application, the step of acquiring a preset number of first video frames containing hand key points in chronological order through a video acquisition device to obtain a first video frame sequence includes:
[0062] sequentially determining whether the video frames currently captured by the video capture device contain the hand key points until the length of the first video frame sequence meets a first preset threshold;
[0063] If so, determining that the currently captured video frame is the first video frame, and adding the first video frame to the first video frame sequence;
[0064] If it does not exist and the first video frame sequence is not empty, delete the first video frame that was added earliest in the first video frame sequence.
[0065] By generating a first video frame sequence in the order in which the video device captures video frames, the time information characteristics of dynamic gestures can be effectively retained. At the same time, if the current video frame does not have a hand key point, by deleting the earliest added video frame in the current first video frame sequence, a large number of connected video frames with a large time span in the same first video frame sequence can be avoided, which can effectively ensure the continuity of dynamic gesture changes in time and space, and improve the accuracy of dynamic gesture recognition.
[0066] Preferably, reference Figure 2 In some embodiments of the present application, step S10 may be performed by the following preferred embodiments:
[0067] S11: Turn on any type of camera device, and continuously collect real-time video frames in chronological order; the video frames may be continuous video frames extracted from the video captured by the camera device, or may be continuous images captured quickly by the camera device at a preset time interval, such as for a 30-frame video, continuous images are acquired by performing image capture operations 30 times per second. This application does not impose any restrictions on the acquisition of video frames, but requires that the video frames maintain continuity;
[0068] S12: Process the video frame obtained in S11 through the key point extraction module, and determine whether there are hand key points in the current video frame; the hand key points include: fingertips, knuckles, wrists, etc.;
[0069] S13: If it exists, add the current video frame to the first video frame sequence; otherwise, delete the old frame from the first video frame sequence (if the current video frame obtained in S11 is the first video frame, no processing is required for the video frame, and jump to S12), until the video frames of the first video sequence reach 50 frames. This application does not impose a specific limit on the number of frames. The number of frames in the first video sequence can be reduced or increased according to the actual gesture recognition requirements;
[0070] S14: Determine whether the number of key point frames meets the preset requirement; if so, input the first video frame sequence into the gesture recognition model, clear the first video frame sequence, and obtain the final gesture recognition result; otherwise, jump to S12.
[0071] Preferably, the definition of the old frame in the above step S13 can be: in the process of reading video frames in chronological order, the video frame currently being detected is the new frame, and the video frame in which the hand key point is detected before the new frame is the old frame.
[0072] Further, based on the above definition of old frames, when the operation of deleting old frames in step S13 is executed, only the earliest acquired old frames may be deleted.
[0073] S20: traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and obtain a two-dimensional distance matrix.
[0074] In some embodiments of the present application, traversing the first video frame sequence, calculating the Euclidean distance between each of the hand key points in each of the first video frames, and obtaining a two-dimensional distance matrix includes:
[0075] sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points;
[0076] Calculating a first Euclidean distance between any two of the hand key points in each of the first video frames, and a second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames;
[0077] The two-dimensional distance matrix is obtained according to all the first Euclidean distances and all the second Euclidean distances corresponding to each first video frame.
[0078] By calculating the Euclidean distance between the key points of the hand, the spatial information characteristics of the gesture can be clearly represented, which is conducive to the subsequent convolutional neural network to extract effective spatial information feature vectors of dynamic gestures. The generated two-dimensional distance matrix is obtained by traversing the first video frame sequence obtained in time order and calculating the Euclidean distance. Therefore, the two-dimensional distance matrix actually also contains the characteristics of dynamic gestures in the time dimension, thereby improving the efficiency of subsequent data processing.
[0079] Preferably, step S20 can be performed by the following preferred embodiments, specifically:
[0080] Arrange the coordinates of the hand key points of each video frame in the first video sequence in spatial order, calculate the Euclidean distance between any two hand key point coordinates in each video frame, and the Euclidean distance between all hand key points and the origin, and you can get a first two-dimensional distance matrix containing all key point pairs; the spatial order can be the pre-determined order of each hand key point, so as to avoid the Euclidean distance data corresponding to different hand key points in each row of elements when the flattened one-dimensional matrix of the first two-dimensional distance matrix is subsequently spliced. In order to avoid duplication of information, this application uses the upper triangular elements in the first two-dimensional distance matrix to construct feature vectors.
[0081] The Euclidean distance calculation formula between any two points is:
[0082]
[0083]
[0084] In the formula, Representative Hand key points in video frames and distance; For the Hand key points in video frames Between the origin The Euclidean distance.
[0085] Further, the Euclidean distance obtained according to the above Euclidean distance calculation formula is generated The first two-dimensional distance matrix corresponding to the video frame:
[0086]
[0087] in, For the The first two-dimensional distance matrix corresponding to the video frame, in order to avoid information duplication, Only the upper triangular elements are retained to construct the subsequent second 2D distance matrix.
[0088] Finally, the first two-dimensional distance matrix corresponding to each of the above video frames is flattened into a one-dimensional vector, and then the corresponding one-dimensional vectors are spliced in sequence according to the order in which the video frames are obtained to obtain a second two-dimensional distance matrix.
[0089] S30: Inputting the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result; the gesture recognition model is constructed by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module.
[0090] In some embodiments of the present application, the step of inputting the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result includes:
[0091] Performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information;
[0092] By using the attention mechanism module, the first feature information is enhanced to obtain the second feature information;
[0093] Extracting features from the second feature information using a bidirectional long short-term memory network model to obtain third feature information;
[0094] Through a fully connected layer, the third feature information is mapped to the gesture recognition result.
[0095] By extracting features through lightweight convolutional neural networks, the efficiency of the spatial information feature extraction process can be improved, so that the hand recognition model can be built on lightweight hardware facilities, improving the real-time performance of dynamic gesture recognition; through the attention mechanism module, the attention of important features is enhanced, and the enhanced features are input into the bidirectional long short-term memory network model in the order of corresponding video frame acquisition, and the feature information of dynamic gestures in the time dimension is extracted, thereby obtaining feature information containing time and space dimension information, which improves the accuracy of subsequent gesture recognition results.
[0096] In some embodiments of the present application, the step of extracting features from the two-dimensional distance matrix using the lightweight convolutional neural network to obtain first feature information includes:
[0097] The lightweight convolutional neural network includes: a plurality of convolution kernels of different scales;
[0098] By using convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted;
[0099] All the spatial information features are integrated to obtain the first feature information.
[0100] Through convolution kernels of different scales, feature information of different levels of details is captured, and feature fusion of feature information at different levels is performed to obtain more generalized features, reducing the risk of overfitting in subsequent dynamic gesture recognition results.
[0101] Preferably, reference Figure 3 , step S30 can be performed by the following preferred implementation, specifically:
[0102] S31: Input the two-dimensional distance matrix obtained in S20 into a lightweight multi-scale convolution module, specifically, input it into a 1*1 convolution kernel, a 3*1 convolution kernel, and a 5*1 convolution kernel, respectively, to extract spatial information features at different levels; any lightweight convolution method may be used here, and this application does not limit this technical feature;
[0103] S32: Through the Concat feature fusion operation, the spatial information features of different levels extracted by S31 are spliced on the channel to obtain the first feature information;
[0104] S33: For the first feature information obtained in S32, the CBAM (Convolutional Block Attention Module) attention mechanism is used to process the feature weight, enhance the attention to important features, and obtain the second feature information after feature enhancement;
[0105] S34: input the second feature information obtained in S33 into the Bi-directional Recurrent Neural Network (BiLSTM) model in sequence according to the acquisition time sequence of the video frames corresponding to the first two-dimensional distance matrix in the preferred embodiment of S20, and extract the third feature information including spatial and temporal changes;
[0106] S35: Mapping the third feature information obtained in S34 to the final gesture recognition result through multiple fully connected modules.
[0107] In summary, a dynamic gesture recognition method based on an attention mechanism provided by an embodiment of the present application has the following beneficial effects: by generating a video frame sequence consisting of video frames containing hand key points in chronological order, retaining the time information features in the dynamic gesture change process, and then extracting a two-dimensional distance matrix containing the hand spatial information features based on the Euclidean distance between the hand key points. At this time, the two-dimensional distance matrix contains the feature information of the dynamic gesture changes in time and space. Next, the spatial information features in the two-dimensional distance matrix are extracted through a lightweight convolutional neural network, and the feature data of the part that needs to be focused on in the spatial information features are further strengthened through the attention mechanism. Since the bidirectional long short-term memory network can process sequence data and maintain long-term memory, and the two-dimensional distance matrix is obtained according to the video frame sequence sorted in chronological order, the strengthened spatial information features are input into the bidirectional long short-term memory network, and the spatiotemporal feature information containing the time information can be extracted from the spatial information features, thereby improving the accuracy of subsequent dynamic gesture recognition.
[0108] Embodiment 2
[0109] refer to Figure 4 , a dynamic gesture recognition device based on an attention mechanism is provided in an embodiment of the present application, comprising: a first video frame sequence acquisition module 11, a two-dimensional distance matrix acquisition module 12 and a gesture recognition result acquisition module 13.
[0110] In some embodiments of the present application, the first video frame sequence acquisition module 11 is used to acquire a preset number of first video frames containing hand key points in chronological order through a video acquisition device to acquire a first video frame sequence; the two-dimensional distance matrix acquisition module 12 is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and acquire a two-dimensional distance matrix; the gesture recognition result acquisition module 13 is used to input the two-dimensional distance matrix into a preset gesture recognition model to acquire a gesture recognition result; the gesture recognition model is constructed by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module.
[0111] In some embodiments of the present application, the gesture recognition result acquisition module 13 is used to input the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result, including: performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information; performing feature enhancement on the first feature information through the attention mechanism module to obtain second feature information; performing feature extraction on the second feature information through a bidirectional long short-term memory network model to obtain third feature information; and mapping the third feature information to the gesture recognition result through a fully connected layer.
[0112] In some embodiments of the present application, the lightweight convolutional neural network is used to perform feature extraction on the two-dimensional distance matrix to obtain first feature information, including: the lightweight convolutional neural network includes: a number of convolution kernels of different scales; through convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted; all the spatial information features are integrated to obtain the first feature information.
[0113] In some embodiments of the present application, the two-dimensional distance matrix acquisition module 12 is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and obtain the two-dimensional distance matrix, including: sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points; calculating the first Euclidean distance between any two of the hand key points in each of the first video frames, and the second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames; and obtaining the two-dimensional distance matrix according to all of the first Euclidean distances and all of the second Euclidean distances corresponding to each of the first video frames.
[0114] In some embodiments of the present application, the first video frame sequence acquisition module 11 is used to acquire a preset number of first video frames containing hand key points in chronological order through a video acquisition device to acquire a first video frame sequence, including: determining in sequence whether the video frames currently acquired by the video acquisition device contain the hand key points until the length of the first video frame sequence meets a first preset threshold; if so, determining that the currently acquired video frame is the first video frame, and adding the first video frame to the first video frame sequence; if not and the first video frame sequence is not empty, deleting the first video frame added earliest in the first video frame sequence.
[0115] In summary, a dynamic gesture recognition device based on an attention mechanism provided by an embodiment of the present application has the following beneficial effects: by generating a video frame sequence consisting of video frames containing hand key points in chronological order, retaining the time information features in the dynamic gesture change process, and then extracting a two-dimensional distance matrix containing the hand spatial information features based on the Euclidean distance between the hand key points. At this time, the two-dimensional distance matrix contains the feature information of the dynamic gesture changes in time and space. Next, the spatial information features in the two-dimensional distance matrix are extracted through a lightweight convolutional neural network, and further through the attention mechanism, the feature data of the part of the spatial information features that needs to be focused on are strengthened. Since the bidirectional long short-term memory network can process sequence data and maintain long-term memory, and the two-dimensional distance matrix is obtained according to the video frame sequence sorted in chronological order, the strengthened spatial information features are input into the bidirectional long short-term memory network, and the spatiotemporal feature information containing the time information can be extracted from the spatial information features, thereby improving the accuracy of subsequent dynamic gesture recognition.
[0116] Embodiment 3
[0117] Based on the above-mentioned embodiment of the dynamic gesture recognition method based on the attention mechanism, another embodiment of the present application provides a dynamic gesture recognition terminal device based on the attention mechanism. The dynamic gesture recognition terminal device based on the attention mechanism includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the dynamic gesture recognition method based on the attention mechanism of any embodiment of the present application is implemented.
[0118] Exemplarily, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the attention-based dynamic gesture recognition device.
[0119] The dynamic gesture recognition device based on the attention mechanism can be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The dynamic gesture recognition terminal device based on the attention mechanism can include, but is not limited to, a processor and a memory.
[0120] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the dynamic gesture recognition device based on the attention mechanism, and uses various interfaces and lines to connect the various parts of the dynamic gesture recognition device based on the attention mechanism. The memory may be used to store the computer program and / or module, and the processor implements various functions of the dynamic gesture recognition device based on the attention mechanism by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0121] Embodiment 4
[0122] Based on the above-mentioned embodiment of the dynamic gesture recognition method based on the attention mechanism, another embodiment of the present application provides a storage medium, wherein the storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the dynamic gesture recognition method based on the attention mechanism of any embodiment of the present application.
[0123] In this embodiment, the storage medium is a computer-readable storage medium, and the computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0124] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of protection of the present application.
Claims
1. A dynamic gesture recognition method based on attention mechanism, characterized in that: include: By means of a video acquisition device, a preset number of first video frames containing key points of the hand are acquired in time sequence to obtain a first video frame sequence; Traversing the first video frame sequence, calculating the Euclidean distance between each of the hand key points in each of the first video frames, and obtaining a two-dimensional distance matrix; The two-dimensional distance matrix is input into a preset gesture recognition model to obtain a gesture recognition result; the gesture recognition model is constructed by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module; The step of inputting the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result includes: Performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information; By using the attention mechanism module, the first feature information is enhanced to obtain the second feature information; Extracting features from the second feature information using a bidirectional long short-term memory network model to obtain third feature information; Mapping the third feature information to the gesture recognition result through a fully connected layer; The step of extracting features from the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information includes: The lightweight convolutional neural network includes: a plurality of convolution kernels of different scales; By using convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted; Fusing all the spatial information features to obtain the first feature information; The traversing the first video frame sequence, calculating the Euclidean distance between each of the hand key points in each of the first video frames, and obtaining a two-dimensional distance matrix includes: sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points; Calculating a first Euclidean distance between any two of the hand key points in each of the first video frames, and a second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames; Acquire a first two-dimensional distance matrix corresponding to each first video frame according to all the first Euclidean distances and all the second Euclidean distances corresponding to each first video frame; After all the first two-dimensional distance matrices are flattened, the first two-dimensional distance matrices are spliced in the time sequence of obtaining the first video frame to obtain the two-dimensional distance matrix.
2. A dynamic gesture recognition method based on attention mechanism as claimed in claim 1, characterized in that: The method of acquiring a preset number of first video frames containing hand key points in time sequence by using a video acquisition device to obtain a first video frame sequence includes: sequentially determining whether the video frames currently captured by the video capture device contain the hand key points until the length of the first video frame sequence meets a first preset threshold; If so, determining that the currently captured video frame is the first video frame, and adding the first video frame to the first video frame sequence; If it does not exist and the first video frame sequence is not empty, delete the first video frame that was added earliest in the first video frame sequence.
3. A dynamic gesture recognition device based on attention mechanism, characterized in that: include: A first video frame sequence acquisition module, a two-dimensional distance matrix acquisition module, and a gesture recognition result acquisition module; The first video frame sequence acquisition module is used to acquire a preset number of first video frames containing hand key points in time sequence through a video acquisition device to acquire a first video frame sequence; The two-dimensional distance matrix acquisition module is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and acquire a two-dimensional distance matrix; The gesture recognition result acquisition module is used to input the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result; the gesture recognition model is constructed by connecting a lightweight convolutional neural network and a bidirectional long short-term memory network through an attention mechanism module; The gesture recognition result acquisition module is used to input the two-dimensional distance matrix into a preset gesture recognition model to obtain a gesture recognition result, including: Performing feature extraction on the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information; By using the attention mechanism module, the first feature information is enhanced to obtain the second feature information; Extracting features from the second feature information using a bidirectional long short-term memory network model to obtain third feature information; Mapping the third feature information to the gesture recognition result through a fully connected layer; The step of extracting features from the two-dimensional distance matrix through the lightweight convolutional neural network to obtain first feature information includes: The lightweight convolutional neural network includes: a plurality of convolution kernels of different scales; By using convolution kernels of different scales, the spatial information features of the two-dimensional distance matrix under convolution operations of different scales are extracted; Fusing all the spatial information features to obtain the first feature information; The two-dimensional distance matrix acquisition module is used to traverse the first video frame sequence, calculate the Euclidean distance between each of the hand key points in each of the first video frames, and acquire a two-dimensional distance matrix, including: sorting all the hand key points in each of the first video frames according to the spatial order of the hand key points; Calculating a first Euclidean distance between any two of the hand key points in each of the first video frames, and a second Euclidean distance between each of the hand key points and a preset origin in each of the first video frames; Acquire a first two-dimensional distance matrix corresponding to each first video frame according to all the first Euclidean distances and all the second Euclidean distances corresponding to each first video frame; After all the first two-dimensional distance matrices are flattened, the first two-dimensional distance matrices are spliced in the time sequence of obtaining the first video frame to obtain the two-dimensional distance matrix.
4. A dynamic gesture recognition device based on attention mechanism as claimed in claim 3, characterized in that: The first video frame sequence acquisition module is used to acquire a preset number of first video frames containing hand key points in chronological order through a video acquisition device to acquire a first video frame sequence, including: sequentially determining whether the video frames currently captured by the video capture device contain the hand key points until the length of the first video frame sequence meets a first preset threshold; If so, determining that the currently captured video frame is the first video frame, and adding the first video frame to the first video frame sequence; If it does not exist and the first video frame sequence is not empty, delete the first video frame that was added earliest in the first video frame sequence.
