Gesture recognition method and gesture recognition model training method
By dividing the image sequence into target and non-target sequences, extracting only the spatial features of the target sequence and integrating the cache features, the problem of low efficiency of existing gesture recognition is solved and the recognition efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202311857892.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-12-29
AI Technical Summary
In existing gesture recognition methods, each frame of image is calculated multiple times during the calculation process, resulting in low efficiency and inability to effectively improve the efficiency of gesture recognition.
By dividing the image sequence to be processed into a target image sequence and a non-target image sequence, only the spatial domain features of the target image sequence are extracted, and the cached spatial domain features of the non-target image sequence are used for fusion feature extraction, which reduces repeated calculations and improves efficiency.
It reduces the amount of calculation in the gesture recognition process, improves the efficiency of gesture recognition, and improves the accuracy of the recognition results by fusing spatial and temporal information.
Smart Images

Figure CN117789302B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of gesture recognition, and in particular, to a gesture recognition method and a gesture recognition model training method. Background Art
[0002] Gesture recognition is a method of identifying human gestures through mathematical or computer methods. Gesture recognition can be considered a means for computers to understand human body language. Common gestures include OK, thumbs left, thumbs right, fist, etc. Gesture recognition is widely used in gesture detection, hand AR effects, human-computer interaction, online education, smart home and other scenarios.
[0003] The current gesture recognition method performs computational recognition based on multiple frames of image data. However, during the computational process, each frame of image will be calculated multiple times, and the efficiency of gesture recognition needs to be improved. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a gesture recognition method and a gesture recognition model training method, which are used to divide the image sequence to be processed into a target image sequence and a non-target image sequence, obtain the spatial domain features of each frame of the non-target image sequence from the cache, calculate the spatial domain features of each frame of the target image sequence, and further perform feature extraction, perform gesture recognition based on the further extracted features, and obtain a gesture recognition result. The gesture recognition method provided by the embodiments of the present application can reduce the amount of calculation in the gesture recognition process and improve the efficiency of gesture recognition.
[0005] In a first aspect, an embodiment of the present application provides a gesture recognition method, the method comprising: determining an image sequence to be processed; determining a target image sequence and a non-target image sequence from the image sequence to be processed; wherein, spatial features have not been extracted from images in the target image sequence, and spatial features have been extracted from images in the non-target image sequence; normalizing and extracting spatial features for each frame of the target image sequence respectively to obtain spatial features for each frame of the target image sequence; further extracting features based on the spatial features of each frame of the target image sequence and the spatial features of each frame of the pre-cached non-target image sequence to obtain fused features for each frame of the image sequence to be processed; wherein the fused features refer to features that fuse spatial and temporal information; and obtaining gesture recognition results based on the fused features of each frame of the image sequence to be processed.
[0006] In the above implementation process, the gesture recognition method provided in the embodiment of the present application divides the image sequence to be processed into two parts, one part is the image sequence whose spatial features have been extracted (non-target image sequence), and the other part is the image sequence whose spatial features have not been extracted (target image sequence); in each gesture recognition, only the spatial features of the target image sequence need to be extracted, so that the spatial features will only be extracted once for each frame of the image, avoiding the repeated use of images for spatial feature extraction, and improving the efficiency of gesture recognition.
[0007] Optionally, in an embodiment of the present application, further feature extraction is performed based on the spatial features of each frame image of the target image sequence and the spatial features of each frame image of the pre-cached non-target image sequence to obtain fused features of each frame image of the image sequence to be processed, including: combining the spatial features of each frame image of the target image sequence and the spatial features of each frame image of the non-target image sequence to form a spatial feature sequence; inputting the spatial feature sequence into a self-attention model to obtain fused features of each frame image of the image sequence to be processed.
[0008] In the above implementation process, the spatial features of each frame of the target sequence and the spatial features of each frame of the non-target sequence can be combined into a spatial feature sequence, which is input into a self-attention model such as a Transformer model to obtain a fusion feature that combines temporal information and spatial information. This allows the feature to have both temporal information and spatial information, which is beneficial to improving the accuracy of gesture recognition results.
[0009] Optionally, in the embodiment of the present application, the gesture recognition method further includes: caching the spatial domain features of each frame image of the target image sequence.
[0010] In the above implementation process, spatial feature extraction will only be performed once for each frame of the image sequence to be processed in the embodiment of the present application, and the extracted spatial features will be cached for use in gesture recognition for other image sequences to be processed, thereby reducing the occupancy of computing resources and improving the efficiency of gesture recognition.
[0011] Optionally, in the embodiment of the present application, the gesture recognition method further includes: correcting the gesture recognition result based on the temporal consistency of the gesture to obtain a corrected gesture recognition result.
[0012] Optionally, in an embodiment of the present application, the gesture recognition result is corrected based on the temporal consistency of the gesture to obtain a corrected gesture recognition result, including: using a temporal consistency filter to correct the gesture recognition result to obtain a corrected gesture recognition result; wherein the temporal consistency filter includes a multilayer perceptron, a median filter or a mean filter.
[0013] In the above implementation process, the gesture recognition method provided in the present application can also optimize the gesture recognition results based on the temporal consistency of the gestures to improve the prediction accuracy and robustness.
[0014] Optionally, in an embodiment of the present application, the images in the image sequence to be processed include: at least one of: a color image, a grayscale image, an infrared image, and a depth image.
[0015] In the above implementation process, the gesture recognition method provided in the embodiment of the present application supports multiple image categories. Different types of images provide different information. A certain type of image may be interfered or inaccurate under certain conditions, while other types of images may be more reliable under the same conditions. Combining them together can provide richer and more reliable data, which helps to improve the accuracy of gesture recognition.
[0016] In a second aspect, an embodiment of the present application provides a gesture recognition model training method, which includes: determining a training set image sequence; determining a target training set image sequence and a non-target training set image sequence from the training set image sequence; wherein, the images in the target training set image sequence have not had spatial features extracted, and the images in the non-target training set image sequence have had spatial features extracted; using a gesture recognition model to perform the following operations: normalizing and extracting spatial features for each frame of the target training set image sequence, respectively, to obtain spatial features for each frame of the target training set image sequence; combining the spatial features of each frame of the target training set image sequence and the spatial features of each frame of the pre-cached non-target training set image sequence to form an initial spatial feature sequence; randomly removing some of the spatial features in the initial spatial feature sequence to obtain a training set spatial feature sequence; inputting the training set spatial feature sequence into a self-attention training model to obtain fused features for each frame of the training set image sequence to be processed; obtaining a gesture recognition training result based on the fused features of each frame of the training set image sequence to be processed; and adjusting the parameters of the gesture recognition model based on the gesture recognition training result.
[0017] In the above implementation process, the gesture recognition model training method provided in the embodiment of the present application randomly removes some features. After the model has undergone such data augmentation, it is more likely to produce more consistent and robust gesture recognition results in different scenarios, thereby improving its generalization ability.
[0018] In a third aspect, an embodiment of the present application provides a gesture recognition device, which includes: a feature extraction module and a prediction module; the feature extraction module is used to determine a target image sequence and a non-target image sequence from an image sequence to be processed; wherein, spatial features have not been extracted from images in the target image sequence, and spatial features have been extracted from images in the non-target image sequence; the feature extraction module is also used to perform normalization processing and spatial feature extraction on each frame of the target image sequence, respectively, to obtain spatial features of each frame of the target image sequence; the feature extraction module is also used to perform further feature extraction based on the spatial features of each frame of the target image sequence and the spatial features of each frame of the pre-cached non-target image sequence, to obtain fused features of each frame of the image sequence to be processed; wherein, the fused features refer to features that fuse spatial and temporal information; the prediction module is used to obtain gesture recognition results based on the fused features of each frame of the image sequence to be processed.
[0019] In a fourth aspect, an embodiment of the present application provides a gesture recognition model training device, the gesture recognition model training device comprising: an image recognition module and a training module; the image recognition module is used to determine a training set image sequence; the image recognition module is also used to determine a target training set image sequence and a non-target training set image sequence from the training set image sequence; wherein, the images in the target training set image sequence have not had spatial domain features extracted, and the images in the non-target training set image sequence have had spatial domain features extracted; the training module is used to use the gesture recognition model to perform the following operations: respectively perform normalization processing and spatial domain feature extraction on each frame of the target training set image sequence, and obtain the target training set image sequence; The spatial domain features of each frame of the target training set image sequence are obtained; the spatial domain features of each frame of the target training set image sequence and the spatial domain features of each frame of the pre-cached non-target training set image sequence are combined into an initial spatial domain feature sequence; some spatial domain features in the initial spatial domain feature sequence are randomly removed to obtain the training set spatial domain feature sequence; the training set spatial domain feature sequence is input into the self-attention training model to obtain the fusion features of each frame of the training set image sequence to be processed; according to the fusion features of each frame of the training set image sequence to be processed, the gesture recognition training results are obtained; and the parameters of the gesture recognition model are adjusted according to the gesture recognition training results.
[0020] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any of the above implementation methods.
[0021] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps in any of the above-mentioned implementation methods are executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A flowchart of gesture recognition provided in an embodiment of the present application;
[0024] Figure 2 A fusion feature extraction flow chart provided for an embodiment of the present application;
[0025] Figure 3 A gesture recognition network diagram provided for an embodiment of the present application;
[0026] Figure 4 A flowchart of the gesture recognition model training provided in the embodiment of the present application;
[0027] Figure 5 A schematic diagram of a module of a gesture recognition device provided in an embodiment of the present application;
[0028] Figure 6 A schematic diagram of a module of a gesture recognition model training device provided in an embodiment of the present application;
[0029] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented by a dedicated hardware-based system that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0031] Gesture recognition is a technology that uses computer vision and artificial intelligence technology to analyze and identify human gestures. It mainly uses sensors, cameras and other devices to capture gesture information, and then processes and analyzes the captured gesture information through algorithms to achieve recognition and judgment of gestures.
[0032] Gesture recognition has been widely used. Gesture recognition can be used to control video games and virtual reality. For example, players can use gestures to control character movement, attack and use skills without having to use traditional game controllers or keyboard and mouse devices; gesture recognition methods can also be used to control smart home devices. For example, through simple gestures, users can turn on or off lights, adjust temperature, adjust volume, etc.; gestures can also be used to identify users' gesture passwords. For example, on mobile devices, users can use gesture passwords to unlock the screen or access sensitive information; gesture recognition can also be used for health monitoring and medical diagnosis. For example, gesture recognition technology can help doctors identify hand muscle activities and postures to assist in the diagnosis and treatment of muscle diseases; gesture recognition can also be used in car interfaces, such as controlling music and navigation systems without having to distract operating the control panel or touching the screen.
[0033] In the comparative embodiment, the gesture recognition method is implemented by reasoning through a neural network: first, the network normalizes the multi-frame image data, and further, the network extracts spatial features from the processed multi-frame image data, and predicts based on the spatial features to obtain a gesture recognition result.
[0034] The inventors have found that in this process, since the normalization operation is based on multi-frame image data, each network inference requires re-extraction of spatial features of the multi-frame image data used this time; since the data source can be a video sequence in actual deployment, there may be a large number of repeated frames in two consecutive inference processes. The spatial features of these repeated frames cannot be reused and must be re-extracted during each inference, resulting in a large amount of computational redundancy, resulting in insufficient efficiency of gesture recognition.
[0035] Taking the case where 6 frames of images are input into the network for gesture recognition each time as an example, the first input into the network is the 6 frames of data {0, 1, 2, 3, 4, 5} (the numbers represent the frame numbers), and the method of the comparative embodiment needs to normalize the 6 frames of images, that is, use the mean and variance calculated based on the 6 frames of images to normalize each of the 6 frames of input images; further, the network needs to extract spatial features from each normalized frame of images. Similarly, the second input into the network is the 6 frames of data {1, 2, 3, 4, 5, 6}, and the network needs to extract spatial features from each frame of images; the third input into the network is the 6 frames of data {2, 3, 4, 5, 6, 7}, and the network needs to extract spatial features from each frame of images... and so on. It can be seen that the 1st, 2nd, 3rd, 4th, and 5th frames of the 6 frames of images input to the network for the second time have participated in the calculation of the 6 frames of data {0, 1, 2, 3, 4, 5} of the first input network; the 2nd, 3rd, 4th, and 5th frames of the 6 frames of data input to the network for the third time have participated in the calculation of the 6 frames of data {0, 1, 2, 3, 4, 5} of the first input network and the 6 frames of data {1, 2, 3, 4, 5, 6} of the second input network. Therefore, when the number of input frames is 6, the spatial features of the 2nd frame are repeatedly calculated twice, the spatial features of the 3rd frame are repeatedly calculated 3 times, the spatial features of the 4th frame are repeatedly calculated 4 times, the spatial features of the 5th frame are repeatedly calculated 5 times, and the spatial features of each subsequent frame from the 6th frame are repeatedly calculated 6 times, and so on. In other words, there are a lot of repeated calculations in the gesture recognition process in the comparative embodiment.
[0036] However, in the comparative embodiment, this operation of repeatedly calculating the spatial features of the same frame of image data is indispensable, because according to the normalization method in the comparative embodiment, when the gesture recognition is performed for the first time, the spatial features of each frame of data in {0, 1, 2, 3, 4, 5} are related to all the data in {0, 1, 2, 3, 4, 5}. Taking the first frame as an example, its spatial features are affected by the data of frames 0 to 5; when the gesture recognition is performed for the second time, the spatial features of each frame of data in {1, 2, 3, 4, 5, 6} are related to all the data in {1, 2, 3, 4, 5, 6}. Taking the first frame as an example, its spatial features are affected by the data of frames 1 to 6. Obviously, the data of frames 0 to 5 are different from the data of frames 1 to 6. Therefore, when the gesture recognition is performed twice, the spatial features corresponding to the data of the first frame are different. When the gesture recognition is performed for the second time, the spatial features of the data of the first frame must be re-extracted, and the spatial features of the data of the first frame extracted when the gesture recognition is performed for the first time cannot be reused. Based on this, this solution provides a gesture recognition method and a gesture recognition model training method. This gesture recognition method decouples the multi-frame input image sequence, and only needs to extract the spatial domain features once for each frame of the image, which can not only realize the flexible deployment of the model, but also improve the efficiency of gesture recognition; on the other hand, the gesture recognition method provided by this solution optimizes the gesture recognition results, which can improve the accuracy and robustness of the prediction. In terms of model training, this solution also proposes improvements to increase the diversity of data during the model training process and improve the model's adaptability to actions of different speeds.
[0037] Please see Figure 1 , Figure 1 A gesture recognition flow chart provided in an embodiment of the present application; a first aspect of the present application provides a gesture recognition method, which can be Figure 7 The electronic device in the embodiment of the present invention is executed, and the gesture recognition method comprises the following steps:
[0038] Step S100: determining an image sequence to be processed.
[0039] In the above step S100, the image sequence to be processed can be an image sequence in a video of a user making a certain gesture, or it can be an image sequence other than a video; wherein, if the image sequence to be processed is an image sequence in a video, then the frames in the image sequence to be processed can be continuous frames in the video, or they can be discontinuous frames (for example, frames are extracted from the video to form the image sequence to be processed).
[0040] For example, if frames 50 to 170 of a video sequence or an image sequence are determined as every 12 frames as an image sequence to be processed, such as frames 50 to 61 as an image sequence to be processed, frames 51 to 62 as an image sequence to be processed, frames 52 to 63 as an image sequence to be processed ... frames 50 to 61 are the first image sequence to be processed in this example. When processing frames 50 to 61, the spatial features of each frame from frames 50 to 61 need to be calculated and saved for gesture recognition of the first image sequence to be processed.
[0041] Step S200: determining a target image sequence and a non-target image sequence from the image sequence to be processed.
[0042] In the above steps S100-S200, a sequence of images to be processed is determined, and a target image sequence and a non-target image sequence are determined from the sequence of images to be processed; it should be noted that the target image sequence in the embodiment of the present application is an image sequence in which the spatial features of the images in the sequence have not been extracted, and the non-target image sequence is an image sequence in which the spatial features of the images in the sequence have been extracted. The spatial features of the non-target image sequence can be stored in the cache and used when needed.
[0043] Referring to the above example, when gesture recognition is performed based on the sequence of frames {50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61} from the 50th frame to the 61st frame, the spatial features corresponding to the 51st, 52nd, 53rd, 54th, 55th, 56th, 57th, 58th, 59th, 60th, 61st frames have been calculated, and the spatial features corresponding to the 51st, 52nd, 53rd, 54th, 55th, 56th, 57th, 58th, 59th, 60th, 61st frames can be saved. When gesture recognition is performed based on the sequence {51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62} from the 51st frame to the 62nd frame, {51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61} can be determined as a non-target sequence, and {62} can be determined as a target sequence; for the non-target sequence {51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61}, the previously cached spatial features corresponding to the 51st, 52nd, 53rd, 54th, 55th, 56th, 57th, 58th, 59th, 60th, 61st frames can be directly used, and only the spatial features of the target sequence {62} need to be calculated. That is to say, the spatial features corresponding to the 51st frame to the 61st frame only need to be extracted once, and after calculating the spatial features of the 62nd frame, the spatial features of the 62nd frame can be saved. When performing gesture recognition based on the sequence {52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63} from the 52nd frame to the 63rd frame, it is only necessary to calculate the spatial features of the 63rd frame. The spatial features of the 52nd frame to the 62nd frame can be directly read from the cache, that is, the spatial features corresponding to the 52nd frame to the 62nd frame only need to be extracted once.
[0044] For another example, after processing the sequence {52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}, directly process the sequence {58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69}. For the sequence {58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69}, {58, 59, 60, 61, 62, 63} is determined as a non-target sequence, then the spatial domain features corresponding to each frame in the 58th to 63rd frame images in the non-target sequence can be directly read from the cache. The spatial features of each of the six frames from the 64th frame to the 69th frame in the target sequence {64, 65, 66, 67, 68, 69} need to be calculated at that time, that is, the spatial features of the 58th frame to the 63rd frame only need to be extracted once.
[0045] Step S300: normalizing and extracting spatial features of each frame of the target image sequence to obtain the spatial features of each frame of the target image sequence.
[0046] In the above step S300, each frame image in the target image sequence is normalized respectively, and after the normalization, the spatial feature of each normalized frame image is extracted to obtain the spatial feature of each frame image in the target image sequence; it should be noted that the spatial feature is a feature that contains spatial information, and the extraction of spatial feature and the normalization of each frame image can be implemented based on a model or a traditional algorithm.
[0047] In an embodiment, for each frame of an image in a sequence of images to be processed, if the input image is represented by I, the following formula may be used for normalization: Normalization is performed, where meam(I) is the mean of I, and std(I) is the standard deviation of I. Therefore, the normalization process and results of each frame of the image in the embodiment of the present application are only related to the image itself, and have nothing to do with other frames in the image sequence to be processed. In other words, the spatial domain features of each frame of the image in the image sequence to be processed only depend on the current frame itself (because the extraction of the spatial domain features is based on the normalized image), and do not change with the change of the image sequence to be processed. Therefore, once the spatial domain features of a frame of image are extracted, they can be cached, and when the spatial domain features are needed later, the cache can be directly read without repeated extraction. In the control embodiment, the normalization of each frame in the image sequence to be processed is related to other images in the sequence. As long as the image sequence to be processed changes, the normalization result of each frame will also change, so that the spatial domain features of each frame will also change. Therefore, even if the spatial domain features of a frame of image are extracted, once the image sequence to be processed in which the frame of image is located changes, the spatial domain features of the frame of image must be recalculated, and the previous calculation results cannot be reused.
[0048] Step S400: further feature extraction is performed based on the spatial domain features of each frame image of the target image sequence and the spatial domain features of each frame image of the pre-cached non-target image sequence to obtain fusion features of each frame image of the image sequence to be processed.
[0049] Step S500: obtaining a gesture recognition result according to the fusion features of each frame of the image sequence to be processed.
[0050] In the above steps S400 to S500, based on the spatial domain features of each frame of the target image sequence and each frame of the pre-cached non-target image sequence, the model or traditional feature extraction method is further used to extract features to obtain the fusion features of each frame. The fusion features refer to the features that fuse the time domain information and the spatial domain information. Finally, the gesture recognition result is obtained based on the fusion features of each frame of the image sequence to be processed. Among them, the spatial domain information can be understood as the information contained in a single frame image, and the temporal domain information can be understood as the information contained in multiple frames. The formation of a gesture has both temporal and spatial factors. Therefore, it is more accurate to obtain the gesture recognition result based on the fusion features.
[0051] In the embodiment of the present application, the gesture recognition result can be a result obtained based on the image sequence to be processed; it can also be a gesture recognition result obtained for each frame of the image sequence to be processed, forming multiple recognition results; it can also be a gesture recognition result obtained based on each frame of the image sequence to be processed, and forming multiple recognition results, and a final gesture result is obtained based on the multiple recognition results. For example, inputting 10 frames of images into the network can obtain 1 gesture recognition result, and 10 gesture recognition results can be obtained; it can also be obtained that 10 gesture recognition results are obtained, and the 10 gesture recognition results are processed comprehensively to be the final gesture recognition result.
[0052] pass Figure 1 It can be seen that the gesture recognition method provided in the embodiment of the present application divides the image sequence to be processed into two parts, one part is the image sequence whose spatial features have been extracted (non-target image sequence), and the other part is the image sequence whose spatial features have not been extracted (target image sequence); since each frame of the image in the image sequence to be processed is normalized separately, the normalization process and result of each frame of the image are only related to the frame of the image itself, and the spatial features of each frame of the image are extracted based on the normalization result, therefore, in each gesture recognition, only the spatial features of the target image sequence need to be extracted, and the spatial features of the non-target image sequence can be directly obtained from the cache, so that the spatial features of each frame of the image will only be extracted once, avoiding repeated use of images for spatial feature extraction, and improving the efficiency of gesture recognition.
[0053] Please see Figure 2 , Figure 2 The fusion feature extraction flow chart provided in the embodiment of the present application; the above step S400 further extracts features based on the spatial domain features of each frame of the target image sequence and the spatial domain features of each frame of the pre-cached non-target image sequence to obtain the fusion features of each frame of the image sequence to be processed; it can be achieved by the following steps:
[0054] Step S410: The spatial domain features of each frame of the target image sequence and the spatial domain features of each frame of the non-target image sequence are combined into a spatial domain feature sequence.
[0055] Still referring to the above example, after completing gesture recognition for the sequence {52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}, further processing the sequence {58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69}, use { , , , , , } represents the spatial features corresponding to each frame from the 58th to the 63rd frame image, which can be directly read from the cache. The spatial features of each frame from the 64th to the 69th frame calculated this time are { , , , , , }.
[0056] The spatial features corresponding to each frame from the 58th to the 63rd frame (the spatial features of each frame of the non-target image sequence) and the spatial features of each frame from the 64th to the 69th frame (the spatial features of each frame of the target image sequence) are combined to obtain the spatial feature sequence: , , , , , , , , , , , }.
[0057] Step S420: Input the spatial feature sequence into the self-attention model to obtain the fusion features of each frame image in the image sequence to be processed.
[0058] It should be noted that the self-attention model is a deep learning model used to process sequence data, such as natural language text or time series data. The self-attention model establishes associations between each element in the input sequence and can assign weights to each input element to determine its contribution to the output, thereby being able to capture the complex dependencies within the input data, that is, it has a self-attention mechanism. Common self-attention models include the Transformer model.
[0059] It can be seen that the spatial features of each frame of the target sequence and the spatial features of each frame of the non-target sequence can be combined into a spatial feature sequence and input into a self-attention model such as the Transformer model to obtain a fusion feature that combines temporal information and spatial information, which is beneficial to improve the accuracy of gesture recognition results.
[0060] In an optional embodiment, after calculating the spatial domain features corresponding to each frame of the target image sequence, the spatial domain features of each frame of the target image sequence are cached.
[0061] If the images in the subsequent image sequence to be processed of the current image sequence to be processed include images corresponding to the spatial domain features of each frame image of the above-mentioned target image sequence, then for the subsequent image sequence to be processed, the corresponding images should be determined as non-target image sequences in the subsequent image sequence to be processed; the spatial domain features of the images identified as the non-target image sequence of the subsequent image sequence to be processed do not need to be extracted again, and when gesture recognition is performed based on the subsequent image sequence to be processed, the spatial domain features corresponding to the images in the non-target image sequence are directly obtained from the cache.
[0062] For example, we need to process the images from frame 0 to frame 10, 4 frames each time. The first time we process the sequence is {0, 1, 2, 3}, the second time we process the sequence is {1, 2, 3, 4}, the third time we process the sequence is {2, 3, 4, 5}...
[0063] If the current sequence of images to be processed is {0, 1, 2, 3}, the subsequent sequence of images to be processed may be any sequence after the sequence {0, 1, 2, 3}.
[0064] After processing the sequence {0, 1, 2, 3}, when the subsequent sequence is {1, 2, 3, 4}, frames 1 to 3 are determined to be the non-target image sequence of the sequence {1, 2, 3, 4} (the spatial features can be directly read from the cache), and frame 4 is the target image sequence for the sequence {1, 2, 3, 4}.
[0065] After processing the sequence {0, 1, 2, 3}, when the subsequent sequence is {2, 3, 4, 5}, frames 2 to 3 are determined to be the non-target image sequence of the sequence {2, 3, 4, 5} (the spatial features can be directly read from the cache), and frames 4 to 5 are the target image sequence for the sequence {2, 3, 4, 5}.
[0066] Therefore, in the embodiment of the present application, spatial feature extraction will only be performed once for each frame of the image sequence to be processed, and the extracted spatial features will be cached for use in gesture recognition for other image sequences to be processed, thereby reducing the occupancy of computing resources and improving the efficiency of gesture recognition.
[0067] In an optional embodiment, the gesture recognition method further includes: correcting the gesture recognition result based on the temporal consistency of the gesture to obtain a corrected gesture recognition result.
[0068] When the user completes the same gesture, the gestures in the content of multiple frames are consistent. In theory, the results of gesture recognition for a specific frame in the multiple frames of the same gesture should be consistent, that is, the temporal consistency of the gesture. However, in practice, since the gesture recognition algorithm is not completely ideal, there may be abnormal gesture recognition results. For example, if one of the 10 gesture recognition results is different from the other 9, the gesture recognition result is likely to be abnormal, and the abnormal gesture recognition result can be corrected. Therefore, the recognition result can be corrected based on the temporal consistency of the gesture to obtain the final corrected gesture recognition result.
[0069] For example, a temporal consistency filter can be used to correct the gesture recognition result to obtain a corrected gesture recognition result; wherein the temporal consistency filter includes a multi-layer perceptron, a median filter or a mean filter. The above-mentioned temporal consistency filter can be understood as an algorithm or model that corrects the gesture recognition results of multiple image sequences to be processed (the same gesture captured by multiple image sequences to be processed) based on the temporal consistency of the gesture, for example, using a multi-layer perceptron to learn the relationship of temporal consistency to correct the recognition result; for example, using a median filter or a mean filter to filter out erroneous gesture recognition results.
[0070] It can be seen from this that the gesture recognition method provided in the present application can also optimize the gesture recognition results based on the temporal consistency of the gestures, thereby improving the prediction accuracy and robustness.
[0071] In an optional embodiment, the images in the image sequence to be processed include at least one of: a color image, a grayscale image, an infrared image, and a depth image.
[0072] That is, the images in the image sequence to be processed may be color images, grayscale images, infrared images, depth images, or a combination of these images.
[0073] For example, if the images in the image sequence to be processed are a combination of a depth image and an infrared image, then each moment of the image sequence for gesture recognition includes a frame of infrared image and a frame of depth image.
[0074] It can be seen that the gesture recognition method provided in the embodiment of the present application supports multiple image categories. Different types of images provide different information. A certain type of image may be interfered or inaccurate under certain conditions, while other types of images may be more reliable under the same conditions; combining them together can provide richer and more reliable data, which helps to improve the accuracy of gesture recognition.
[0075] In an optional embodiment, before the user performs gesture recognition, the number of frames of the image sequence to be processed is determined according to the speed of the user's action. For example, if the action is fast, the image sequence to be processed has more frames, and if the action is slow, the image sequence to be processed has fewer frames. Therefore, the gesture recognition method provided in the embodiment of the present application can flexibly adapt to the gesture recognition of different users.
[0076] Please see Figure 3 , Figure 3 A network structure diagram of a gesture recognition model provided in an embodiment of the present application is provided. The flow of the gesture recognition method is described below in conjunction with the network structure diagram.
[0077] Taking the video sequence as an example, the image sequence to be processed is determined from the video sequence { , , … }N frame images, if it is determined that { , , … The sequence composed of mt frames in} is a non-target image sequence, then Frame to The sequence of frames is the target image sequence.
[0078] In the processing sequence { , , … }, only the first Frame to The frames are normalized to obtain the spatial features of each frame (such as Figure 3 As shown in the figure, each frame of the normalized image is input into ResNet18 for spatial feature extraction). Frame to The spatial domain features of the frame are processed in the sequence { , , … }The previous sequence has been calculated and saved, and can now be read directly from the cache.
[0079] sequence{ , , …}Spatial features of each frame{ , , … } and sequence { , … }Spatial features of each frame{ , … }composes the spatial feature sequence{ , , … , … }, input the spatial feature sequence into the self-attention model (such as Figure 3 As shown, the fusion feature is input into the transformer model for further feature extraction to obtain the fusion feature; further, the fusion feature is input into the classifier for gesture recognition (as shown Figure 3 Linear Classifier in ), and get the classification result .
[0080] After multiple analysis and calculation, we to , N gesture recognition results, can be filtered based on the time consistency of the gestures to correct incorrect gesture recognition results.
[0081] It should be noted that the above description Figure 3 The random removal structure is temporarily ignored when constructing the network structure in the above, because the above describes the process of reasoning using the deployed gesture recognition model. The structure used to implement random removal is not required during model reasoning. The structure used to implement random removal is only added during model training to improve the diversity of training data. For details, see the following text for Figure 4 's explanation.
[0082] Please see Figure 4 , Figure 4 The gesture recognition model training flow chart provided in the embodiment of the present application; the gesture recognition model trained by the gesture recognition model training method can be used to implement the above-mentioned gesture recognition method, and the model can have, but is not limited to Figure 3 The structure in the figure. The gesture recognition model training includes the following steps:
[0083] Step S01: Determine a training set image sequence.
[0084] In the above step S01, the concept of the training set image sequence is similar to the to-be-processed image sequence in the above gesture recognition method, and the training set image sequence can be obtained from a video used to train a gesture recognition model.
[0085] Step S02: determining a target training set image sequence and a non-target training set image sequence from the training set image sequence, wherein the images in the target training set image sequence have not had spatial domain features extracted, and the images in the non-target training set image sequence have had spatial domain features extracted.
[0086] In the above step S02, the target training set image sequence is similar to the concept of the target image sequence in the above gesture recognition method, and the non-target image sequence is similar to the concept of the non-target image sequence in the above gesture recognition method; in the gesture recognition model training method, the target training set image sequence and the non-target training set sequence are the divisions of the training set image sequence.
[0087] Step S03: perform the following operations using the gesture recognition model: respectively perform normalization processing and spatial feature extraction on each frame of the target training set image sequence to obtain the spatial features of each frame of the target training set image sequence; combine the spatial features of each frame of the target training set image sequence and the spatial features of each frame of the pre-cached non-target training set image sequence to form an initial spatial feature sequence; randomly remove some of the spatial features in the initial spatial feature sequence to obtain a training set spatial feature sequence; input the training set spatial feature sequence into the self-attention training model to obtain the fusion features of each frame of the training set image sequence to be processed; obtain the gesture recognition training result according to the fusion features of each frame of the training set image sequence to be processed.
[0088] Step S04: adjusting the parameters of the gesture recognition model according to the gesture recognition training result.
[0089] In the above step S04, the prediction loss may be calculated according to the difference between the gesture recognition training result and the pre-calibrated gesture recognition result; and the model parameters may be updated according to the prediction loss using the back propagation algorithm.
[0090] Steps S01-S04 are repeatedly performed until the model converges and the gesture recognition model training is completed.
[0091] In the above steps S01-S04, firstly, the training set image sequence, as well as the target training set image sequence and the non-target training set image sequence in the training set image sequence are determined. The training set spatial domain features are extracted for the target training set image sequence, and the training set spatial domain features of the non-target training set image sequence in the cache are obtained; the spatial domain features of each frame of the target training set image sequence and the spatial domain features of each frame of the pre-cached non-target training set image sequence are combined into an initial spatial domain feature sequence.
[0092] Randomly remove some spatial features in the initial spatial feature sequence to obtain the spatial feature sequence of the training set.
[0093] For example, for the feature sequence { , , , , , }, perform partial random removal and set some elements in the feature sequence to 0, for example { , , , , , }, the sequence can be randomly set to 0 multiple times to obtain multiple sets of training set spatial domain feature sequences to achieve data augmentation.
[0094] Refer again Figure 3 , during the model training process, the spatial feature sequence { , , … , … After that, the spatial feature sequence can be randomly removed, some elements in it can be randomly set to zero, and multiple sets of spatial feature sequences can be formed by randomly setting them to zero multiple times to achieve data augmentation for model training.
[0095] Furthermore, the spatial feature sequence of the training set is input into the self-attention model to obtain a fusion feature that integrates the temporal information and the spatial information, and finally the gesture recognition result is obtained based on the fusion feature. The steps of the gesture recognition model training method can refer to the corresponding steps in the gesture recognition method of the present application, and will not be repeated.
[0096] pass Figure 4 It can be seen that the gesture recognition model training method provided in the embodiment of the present application randomly removes some features. After the model has undergone such data augmentation, it is more likely to produce more consistent and robust gesture recognition results in different scenarios, thereby improving its generalization ability.
[0097] Please see Figure 5 , Figure 5 This is a module diagram of a gesture recognition device provided in an embodiment of the present application; the gesture recognition device 100 includes a feature extraction module 110 and a prediction module 120 .
[0098] The feature extraction module 110 is used to determine a target image sequence and a non-target image sequence from the image sequence to be processed; wherein the images in the target image sequence have not had spatial domain features extracted, and the images in the non-target image sequence have had spatial domain features extracted;
[0099] The feature extraction module 110 is also used to perform normalization processing and spatial feature extraction on each frame of the target image sequence to obtain the spatial features of each frame of the target image sequence;
[0100] The feature extraction module 110 is further used to perform further feature extraction based on the spatial domain features of each frame of the target image sequence and the spatial domain features of each frame of the pre-cached non-target image sequence, to obtain the fusion features of each frame of the image sequence to be processed; wherein the fusion features refer to the features that fuse the spatial domain and temporal domain information;
[0101] The prediction module 120 is used to obtain a gesture recognition result according to the fusion features of each frame of the image sequence to be processed.
[0102] In an optional embodiment, the feature extraction module 110 is specifically used to combine the spatial features of each frame image of the target image sequence and the spatial features of each frame image of the non-target image sequence into a spatial feature sequence; input the spatial feature sequence into the self-attention model to obtain the fusion features of each frame image of the image sequence to be processed.
[0103] In an optional embodiment, the gesture recognition device 100 is further configured to cache the spatial features of each frame of the target image sequence.
[0104] In an optional embodiment, the gesture recognition device 100 is further configured to correct the gesture recognition result based on the temporal consistency of the gesture to obtain a corrected gesture recognition result.
[0105] In an optional embodiment, in the process of correcting the gesture recognition result based on the temporal consistency of the gesture to obtain the corrected gesture recognition result, the gesture recognition device 100 is specifically used to correct the gesture recognition result using a temporal consistency filter to obtain the corrected gesture recognition result; wherein the temporal consistency filter includes a multilayer perceptron, a median filter or a mean filter.
[0106] Please see Figure 6 , Figure 6 This is a module diagram of a gesture recognition model training device provided in an embodiment of the present application; the gesture recognition model training device 200 includes: an image recognition module 210 and a training module 220.
[0107] The image recognition module 210 is used to determine the training set image sequence;
[0108] The image recognition module 210 is also used to determine a target training set image sequence and a non-target training set image sequence from the training set image sequence; wherein the images in the target training set image sequence have not had spatial domain features extracted, and the images in the non-target training set image sequence have had spatial domain features extracted;
[0109] The training module 220 is used to perform the following operations using the gesture recognition model: normalize and extract spatial features for each frame of the target training set image sequence to obtain the spatial features of each frame of the target training set image sequence; combine the spatial features of each frame of the target training set image sequence and the spatial features of each frame of the pre-cached non-target training set image sequence to form an initial spatial feature sequence; randomly remove some of the spatial features in the initial spatial feature sequence to obtain a training set spatial feature sequence; input the training set spatial feature sequence into the self-attention training model to obtain the fusion features of each frame of the training set image sequence to be processed; obtain the gesture recognition training results based on the fusion features of each frame of the training set image sequence to be processed; and adjust the parameters of the gesture recognition model based on the gesture recognition training results.
[0110] See also Figure 7 , Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. An electronic device 300 provided in an embodiment of the present application includes: a processor 301 and a memory 302, the memory 302 stores machine-readable instructions executable by the processor 301, and the machine-readable instructions execute the above method when executed by the processor 301. The electronic device can be a physical device, such as a mobile phone, a PC, a wearable device, a household appliance, a monitoring device, a game console, a drone, a robot, etc., or a virtual device, such as a virtual machine, a container, etc.
[0111] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the steps in any implementation of the above-mentioned gesture recognition method or gesture recognition model training method are executed.
[0112] The computer-readable storage medium may be a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or any other medium that can store program code.
[0113] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0114] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A gesture recognition method, characterized in that: The method comprises: Determine the image sequence to be processed; Determine a target image sequence and a non-target image sequence from the image sequence to be processed; wherein the spatial domain features of the images in the target image sequence have not been extracted, and the spatial domain features of the images in the non-target image sequence have been extracted; Performing normalization processing and spatial domain feature extraction on each frame image of the target image sequence respectively to obtain the spatial domain features of each frame image of the target image sequence; Further feature extraction is performed based on the spatial domain features of each frame of the target image sequence and the pre-cached spatial domain features of each frame of the non-target image sequence to obtain fusion features of each frame of the image sequence to be processed; wherein the fusion features refer to features that fuse spatial domain and temporal domain information; A gesture recognition result is obtained according to the fusion features of each frame of the image sequence to be processed.
2. The method according to claim 1, characterized in that: The further feature extraction based on the spatial domain features of each frame of the target image sequence and the pre-cached spatial domain features of each frame of the non-target image sequence to obtain the fusion features of each frame of the image sequence to be processed includes: The spatial domain features of each frame of the target image sequence and the spatial domain features of each frame of the non-target image sequence are combined into a spatial domain feature sequence; The spatial domain feature sequence is input into a self-attention model to obtain fusion features of each frame image of the image sequence to be processed.
3. The method according to claim 1, characterized in that The method further includes: caching the spatial domain features of each frame of the target image sequence.
4. The method according to claim 3, characterized in that: The method further comprises: The gesture recognition result is corrected based on the temporal consistency of the gesture to obtain a corrected gesture recognition result.
5. The method according to claim 4, characterized in that The step of correcting the gesture recognition result based on the temporal consistency of the gesture to obtain a corrected gesture recognition result includes: The gesture recognition result is corrected using a time consistency filter to obtain the corrected gesture recognition result; wherein the time consistency filter includes a multi-layer perceptron, a median filter or a mean filter.
6. The method according to claim 1, characterized in that The images in the to-be-processed image sequence include at least one of: a color image, a grayscale image, an infrared image, and a depth image.
7. A gesture recognition model training method, characterized in that: The gesture recognition model training method comprises: Determine a training set image sequence; Determining a target training set image sequence and a non-target training set image sequence from the training set image sequence; wherein the spatial domain features have not been extracted from the images in the target training set image sequence, and the spatial domain features have been extracted from the images in the non-target training set image sequence; The following operations are performed using the gesture recognition model: normalizing and extracting spatial features for each frame of the target training set image sequence respectively to obtain the spatial features of each frame of the target training set image sequence; the spatial features of each frame of the target training set image sequence and the pre-cached spatial features of each frame of the non-target training set image sequence form an initial spatial feature sequence; randomly removing some of the spatial features in the initial spatial feature sequence to obtain a training set spatial feature sequence; inputting the training set spatial feature sequence into the self-attention training model to obtain the fusion features of each frame of the training set image sequence to be processed; and obtaining the gesture recognition training result according to the fusion features of each frame of the training set image sequence to be processed; The parameters of the gesture recognition model are adjusted according to the gesture recognition training results.
8. A gesture recognition device, characterized in that: The gesture recognition device comprises: a feature extraction module and a prediction module; The feature extraction module is used to determine a target image sequence and a non-target image sequence from the image sequence to be processed; wherein the spatial domain features of the images in the target image sequence have not been extracted, and the spatial domain features of the images in the non-target image sequence have been extracted; The feature extraction module is also used to perform normalization processing and spatial feature extraction on each frame image of the target image sequence, so as to obtain the spatial feature of each frame image of the target image sequence; The feature extraction module is further used to perform further feature extraction based on the spatial domain features of each frame of the target image sequence and the pre-cached spatial domain features of each frame of the non-target image sequence to obtain fused features of each frame of the image sequence to be processed; wherein the fused features refer to features that fuse spatial domain and temporal domain information; The prediction module is used to obtain a gesture recognition result according to the fusion features of each frame of the image sequence to be processed.
9. A gesture recognition model training device, characterized in that: The gesture recognition model training device comprises: an image recognition module and a training module; The image recognition module is used to determine the training set image sequence; The image recognition module is further used to determine a target training set image sequence and a non-target training set image sequence from the training set image sequence; wherein the images in the target training set image sequence have not had spatial domain features extracted, and the images in the non-target training set image sequence have had spatial domain features extracted; The training module is used to perform the following operations using the gesture recognition model: normalize and extract spatial features for each frame of the target training set image sequence to obtain the spatial features of each frame of the target training set image sequence; form an initial spatial feature sequence with the spatial features of each frame of the target training set image sequence and the pre-cached spatial features of each frame of the non-target training set image sequence; randomly remove some of the spatial features in the initial spatial feature sequence to obtain a training set spatial feature sequence; input the training set spatial feature sequence into a self-attention training model to obtain fusion features of each frame of the training set image sequence to be processed; obtain a gesture recognition training result based on the fusion features of each frame of the training set image sequence to be processed; and adjust the parameters of the gesture recognition model based on the gesture recognition training result.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the steps in the method according to any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Real-time dynamic gesture identification method based on Key frame and boundary constraint DTW (Dynamic Time Warping)
CN107169411A
Recognition method and system of gesture movement direction
CN107589850A
Gesture detection method and device, electronic equipment and storage medium
CN114299612A
Fuzzy gesture recognition method and device based on static and dynamic combination and medium
CN115294643A
Gesture interaction method based on multi-technology fusion
CN115497166A
