Gesture detection method in virtual reality scene and related equipment
Optimize the gesture detection model in virtual reality scenes through self-distillation learning, using features, relationships and response distillation losses to improve detection accuracy and robustness, solving the problem of insufficient gesture detection performance in the existing technology, and being suitable for a variety of detection frameworks .
Patent Information
- Application Number
- CN202310363518.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
AI Technical Summary
The performance of existing gesture detection models in virtual reality scenes is insufficient and cannot meet the needs of high-precision interactive operations.
Using the self-distillation learning method, the trained teacher model is used to optimize the gesture detection model based on feature distillation loss, relationship distillation loss and response distillation loss. The gesture detection model detects the image to be detected and performs interactive operations in the virtual reality scene.
It significantly improves the gesture detection capability of the gesture detection model in virtual reality scenes, improves detection accuracy and robustness, and avoids the need to manually set the ratio of positive and negative samples and select samples to label relevant areas. It is suitable for a variety of detection frameworks.
Smart Images

Figure CN118736663A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a gesture detection method in a virtual reality scene, and related equipment. Background Art
[0002] With the rise of virtual reality (VR) technology, various virtual reality devices have emerged. These virtual reality devices can realize system simulation of three-dimensional dynamic vision and entity behavior, support the installation of applications for various purposes, such as shopping, social networking and games, and also install various native applications, which can provide users with an immersive experience when using applications. In a virtual reality scene, users can use gestures to interact, such as pressing buttons in the virtual reality scene, clicking functional controls in the virtual reality scene, etc., but the performance of gesture detection models in virtual reality scenes is still not enough to meet the requirements. Summary of the invention
[0003] The embodiments of the present application provide a method for detecting gestures in a virtual reality scene, and related devices, which can improve the gesture detection capability of a gesture detection model in a virtual reality scene.
[0004] In a first aspect, the present application provides a method for detecting gestures in a virtual reality scene, comprising:
[0005] Acquire the image to be detected collected by the virtual reality device;
[0006] Get the gesture detection model;
[0007] Performing gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result;
[0008] In response to the gesture detection result, performing an interactive operation in the virtual reality scene;
[0009] Among them, the gesture detection model is obtained by self-distillation learning using a trained teacher model based on feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0010] In a second aspect, the present application provides a gesture detection device in a virtual reality scene, comprising:
[0011] A first acquisition unit, used to acquire an image to be detected collected by a virtual reality device;
[0012] A second acquisition unit, used to acquire a gesture detection model;
[0013] A gesture detection unit, used to perform gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result;
[0014] An interaction unit, configured to perform an interaction operation in a virtual reality scene in response to the gesture detection result;
[0015] Among them, the gesture detection model is obtained by self-distillation learning using a trained teacher model based on feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0016] In an optional embodiment, the gesture detection device in the virtual reality scene also includes a model training module, which is used to obtain a gesture detection model and a sample image; perform gesture detection on the sample image through a trained teacher model to obtain a first detection result; perform gesture detection on the sample image through a student model to obtain a second detection result, and the student model and the teacher model have the same network model structure; based on the first detection result and the second detection result, determine a target detection result in the sample image that can assist in knowledge distillation learning; based on the image information of the target detection result, determine the feature distillation loss, the relationship distillation loss, and the response distillation loss; based on the feature distillation loss, the relationship distillation loss, and the response distillation loss, guide the student model training to obtain a gesture detection model.
[0017] In an optional embodiment, the model training module is used to determine a number of initial target detection frames and initial difference information corresponding to the initial target detection frames in the sample image based on the difference between the first detection result and the second detection result; and based on the initial difference information, select a preset number of target detection results from the several initial target detection frames.
[0018] In an optional embodiment, the model training module is used to determine a number of initial target detection frames from the first prediction frame and the second prediction frame based on the numerical relationship between the first prediction score and the second prediction score; and determine initial difference information corresponding to the initial target detection frame based on the score difference relationship between the first prediction score and the second prediction score.
[0019] In an optional embodiment, the model training module is used to select a reference detection frame from several initial target detection frames based on the numerical value of the initial difference information; based on the degree of overlap between the reference detection frame and other initial target detection frames, the other initial target detection frames are screened to obtain a preset number of target detection results.
[0020] In an optional embodiment, the model training module is used to construct a feature-based loss function, a relationship-based loss function, and a response-based loss function; based on the image information of the target detection result, the feature-based loss function, the relationship-based loss function, and the response-based loss function, the feature distillation loss, the relationship distillation loss, and the response distillation loss are determined.
[0021] In an optional embodiment, the model training module is used to extract teacher image features from the teacher model and student image features from the student model based on the image information of the target detection result; and determine the feature distillation loss and the relationship distillation loss based on the feature-based loss function, the relationship-based loss function, the teacher image features, and the student image features.
[0022] In an optional embodiment, the model training module is used to extract the teacher image features to be adjusted from the teacher model, and to extract the student image features to be adjusted from the student model; based on the image information of the target detection result, the size of the teacher image features to be adjusted is adjusted to obtain the teacher image features; based on the image information of the target detection result, the size of the student image features to be adjusted is adjusted to obtain the student image features.
[0023] In an optional embodiment, the model training module is used to determine a first relational distillation loss based on the relation-based loss function and the Euclidean distance between the teacher image features; determine a second relational distillation loss based on the relation-based loss function and the Euclidean distance between the student image features; and determine the relational distillation loss based on the first relational distillation loss and the second relational distillation loss.
[0024] In an optional embodiment, the model training module is used to determine the operating conditions of the image mask according to the model structure of the teacher model; determine the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model; and determine the response distillation loss based on the operating conditions of the image mask, the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model.
[0025] In an optional embodiment, the model training module is used to determine a first response distillation loss based on a classification loss function corresponding to the teacher model, the classification output of the teacher model, and the classification output of the student model; determine a second response distillation loss based on a regression loss function corresponding to the teacher model, the regression output of the teacher model, and the regression output of the student model; and determine the response distillation loss based on an operating condition of the image mask, the first response distillation loss, and the second response distillation loss.
[0026] In a third aspect, the electronic device provided in the present application includes a memory and a processor, the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the steps in the gesture detection method in a virtual reality scene provided in the present application.
[0027] In a fourth aspect, the computer-readable storage medium provided in the present application stores a plurality of instructions, which are suitable for loading by a processor to implement the steps in the gesture detection method in a virtual reality scene provided in the present application.
[0028] In a fifth aspect, the computer program product provided in the present application includes a computer program or instructions, which, when executed by a processor, implements the steps in the gesture detection method in a virtual reality scene provided in the present application.
[0029] In the present application, the embodiment of the present application obtains an image to be detected collected by a virtual reality device, and obtains a gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using a trained teacher model according to feature distillation loss, relationship distillation loss, and response distillation loss, the feature distillation loss is obtained according to the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained according to the relationship between different regions in the same image, and the response distillation loss is obtained according to the difference between the output of the teacher model and the output of the gesture detection model, and gesture detection is performed on the image to be detected by the gesture detection model to obtain a gesture detection result, and interactive operations are performed in a virtual reality scene in response to the gesture detection result. The present application determines several target detection results for knowledge distillation, making the transfer of knowledge more effective, and also considers the relationship information between instances in the same image, and combines it with feature-based knowledge and response-based knowledge, so that the detection effect of the student model exceeds that of the teacher model, thereby improving the gesture detection capability of the gesture detection model in the virtual reality scene. At the same time, the present application does not need to manually set the ratio of positive and negative samples, nor does it need to select sample annotation related areas for distillation. Since the present application determines the target detection results in the sample image that can help knowledge distillation learning, these target detection results describe different areas with rich information in the sample image, and use the relationship information between these target detection results for modeling, on the one hand, it can avoid selecting only the area near the sample annotation for knowledge distillation, thereby ignoring useful information from the image background, and on the other hand, it can use the relationship information between these target detection results to take into account the relationship information between different areas in the sample image, thereby achieving the purpose of improving the model effect. In addition, the technical solution of the present application can also be applied to a variety of detection frameworks and has strong robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 is a scene schematic diagram of a gesture detection system in a virtual reality scene provided by an embodiment of the present application;
[0032] Figure 2 This is a schematic diagram of the first process of the gesture detection method in a virtual reality scene provided by an embodiment of the present application;
[0033] Figure 3 This is a schematic diagram of the second process of the gesture detection method in a virtual reality scene provided by an embodiment of the present application;
[0034] Figure 4 This is a schematic diagram of the third flow chart of the method for detecting gestures in a virtual reality scene provided by an embodiment of the present application;
[0035] Figure 5 is a schematic diagram of gesture detection model training provided in an embodiment of the present application;
[0036] Figure 6 is a schematic diagram of determining target detection results provided by an embodiment of the present application;
[0037] Figure 7 It is a schematic diagram of determining characteristic distillation loss and relational distillation loss provided in an embodiment of the present application;
[0038] Figure 8 It is a schematic diagram of determining the response distillation loss provided in an embodiment of the present application;
[0039] Fig. 9 It is the experimental result provided by the embodiment of the present application;
[0040] Fig.10 is a structural schematic diagram of a gesture detection device in a virtual reality scene provided by an embodiment of the present application;
[0041] Fig.11 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] It should be noted that the principles of the present application are illustrated by implementing them in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application and should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.
[0043] In the following description of the present application, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0044] In the following description of the present application, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0046] It can be understood that in the specific implementation of this application, data related to user information such as image acquisition is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0047] It should be noted that artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0048] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes machine learning (ML) technology, among which deep learning (DL) is a new research direction in machine learning. It is introduced into machine learning to make it closer to the original goal, namely artificial intelligence. At present, deep learning is mainly used in the fields of machine vision, gesture detection in natural virtual reality scenes, etc.
[0049] Deep learning is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in interpreting data such as text, images, and sound. Using deep learning technology and corresponding training sets, network models that implement different functions can be trained. For example, taking gesture detection in natural virtual reality scenes as an example, a question-answering model for question answering can be trained based on one training set, and an opinion extraction model for text opinion extraction can be trained based on another training set.
[0050] The present application relates to the field of target detection of artificial intelligence technology, and provides a method for detecting gestures in a virtual reality scene, and related devices. The method for detecting gestures in a virtual reality scene can be performed by a gesture detection device in a virtual reality scene, or by an electronic device integrated with the gesture detection device in a virtual reality scene.
[0051] 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 those skilled in the art without creative work are within the scope of protection of this application.
[0052] Please refer to Figure 1 , the present application also provides a gesture detection system in a virtual reality scene, such as Figure 1 As shown, the gesture detection system in the virtual reality scene includes an electronic device, and the gesture detection device in the virtual reality scene provided by the present application is integrated in the electronic device. For example, the electronic device can obtain the image to be detected collected by the virtual reality device, and obtain the gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using the trained teacher model according to the feature distillation loss, the relationship distillation loss, and the response distillation loss, the feature distillation loss is obtained according to the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained according to the relationship between different regions in the same image, and the response distillation loss is obtained according to the difference between the output of the teacher model and the output of the gesture detection model. The gesture detection model is used to perform gesture detection on the image to be detected to obtain a gesture detection result, and in response to the gesture detection result, an interactive operation is performed in the virtual reality scene.
[0053] Among them, the electronic device can be any device equipped with a processor and has processing capabilities, such as smart devices for virtual reality scenarios (VR, Virtual Reality), smart devices for augmented reality (AR, Augmented Reality) scenarios, smart phones, tablet computers, PDAs, laptops, smart speakers and other mobile electronic devices with processors, or desktop computers, televisions, servers, industrial equipment and other fixed electronic devices with processors.
[0054] It should be noted that Figure 1 The scene diagram of the gesture detection system in the virtual reality scene shown is only an example. The gesture detection system and scene in the virtual reality scene described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the gesture detection system in the virtual reality scene and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0055] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0056] Please refer to Figure 2 , Figure 2 is a flow chart of a gesture detection method in a virtual reality scene provided by an embodiment of the present application, such as Figure 2 As shown, the process of the gesture detection method in the virtual reality scene provided by this application is as follows:
[0057] 201. Obtain an image to be detected collected by a virtual reality device.
[0058] Among them, Extended Reality (XR) refers to the use of modern high-tech means with computers as the core to create a digital environment that combines real and virtual things, as well as new human-computer interaction methods, to bring the experiencer an immersive feeling of seamless transition between the virtual world and the real world. It is a general term for multiple technologies such as virtual reality (VR), augmented reality (AR), and mixed reality (MR).
[0059] Among them, virtual reality (VR) is a technology for creating and experiencing a virtual world. It generates a virtual environment by calculation. It is a multi-source information that realizes the fusion of virtual environment, interactive three-dimensional dynamic vision and simulation of entity behavior, allowing users to immerse themselves in the simulated environment and realize application in various virtual environments such as electronic maps and games.
[0060] In this embodiment, there is no specific restriction on the image content in the image to be detected, which may be an image including gestures or an image not including gestures. For example, since the present application is applied to a virtual reality scene, the image to be detected collected by the virtual reality device may be obtained.
[0061] Unlike facial recognition or body recognition, due to the relatively high complexity of hands, severe self-occlusion, very rapid movement of hands, and the fact that the appearance of hands can change drastically in a short period of time, a more accurate gesture detection model is needed to meet the needs of gesture detection in virtual reality scenarios.
[0062] 202. Obtain a gesture detection model.
[0063] It should be noted that in this embodiment, a gesture detection model is pre-trained, and the gesture detection model is configured to take an image for which gesture detection is desired as input and take a corresponding gesture detection result as output. For example, the input of the gesture detection model may be an image including a gesture, the position of the gesture in the corresponding output image, and scores corresponding to several detection types.
[0064] In this embodiment, after obtaining the image to be detected for gesture detection, a pre-trained gesture detection model is further obtained. The gesture detection model is a network model for detecting gestures in an image, which is obtained by self-distillation learning using a trained teacher model according to feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0065] Among them, knowledge distillation is a commonly used method for model compression. Different from pruning and quantization in model compression, knowledge distillation is to build a lightweight small model and use the supervision information of the larger model with better performance to train the small model in order to achieve better performance and accuracy. Among them, we call the large model the teacher model and the small model the student model. The supervision information output from the teacher model is called knowledge, and the process of the student model learning to transfer the supervision information from the teacher model is called distillation.
[0066] Self-distillation refers to finding a teacher model that can provide effective gain information to the student model without adding a large model. The teacher model here is often not more complex than the student model, but the gain information provided is effective incremental information for the student model to improve the efficiency of the student model. This method can avoid using more complex models and avoid generating pseudo labels through some clustering or meta-computing steps.
[0067] In one embodiment, if Figure 3 As shown, the gesture detection model is pre-trained as follows:
[0068] 301. Obtain a sample image.
[0069] Since knowledge distillation transfers the knowledge of the teacher model to the student model, thereby improving the performance of the student model and achieving the purpose of model compression, it can find a balance between accuracy and efficiency. However, when knowledge distillation technology is applied to detection tasks, due to the extremely unbalanced ratio of positive and negative samples in the detection task, the distillation loss in the detection task will encounter the impact of the extreme imbalance between positive and negative samples. Therefore, the effect of directly migrating the distillation method of a specific classification to the detection model is poor. Currently, solving the above problems usually requires carefully designing the ratio between distilled positive and negative samples, but this requires a lot of manpower and material resources. Therefore, the technical solution of the present application can avoid manually setting the ratio of positive and negative samples, while ensuring detection accuracy, reducing cost consumption.
[0070] In one embodiment, a sample image may be obtained, and the sample image does not need to be distinguished between positive samples and negative samples, that is, the sample image may include a gesture or may not include a gesture.
[0071] 302. Perform gesture detection on the sample image using the trained teacher model to obtain a first detection result.
[0072] For example, the trained teacher model can be used to perform gesture detection on the sample image to obtain a first detection result, which may include several first prediction boxes and first prediction scores corresponding to several detection categories. The first prediction box can express the position of the hand in the sample image detected by the teacher model. If the sample image does not include a hand, the number of first prediction boxes can be zero; if the sample image includes multiple hands, the number of first prediction boxes can also be greater than one. The first prediction score corresponding to the detection category is the probability value predicted for different detection categories after the teacher model performs gesture detection on the sample image. The probability value is called the first prediction score, and each detection category will predict a corresponding first prediction score.
[0073] 303. Perform gesture detection on the sample image through the student model to obtain a second detection result, and the student model and the teacher model have the same network model structure.
[0074] Compared with the more complex teacher model, the self-distillation strategy is adopted. The teacher model and the student model use the same network structure, the model requires less memory and has higher training efficiency. Therefore, the present application can apply the self-distillation strategy and use the teacher model and the student model with the same network model structure. After experimental verification, the student model based on the self-distillation strategy has achieved better performance than the teacher model.
[0075] For example, the student model can be used to perform gesture detection on the sample image to obtain a second detection result, which may include several second prediction boxes and second prediction scores corresponding to several detection categories. The second prediction box can express the position of the hand in the sample image detected by the student model. The second prediction score corresponding to the detection category is the probability value predicted for different detection categories after the student model performs gesture detection on the sample image. The probability value is called the second prediction score, and each detection category will predict a corresponding second prediction score.
[0076] 304. Based on the first detection result and the second detection result, determine a target detection result in the sample image that can assist knowledge distillation learning.
[0077] Among them, the target detection result can also be called a general instance, which does not depend on the sample label and is independent of the ratio between positive and negative samples. It is adaptively selected by the output of the teacher model and the student model, and then the selected general instance is used to extract feature-based knowledge, relationship-based knowledge, and response-based knowledge for knowledge distillation, which can make the knowledge transfer in knowledge distillation more effective. The present application can use the general instance selection module to determine the target detection result.
[0078] Since the information of data annotation related areas and background areas are helpful for knowledge distillation, and the existing technology only processes data annotation related areas, it may ignore the potential information in the image background. Therefore, this application hopes to construct target detection results containing rich information and use the relationship information between these target detection results for modeling, so as to achieve the purpose of considering not only gesture related areas but also other information-rich areas in the image. Optionally, in one embodiment, the step of "determining target detection results in the sample image that can help knowledge distillation learning based on the first detection result and the second detection result" may include:
[0079] Based on the difference between the first detection result and the second detection result, determining a plurality of initial target detection frames and initial difference information corresponding to the initial target detection frames in the sample image;
[0080] Based on the initial difference information, a preset number of target detection results are selected from a number of initial target detection frames.
[0081] Since in the detection network model, the prediction results usually point to meaningful areas, the difference between the detection results of the teacher model and the student model is closely related to the model performance. In order to quantify the difference of each detection result and then select the discriminative target detection results for distillation, this application proposes two indicators: the initial target detection box and the initial difference information. In each training process, these two parameters are dynamically calculated.
[0082] Among them, the initial target detection box (Hand box) is a regression box retained as required among several regression boxes obtained by detecting the teacher model and the student model.
[0083] Among them, the initial difference information (Hand score) is the difference information between the prediction results of the teacher model and the student model.
[0084] For example, Figure 6 As shown, a plurality of initial target detection frames and initial difference information corresponding to the initial target detection frames can be determined in the sample image according to the difference between the first detection result and the second detection result. Then, a preset number of target detection results are selected from the plurality of initial target detection frames according to the initial difference information.
[0085] Optionally, in one embodiment, the step of “determining a plurality of initial target detection frames and initial difference information corresponding to the initial target detection frames in the sample image based on the difference between the first detection result and the second detection result” may include:
[0086] Determining a plurality of initial object detection frames from the first prediction frame and the second prediction frame based on a score numerical relationship between the first prediction score and the second prediction score;
[0087] Based on the first prediction score and the score difference relationship between the second prediction score, initial difference information corresponding to the initial object detection box is determined.
[0088] The first detection result includes a number of first prediction boxes and a number of first prediction scores corresponding to the detection categories; the second detection result includes a number of second prediction boxes and a number of second prediction scores corresponding to the detection categories. Since the present application sets the detection heads of the teacher model and the student model in the same way, the two networks can predict R equal prediction boxes, and the positions of the prediction boxes correspond one to one.
[0089] In order to obtain the target detection result with the most information and save computing resources during training, the present application can calculate the L1 distance between the prediction scores of the teacher model and the student model as the initial difference information, and retain the regression frame with a higher prediction score as the target detection frame. For example, as shown in Formula 1, several initial target detection frames can be determined from the first prediction frame and the second prediction frame according to the numerical relationship between the first prediction score and the second prediction score, where Formula 1 can be as follows:
[0090]
[0091] in, is the initial target detection box, is the first prediction box detected by the teacher model, is the second prediction box detected by the student model, is the first prediction score predicted by the teacher model, is the second predicted score predicted by the student model, and and Correspondingly, and Correspondingly. C is the number of detection categories, R is the number of prediction boxes, r and c are the indicators on the R and C dimensions, and 0 <c≤C,0<r≤R。
[0092] According to formula 1, if the first prediction score predicted by the teacher model is greater than the second prediction score predicted by the student model, the first prediction box detected by the teacher model is determined as the initial target detection box; if the first prediction score predicted by the teacher model is less than or equal to the second prediction score predicted by the student model, the second prediction box detected by the student model is determined as the initial target detection box.
[0093] Then, as shown in Formula 2, the initial difference information corresponding to the initial target detection frame can be determined based on the score difference relationship between the first prediction score and the second prediction score, where Formula 2 can be as follows:
[0094]
[0095] in, is the initial difference information.
[0096] According to Formula 2, the maximum value of the difference between the first prediction score predicted by the teacher model and the second prediction score predicted by the student model can be used as the initial difference information.
[0097] In one embodiment, since the present application can be applied to models with different structures, when applied to a single-stage detector, and are the classification scores predicted by the teacher model and the student model respectively; when applied to a two-stage detector, and is the objective score predicted by RPN.
[0098] Among them, the single-stage detector can directly generate the category probability and position coordinate value of the detection target, and the final detection result can be directly obtained after a single detection.
[0099] Among them, the two-stage detector uses two stages to perform target detection. The first stage is used to determine the location where the target object appears and obtain the detection frame for the target object, thereby ensuring sufficient accuracy and recall rate; the second stage is used to classify the detection frame to determine more accurate location information.
[0100] Among them, RPN (Region Proposal Network) can be used to filter out detection boxes that may contain target objects. Its essence is a category-free target detector based on sliding windows. Its input is the image to be detected, and its output is a series of rectangular detection boxes.
[0101] Although the initial target detection box and the initial difference information are determined, the detection boxes with high initial difference information scores are likely to be highly overlapped, resulting in repeated calculation of the distillation loss. In order to handle these redundant detection boxes, the present application can use a standard non-maximum suppression method (NMS) to perform duplicate data elimination. Optionally, in one embodiment, the step of "selecting a preset number of target detection results from several initial target detection boxes based on the initial difference information" may include:
[0102] Based on the value of the initial difference information, a reference detection frame is selected from a number of initial target detection frames;
[0103] Based on the degree of overlap between the reference detection frame and other initial target detection frames, other initial target detection frames are screened to obtain a preset number of target detection results.
[0104] Among them, the essence of the non-maximum suppression algorithm (NMS) is to search for local maximum values and suppress non-maximum elements.
[0105] For example, according to the value of the initial difference information, a reference detection frame can be selected from a number of initial target detection frames through iteration using a non-maximum suppression algorithm, wherein the reference detection frame can be the initial target detection frame corresponding to the largest initial difference information. Then, according to the degree of overlap between the reference detection frame and other initial target detection frames, the other initial target detection frames are screened, and the initial target detection frames with low initial difference information values that highly overlap with the reference detection frame are deleted, thereby obtaining a preset number of target detection results, which can be K, that is, only the first K initial target detection frames with the highest scores are selected as the final target detection results for distillation.
[0106] 305. Based on the image information of the target detection result, determine the feature distillation loss, the relationship distillation loss, and the response distillation loss.
[0107] Among them, the feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0108] Optionally, in one embodiment, the step of “determining feature distillation loss, relationship distillation loss, and response distillation loss based on image information of the target detection result” may include:
[0109] Construct feature-based loss functions, relationship-based loss functions, and response-based loss functions;
[0110] Based on the image information of the target detection result, the feature-based loss function, the relationship-based loss function, and the response-based loss function, the feature distillation loss, the relationship distillation loss, and the response distillation loss are determined.
[0111] The loss function is a function of the difference between the estimated value and the true value of the data instance, and is usually used for parameter estimation. In classification tasks, the loss function is a penalty for classification errors.
[0112] For example, you can first construct a feature-based loss function, a relationship-based loss function, and a response-based loss function, and use the above loss functions and the image information of the target detection results to determine the feature distillation loss, the relationship distillation loss, and the response distillation loss.
[0113] Optionally, in one embodiment, the step of “determining a feature distillation loss and a relationship distillation loss based on image information of the target detection result, a feature-based loss function, and a relationship-based loss function” may include:
[0114] Based on the image information of the target detection result, extract the teacher image features from the teacher model, and extract the student image features from the student model;
[0115] According to the feature-based loss function, the relationship-based loss function, the teacher image features, and the student image features, the feature distillation loss and the relationship distillation loss are determined.
[0116] For example, Figure 7 As shown, teacher image features can be extracted from the teacher model and student image features can be extracted from the student model based on the image information of the target detection results, and then the feature distillation loss and the relationship distillation loss can be determined based on the feature-based loss function, the relationship-based loss function, the teacher image features, and the student image features.
[0117] Since the target sizes vary greatly in the detection task, directly performing pixel-by-pixel distillation will make the model more inclined to learn larger targets. Therefore, the purpose of treating each feature equally can be achieved by adjusting features of different sizes to the same size and then performing distillation. Optionally, in one embodiment, the step of "extracting teacher image features from the teacher model and extracting student image features from the student model based on the image information of the target detection result" may include:
[0118] Extracting the features of the teacher image to be adjusted from the teacher model, and extracting the features of the student image to be adjusted from the student model;
[0119] Based on the image information of the target detection result, the size of the teacher image feature to be adjusted is adjusted to obtain the teacher image feature;
[0120] Based on the image information of the target detection result, the size of the student image feature to be adjusted is adjusted to obtain the student image feature.
[0121] Among them, FPN (Feature Pyramid Network) is a basic component of the recognition system for detecting target objects of different scales and is a universal feature extractor. Since the feature pyramid network combines the features of multiple backbone layers, it can significantly improve the robustness of multi-scale detection.
[0122] Among them, the ROI Align algorithm is a regional feature aggregation method used to solve the problem of regional mismatch.
[0123] For example, features of multiple levels and different sizes can be extracted from the teacher model, and these features can be input into the feature pyramid network for feature extraction to obtain the features of the teacher image to be adjusted. Features of multiple levels and different sizes can be extracted from the student model, and these features can be input into the feature pyramid network for feature extraction to obtain the features of the student image to be adjusted.
[0124] Since the feature sizes of the teacher image features to be adjusted and the student image features to be adjusted are different, the ROI Align algorithm can be used to adjust the size of the teacher image features to be adjusted to obtain the teacher image features, and the ROI Align algorithm can be used to adjust the size of the student image features to be adjusted to obtain the student image features, wherein the size of the teacher image features and the size of the student image features are adjusted according to the target detection results, so that the size of the teacher image features and the student image features can be the same, so that the network model will not have a bias due to different sizes during learning.
[0125] In one embodiment, after obtaining the teacher image features and the student image features of the same size, the feature distillation loss can be calculated, wherein the formula three for calculating the feature distillation loss can be as follows:
[0126]
[0127] s ′ =f adapt (s)
[0128] Where K is the number of target detection results, t i and i are the teacher image features and the student image features, f adapt Used to i Scale to t i Same size.
[0129] Since instances in the same scene are highly correlated, this related information can help the student network learn more effectively. This application has obtained information-rich target detection results, so the correlation between these target detection results can be fully utilized. In order to mine valuable relationship information between target detection results, this application further introduces relationship distillation loss. Optionally, in one embodiment, the step of "determining the relationship distillation loss based on the relationship-based loss function, teacher image features, and student image features" may include:
[0130] Determine the first relation distillation loss based on the relation-based loss function and the Euclidean distance between teacher image features;
[0131] Determine the second relation distillation loss based on the relation-based loss function and the Euclidean distance between the student image features;
[0132] A relation distillation loss is determined based on the first relation distillation loss and the second relation distillation loss.
[0133] For example, the present application can use Euclidean distance to express the correlation between instances, and use the correlation information between target detection results to extract information from the teacher model to train the student model. Formula 4 for calculating the relational distillation loss can be shown as follows:
[0134]
[0135]
[0136] in, Φ(x) is the normalization factor of the distance and l represents the smoothed L1 loss.
[0137] The first relation distillation loss is The second relation distillation loss is
[0138] Due to the imbalance of positive and negative samples in the detection task and the excessive noise introduced by negative samples, distilling the output of the detection head is detrimental to the performance of the student model. Therefore, the present application designs a distillation mask for the classification branch and the regression branch based on the selected target detection result. Optionally, in one embodiment, the step of "determining the response distillation loss based on the image information of the target detection result and the loss function based on the response" may include:
[0139] Determine the operating conditions of the image mask according to the model structure of the teacher model;
[0140] Determine the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model;
[0141] A response distillation loss is determined based on the operational conditions of the image mask, the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model.
[0142] Among them, image mask is an operation in deep learning, which is equivalent to covering the original tensor with a mask to shield or select certain specific elements.
[0143] For example, Figure 8 As shown, the operation conditions of the image mask can be determined according to the model structure of the teacher model, that is, different teacher models can set different image mask operation conditions, wherein the formula five for calculating the image mask can be as follows:
[0144] M=F Assign (GIs)
[0145] Among them, the function F is the operation condition of the image mask determined according to the model structure of the teacher model. Its input is the target detection result. When the output pixel matches the target detection result, its output is 1; when it does not match, its output is 0.
[0146] Optionally, in one embodiment, the step of “determining the response distillation loss based on the operating conditions of the image mask, the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model” may include:
[0147] Determine the first response distillation loss based on the classification loss function corresponding to the teacher model, the classification output of the teacher model, and the classification output of the student model;
[0148] Determine a second response distillation loss based on the regression loss function corresponding to the teacher model, the regression output of the teacher model, and the regression output of the student model;
[0149] A response distillation loss is determined based on the operating condition of the image mask, the first response distillation loss, and the second response distillation loss.
[0150] For example, the formula for calculating the response distillation loss can be as follows:
[0151]
[0152]
[0153] Among them, y t is the classification output of the teacher model, y s is the classification output of the student model, r t is the regression output of the teacher model, r sis the regression output of the student model, L cls is the classification loss function corresponding to the teacher model, L reg is the regression loss function corresponding to the teacher model, is the first response distillation loss, is the second response distillation loss.
[0154] 306. Based on feature distillation loss, relation distillation loss, and response distillation loss, the student model training is guided to obtain a gesture detection model.
[0155] For example, the formula for calculating the total loss can be as follows:
[0156] L=L GT +λ1L Feature +λ2L Relation +λ3L Response
[0157] Among them, L GT is the task loss of the detection model, and λ1, λ2, λ3 are hyperparameters that balance each loss on the same scale.
[0158] 203. Perform gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result.
[0159] 204. In response to the gesture detection result, perform an interactive operation in the virtual reality scene.
[0160] In one embodiment, the technical solution of the present application can be applied to virtual reality game scenes, because virtual reality can replace the user's vision and hearing with a virtual environment, thereby providing the user with an immersive game experience. In the virtual reality game scene, a camera can be installed on the headset to capture, and the technical solution of the present application can be used to detect the user's gestures in the image captured by the camera and estimate their postures. Using this method, it is possible to understand the position of the user's hands in the game, the posture of the hands, and what the hands are doing. In particular, using gesture detection technology, game content developers can also add multiple gameplay and interactive experiences when creating content.
[0161] For example, in the game, users can use gestures to emit rays to remotely select elements in the game, or users can touch elements in the game to select them through gestures; or users can use gestures to manipulate elements in the game to enlarge, reduce, move, etc.; or users can say hello in the game by waving gestures, and show politeness by making a "please" gesture; or users can use gestures to draw circles in the air to display corresponding magic effects in the game interface, etc.
[0162] In one embodiment, gesture detection can also be divided into gesture detection of different degrees. For example, detection performed only on the arms is for content that can be expressed only with the arms, such as pointing in a certain direction; detection performed on the arms, palms, fingers, etc. is for gestures that require detailed recognition, such as rock-paper-scissors.
[0163] In addition, the technical solution of the present application can also be applied to other virtual reality scenarios. For example, it can be applied to smart office scenarios. Gesture detection can be used to complete the presentation of report plans through specific gestures such as zooming in, zooming out, and dragging, thereby improving the convenience of office work. For example, it can also be applied to smart teaching scenarios. Gesture detection can be used to complete the disassembly, assembly, and combination of teaching courseware, and complete operational interactions more conveniently and effectively, etc.
[0164] The current method of using knowledge distillation for detection has weak generalization ability for different detection frameworks and is heavily dependent on data annotation, thus ignoring valuable relationship information between instances. However, when using the technical solution of the present application to perform detection tasks, there is no need to consider positive and negative samples, and full use is made of feature-based, relationship-based, and response-based knowledge for distillation. The use of the technical solution of the present application can significantly improve the performance of the student model, and the detection effect is better than the teacher model in various detection frameworks. In addition, the detection using knowledge distillation in the prior art cannot be applied to multiple detection frameworks, while the target detection results in the technical solution of the present application are calculated based on the outputs of the teacher model and the student model, so that it does not rely on certain modules of a specific detector or certain key features of a specific detection framework, and can be used in multiple detection frameworks, greatly improving the versatility of the solution.
[0165] As can be seen from the above, the embodiment of the present application obtains an image to be detected collected by a virtual reality device, and obtains a gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using a trained teacher model according to feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model. The gesture detection model is used to perform gesture detection on the image to be detected to obtain a gesture detection result, and in response to the gesture detection result, an interactive operation is performed in the virtual reality scene.
[0166] This application determines several target detection results for knowledge distillation, making the knowledge transfer more effective. It also considers the relationship information between instances in the same image and combines it with feature-based knowledge and response-based knowledge, so that the detection effect of the student model exceeds that of the teacher model, thereby improving the gesture detection ability of the gesture detection model in the virtual reality scene. At the same time, this application does not need to manually set the ratio of positive and negative samples, nor does it need to select sample annotation related areas for distillation. Since this application determines target detection results in the sample image that can help knowledge distillation learning, these target detection results describe different areas with rich information in the sample image, and use the relationship information between these target detection results for modeling, on the one hand, it can avoid selecting only the area near the sample annotation for knowledge distillation, thereby ignoring useful information from the image background, and on the other hand, it can use the relationship information between these target detection results to consider the relationship information between different areas in the sample image, thereby achieving the purpose of improving the model effect. In addition, the technical solution of this application can also be applied to a variety of detection frameworks and has strong robustness.
[0167] The present application also provides a method for detecting gestures in a virtual reality scene. Figure 4 As shown, the specific process of the gesture detection method in the virtual reality scene can be as follows:
[0168] 401. An electronic device obtains a sample image.
[0169] The technical solution of this application can be applied to human-computer interaction operations in virtual reality scenarios, and can also be applied to other gesture detection scenarios, such as assisted driving, smart home, smart wearable and other human-computer interaction scenarios. Figure 5 The figure shows a schematic diagram of the training process of the gesture detection model.
[0170] 402. The electronic device performs gesture detection on the sample image using the trained teacher model to obtain a first detection result.
[0171] For example, a self-distillation strategy can be adopted, and the teacher model and the student model use the same network structure, which requires less memory and has higher training efficiency. In addition, gesture detection is based on target detection. Under the same hardware conditions, a larger sample batch size can be set, which will have a benefit on target detection.
[0172] In one embodiment, multiple cycles of self-distillation may also be employed.
[0173] 403. The electronic device performs gesture detection on the sample image through the student model to obtain a second detection result, and the student model and the teacher model have the same network model structure.
[0174] 404. The electronic device determines, in the sample image, a target detection result that can assist in knowledge distillation learning based on the first detection result and the second detection result.
[0175] In the gesture detection task, the prediction output of the detection model represents an important area with rich information. The difference between these areas directly affects the performance difference between the teacher model and the student model. That is, the features near the gesture area and the features from the background are both important for knowledge distillation learning. Therefore, this application can determine several target detection results while considering the features near the gesture area and the features from the background.
[0176] For example, the Hand score and Hand box can be used to quantify the differences between different gestures and filter out target detection results during the training phase. Specifically, the Hand score can be obtained by calculating the L1 distance between the prediction scores of the teacher model and the student model, and then the detection box with a higher Hand score value is selected as the Hand box. The specific definition is as follows:
[0177]
[0178]
[0179] in, For Hand box, For Hand score, is the first prediction box detected by the teacher model, is the second prediction box detected by the student model, is the first prediction score predicted by the teacher model, is the second predicted score predicted by the student model, and and Correspondingly, and Correspondingly. C is the number of detection categories, R is the number of prediction boxes, r and c are the indicators on the R and C dimensions, and 0 <c≤C,0<r≤R。
[0180] Since target detection results with higher Hand score values often have highly overlapping prediction boxes, which will lead to repeated calculation of distillation loss and reduce learning efficiency, the NMS algorithm can be used to remove duplicates and select the target detection result with the highest Hand score value for loss calculation.
[0181] H = NMS(P H ,B H )
[0182] 405. The electronic device determines a feature distillation loss, a relationship distillation loss, and a response distillation loss based on the image information of the target detection result.
[0183] In order to better utilize the knowledge of the teacher model, the student model is supervised and guided using feature distillation loss, relation distillation loss, and response distillation loss:
[0184] 1) Feature distillation loss
[0185] The feature learning of the gesture detection model is based on the FPN feature pyramid network. The FPN network can learn effective features of different scales, thereby significantly improving the robustness of the detection model to multi-scale targets. However, since the output feature sizes of each layer of the FPN network are different, directly performing pixel-level knowledge distillation on them will cause the model to be more inclined to targets with larger areas. Therefore, the ROI Align algorithm can be used to convert feature outputs of different sizes to the same size, and then perform distillation learning. The feature distillation loss function is as follows:
[0186]
[0187] s ′ =f adapt (s)
[0188] Where K is the number of target detection results, t i and i are the teacher image features and the student image features, f adapt Used to i Scale to t i Same size.
[0189] 2) Relationship Distillation Loss
[0190] Since there is highly correlated information between different gestures in the same scene, as well as between the foreground and background of gestures, this information is of great significance to the training of the student model. Therefore, the relationship between different gestures and the relationship between hands and non-hands are the key to the success of distillation for classification tasks. Therefore, the relationship between different gestures such as left and right hands in the same picture can be modeled. The relationship distillation loss function is as follows:
[0191]
[0192]
[0193] in, Φ(x) is the normalization factor of the distance and l represents the smoothed L1 loss.
[0194] 3) Response to distillation loss
[0195] Response-based knowledge refers to the final output of the teacher model. The key to the success of knowledge distillation is to rely on the constraints of the teacher model's response-based knowledge. In practical applications, due to the imbalance of positive and negative samples in the output of the detection model, or too many negative samples, if all the outputs of the detection head are directly distilled, the noise caused by this phenomenon will reduce the performance of the student model, especially in gesture detection scenarios, where the imbalance of positive and negative samples is more serious. In order to solve this problem, the classification branch and regression branch of the detection model can be screened using modules selected based on target detection results:
[0196] M=F Assign (GIs)
[0197] Among them, the function F is the operation condition of the image mask determined according to the model structure of the teacher model. Its input is the hand box. When the prediction results of the teacher model match those of the student model, its output is 1; when they do not match, its output is 0.
[0198] The response distillation loss function is as follows:
[0199]
[0200]
[0201] Among them, y t is the classification output of the teacher model, y s is the classification output of the student model, r t is the regression output of the teacher model, r s is the regression output of the student model, L cls is the classification loss function corresponding to the teacher model, L reg is the regression loss function corresponding to the teacher model.
[0202] The loss function of the model is as follows:
[0203] L=L GT +λ1L Feature +λ2L Relation +λ3L Response
[0204] Among them, L GT is the original loss function of the detection model, and λ1>0, λ2>0, and λ3>0 are balanced hyperparameters.
[0205] In the gesture detection scenario, due to the obvious imbalance between positive and negative samples, the weights of the feature distillation loss function, the relationship distillation loss function, and the response distillation loss function are specially optimized. Specifically, the hyperparameters λ1 and λ2 are greatly increased, so that the student model focuses on learning the relationship between gesture features and different gestures.
[0206] 406. The electronic device guides the student model training based on feature distillation loss, relationship distillation loss, and response distillation loss to obtain a gesture detection model.
[0207] 407. The electronic device obtains the image to be detected collected by the virtual reality device.
[0208] 408. The electronic device obtains a gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using a trained teacher model according to feature distillation loss, relationship distillation loss, and response distillation loss, wherein the feature distillation loss is obtained based on the difference between features of the teacher model and features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0209] 409. The electronic device performs gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result.
[0210] 410. The electronic device performs an interactive operation in the virtual reality scene in response to the gesture detection result.
[0211] For example, the gesture detection model can be used to recognize different gestures, and human-computer interaction can be performed by selecting different functions in a virtual reality scene; or the gesture detection model can be used to recognize gestures to realize the human-computer interaction process of pressing buttons in a virtual reality scene.
[0212] In order to verify the effectiveness of the technical solution of this application, an experiment can be conducted on a self-owned gesture detection dataset. The experimental results show that good performance has been achieved in important indicators of target detection: the precision is improved by about 1 point, and the recall rate is improved by about 4 points. Fig. 9 As shown in the figure, as the training optimization proceeds, the loss function of the student model shows a downward trend, and the loss is smaller than that of the teacher model from the 14th iteration. This shows that the self-distillation strategy uses feature distillation loss, relationship distillation loss, and response distillation loss for knowledge distillation, achieving lower losses and better performance than the teacher model.
[0213] Among them, the technical solution of this application applies a knowledge distillation algorithm for gesture detection, and effectively improves the performance of gesture detection by comprehensively utilizing information based on basic gesture features, relationships between different gestures, responses between different gestures, and other information for distillation learning. In addition, although the areas related to gestures contain rich information, the background areas also contain information that is helpful to the student model. Using the technical solution of this application, there is no need to distinguish between positive and negative samples, no need to manually set the ratio of positive and negative samples, and no need to select only areas related to gestures for distillation.
[0214] As can be seen from the above, the embodiment of the present application obtains a sample image through an electronic device, performs gesture detection on the sample image through a trained teacher model to obtain a first detection result, performs gesture detection on the sample image through a student model to obtain a second detection result, the student model and the teacher model have the same network model structure, and based on the first detection result and the second detection result, determines a target detection result that can assist in knowledge distillation learning in the sample image, determines feature distillation loss, relationship distillation loss, and response distillation loss based on image information of the target detection result, guides student model training based on the feature distillation loss, relationship distillation loss, and response distillation loss, obtains an image to be detected collected by a virtual reality device, obtains a gesture detection model, performs gesture detection on the image to be detected through the gesture detection model to obtain a gesture detection result, and performs interactive operations in a virtual reality scene in response to the gesture detection result.
[0215] This application determines several target detection results for knowledge distillation, making the knowledge transfer more effective. It also considers the relationship information between instances in the same image and combines it with feature-based knowledge and response-based knowledge, so that the detection effect of the student model exceeds that of the teacher model, thereby improving the gesture detection ability of the gesture detection model in the virtual reality scene. At the same time, this application does not need to manually set the ratio of positive and negative samples, nor does it need to select sample annotation related areas for distillation. Since this application determines target detection results in the sample image that can help knowledge distillation learning, these target detection results describe different areas with rich information in the sample image, and use the relationship information between these target detection results for modeling, on the one hand, it can avoid selecting only the area near the sample annotation for knowledge distillation, thereby ignoring useful information from the image background, and on the other hand, it can use the relationship information between these target detection results to consider the relationship information between different areas in the sample image, thereby achieving the purpose of improving the model effect. In addition, the technical solution of this application can also be applied to a variety of detection frameworks and has strong robustness.
[0216] In order to better implement the gesture detection method in a virtual reality scene provided by the embodiment of the present application, the embodiment of the present application also provides a gesture detection device in a virtual reality scene based on the gesture detection method in the virtual reality scene. The meanings of the terms are the same as those in the gesture detection method in the virtual reality scene. For specific implementation details, please refer to the description in the above method embodiment.
[0217] Please refer to Fig.10 , Fig.10 This is a schematic diagram of the structure of a gesture detection device in a virtual reality scene provided in an embodiment of the present application. The gesture detection device in the virtual reality scene may include a first acquisition unit 1001, a second acquisition unit 1002, a gesture detection unit 1003, and an interaction unit 1004, wherein:
[0218] The first acquisition unit 1001 is used to acquire the image to be detected collected by the virtual reality device;
[0219] A second acquisition unit 1002 is used to acquire a gesture detection model;
[0220] The gesture detection unit 1003 is used to perform gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result;
[0221] An interaction unit 1004, configured to perform an interaction operation in a virtual reality scene in response to the gesture detection result;
[0222] Among them, the gesture detection model is obtained by self-distillation learning using a trained teacher model based on feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0223] In an optional embodiment, the gesture detection device in the virtual reality scene also includes a model training module, which is used to obtain a gesture detection model and a sample image; perform gesture detection on the sample image through a trained teacher model to obtain a first detection result; perform gesture detection on the sample image through a student model to obtain a second detection result, and the student model and the teacher model have the same network model structure; based on the first detection result and the second detection result, determine a target detection result in the sample image that can assist in knowledge distillation learning; based on the image information of the target detection result, determine the feature distillation loss, the relationship distillation loss, and the response distillation loss; based on the feature distillation loss, the relationship distillation loss, and the response distillation loss, guide the student model training to obtain a gesture detection model.
[0224] In an optional embodiment, the model training module is used to determine a number of initial target detection frames and initial difference information corresponding to the initial target detection frames in the sample image based on the difference between the first detection result and the second detection result; and based on the initial difference information, select a preset number of target detection results from the several initial target detection frames.
[0225] In an optional embodiment, the model training module is used to determine a number of initial target detection frames from the first prediction frame and the second prediction frame based on the numerical relationship between the first prediction score and the second prediction score; and determine initial difference information corresponding to the initial target detection frame based on the score difference relationship between the first prediction score and the second prediction score.
[0226] In an optional embodiment, the model training module is used to select a reference detection frame from several initial target detection frames based on the numerical value of the initial difference information; based on the degree of overlap between the reference detection frame and other initial target detection frames, the other initial target detection frames are screened to obtain a preset number of target detection results.
[0227] In an optional embodiment, the model training module is used to construct a feature-based loss function, a relationship-based loss function, and a response-based loss function; based on the image information of the target detection result, the feature-based loss function, the relationship-based loss function, and the response-based loss function, the feature distillation loss, the relationship distillation loss, and the response distillation loss are determined.
[0228] In an optional embodiment, the model training module is used to extract teacher image features from the teacher model and student image features from the student model based on the image information of the target detection result; and determine the feature distillation loss and the relationship distillation loss based on the feature-based loss function, the relationship-based loss function, the teacher image features, and the student image features.
[0229] In an optional embodiment, the model training module is used to extract the teacher image features to be adjusted from the teacher model, and to extract the student image features to be adjusted from the student model; based on the image information of the target detection result, the size of the teacher image features to be adjusted is adjusted to obtain the teacher image features; based on the image information of the target detection result, the size of the student image features to be adjusted is adjusted to obtain the student image features.
[0230] In an optional embodiment, the model training module is used to determine a first relational distillation loss based on the relation-based loss function and the Euclidean distance between the teacher image features; determine a second relational distillation loss based on the relation-based loss function and the Euclidean distance between the student image features; and determine the relational distillation loss based on the first relational distillation loss and the second relational distillation loss.
[0231] In an optional embodiment, the model training module is used to determine the operating conditions of the image mask according to the model structure of the teacher model; determine the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model; and determine the response distillation loss based on the operating conditions of the image mask, the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model.
[0232] In an optional embodiment, the model training module is used to determine a first response distillation loss based on a classification loss function corresponding to the teacher model, the classification output of the teacher model, and the classification output of the student model; determine a second response distillation loss based on a regression loss function corresponding to the teacher model, the regression output of the teacher model, and the regression output of the student model; and determine the response distillation loss based on an operating condition of the image mask, the first response distillation loss, and the second response distillation loss.
[0233] The specific implementation of each of the above modules can be found in the previous embodiments and will not be described in detail here.
[0234] In this embodiment, the first acquisition unit 1001 first acquires the image to be detected collected by the virtual reality device, and the second acquisition unit 1002 acquires the gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using a trained teacher model according to feature distillation loss, relationship distillation loss, and response distillation loss, wherein the feature distillation loss is obtained according to the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained according to the relationship between different regions in the same image, and the response distillation loss is obtained according to the difference between the output of the teacher model and the output of the gesture detection model, and the gesture detection unit 1003 performs gesture detection on the image to be detected through the gesture detection model to obtain a gesture detection result, and the interaction unit 1004 performs an interactive operation in the virtual reality scene in response to the gesture detection result.
[0235] This application determines several target detection results for knowledge distillation, making the knowledge transfer more effective. It also considers the relationship information between instances in the same image and combines it with feature-based knowledge and response-based knowledge, so that the detection effect of the student model exceeds that of the teacher model, thereby improving the gesture detection ability of the gesture detection model in the virtual reality scene. At the same time, this application does not need to manually set the ratio of positive and negative samples, nor does it need to select sample annotation related areas for distillation. Since this application determines target detection results in the sample image that can help knowledge distillation learning, these target detection results describe different areas with rich information in the sample image, and use the relationship information between these target detection results for modeling, on the one hand, it can avoid selecting only the area near the sample annotation for knowledge distillation, thereby ignoring useful information from the image background, and on the other hand, it can use the relationship information between these target detection results to consider the relationship information between different areas in the sample image, thereby achieving the purpose of improving the model effect. In addition, the technical solution of this application can also be applied to a variety of detection frameworks and has strong robustness.
[0236] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the steps of the gesture detection method in a virtual reality scene provided by this embodiment by calling a computer program stored in the memory.
[0237] Please refer to Fig.11 , Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0238] The electronic device may include components such as a processor 1101 with one or more processing cores, a memory 1102 with one or more computer-readable storage media, a power supply 1103, and an input unit 1104. Those skilled in the art will appreciate that Fig.11The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0239] The processor 1101 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 1102, and calling data stored in the memory 1102, the processor 1101 performs various functions of the electronic device and processes data. Optionally, the processor 1101 may include one or more processing cores; optionally, the processor 1101 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1101.
[0240] The memory 1102 can be used to store software programs and modules. The processor 1101 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102. The memory 1102 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 (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1102 may also include a memory controller to provide the processor 1101 with access to the memory 1102.
[0241] The electronic device also includes a power supply 1103 for supplying power to each component. Optionally, the power supply 1103 can be logically connected to the processor 1101 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1103 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0242] The electronic device may further include an input unit 1104, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0243] Although not shown, the electronic device may also include a display unit, an image acquisition component, etc., which will not be described in detail here. Specifically in this embodiment, the processor 1101 in the electronic device will load the executable code corresponding to one or more computer programs into the memory 1102 according to the following instructions, and the processor 1101 will execute the steps in the gesture detection method in the virtual reality scene provided by the present application, such as:
[0244] Acquire the image to be detected collected by the virtual reality device;
[0245] Get the gesture detection model;
[0246] Performing gesture detection on the image to be detected by using the gesture detection model to obtain a gesture detection result;
[0247] In response to the gesture detection result, performing an interactive operation in the virtual reality scene;
[0248] Among them, the gesture detection model is obtained by self-distillation learning using a trained teacher model based on feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
[0249] It should be noted that the electronic device provided in the embodiment of the present application and the gesture detection method in the virtual reality scene in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above related embodiments and will not be repeated here.
[0250] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program stored therein is executed on the processor of the electronic device provided in the embodiment of the present application, the processor of the electronic device executes the steps in the gesture detection method in the virtual reality scene provided in the present application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0251] The present application also provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes various optional implementations of the above-mentioned gesture detection method in a virtual reality scene.
[0252] The above is a detailed introduction to a gesture detection method in a virtual reality scene and related equipment provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for detecting gestures in a virtual reality scene, characterized in that: The method comprises: Obtaining the image to be detected collected by the virtual reality device; Get the gesture detection model; Performing gesture detection on the image to be detected using the gesture detection model to obtain a gesture detection result; performing an interactive operation in the virtual reality scene in response to the gesture detection result; Among them, the gesture detection model is obtained by self-distillation learning using a trained teacher model based on feature distillation loss, relationship distillation loss, and response distillation loss. The feature distillation loss is obtained based on the difference between the features of the teacher model and the features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model.
2. The method according to claim 1, characterized in that Before acquiring the image to be detected collected by the virtual reality device, the method further includes: Get a sample image; Performing gesture detection on the sample image using a trained teacher model to obtain a first detection result; Performing gesture detection on the sample image using a student model to obtain a second detection result, wherein the student model and the teacher model have the same network model structure; Based on the first detection result and the second detection result, determining a target detection result in the sample image that can assist in knowledge distillation learning; Determining the feature distillation loss, the relationship distillation loss, and the response distillation loss based on image information of the target detection result; Based on the feature distillation loss, the relationship distillation loss, and the response distillation loss, the student model training is guided to obtain a gesture detection model.
3. The method according to claim 2, characterized in that Determining, based on the first detection result and the second detection result, a target detection result in the sample image that can assist in knowledge distillation learning includes: determining, in the sample image, a plurality of initial object detection frames and initial difference information corresponding to the initial object detection frames based on a difference between the first detection result and the second detection result; Based on the initial difference information, a preset number of target detection results are selected from the initial target detection frames.
4. The method according to claim 3, characterized in that The first detection result includes a plurality of first prediction frames and first prediction scores corresponding to a plurality of detection categories, the second detection result includes a plurality of second prediction frames and second prediction scores corresponding to a plurality of detection categories, and determining a plurality of initial target detection frames and initial difference information corresponding to the initial target detection frames in the sample image based on a difference between the first detection result and the second detection result includes: Determining a plurality of initial object detection frames from the first prediction frame and the second prediction frame based on a numerical relationship between the first prediction score and the second prediction score; Based on the score difference relationship between the first prediction score and the second prediction score, initial difference information corresponding to the initial object detection box is determined.
5. The method according to claim 3, characterized in that The selecting a preset number of target detection results from the initial target detection frames based on the initial difference information includes: Selecting a reference detection frame from the initial target detection frames based on a value of the initial difference information; Based on the degree of overlap between the reference detection frame and the other initial target detection frames, the other initial target detection frames are screened to obtain a preset number of target detection results.
6. The method according to claim 2, characterized in that The determining the feature distillation loss, the relationship distillation loss, and the response distillation loss based on the image information of the target detection result includes: Construct feature-based loss functions, relationship-based loss functions, and response-based loss functions; The feature distillation loss, the relationship distillation loss, and the response distillation loss are determined based on the image information of the target detection result, the feature-based loss function, the relationship-based loss function, and the response-based loss function.
7. The method according to claim 6, characterized in that The determining of the feature distillation loss and the relationship distillation loss based on the image information of the target detection result, the feature-based loss function, and the relationship-based loss function includes: extracting teacher image features from the teacher model and student image features from the student model based on the image information of the target detection result; The feature distillation loss and the relationship distillation loss are determined based on the feature-based loss function, the relationship-based loss function, the teacher image features, and the student image features.
8. The method according to claim 7, characterized in that The extracting of teacher image features from the teacher model and student image features from the student model based on the image information of the target detection result includes: Extracting the teacher image features to be adjusted from the teacher model, and extracting the student image features to be adjusted from the student model; Adjusting the size of the to-be-adjusted teacher image feature based on the image information of the target detection result to obtain the teacher image feature; Based on the image information of the target detection result, the size of the student image feature to be adjusted is adjusted to obtain the student image feature.
9. The method according to claim 7, characterized in that The relationship-based loss function, the teacher image features, and the student image features determine the relationship distillation loss, including: determining a first relational distillation loss based on the relation-based loss function and the Euclidean distance between the teacher image features; determining a second relational distillation loss based on the relation-based loss function and the Euclidean distance between the student image features; The relational distillation loss is determined based on the first relational distillation loss and the second relational distillation loss.
10. The method according to claim 6, characterized in that The determining the response distillation loss based on the image information of the target detection result and the response-based loss function includes: determining an operating condition of the image mask according to the model structure of the teacher model; Determining a classification output of the teacher model, a regression output of the teacher model, a classification output of the student model, and a regression output of the student model; The response distillation loss is determined based on an operational condition of the image mask, a classification output of the teacher model, a regression output of the teacher model, a classification output of the student model, and a regression output of the student model.
11. The method according to claim 10, characterized in that Determining the response distillation loss based on the operating conditions of the image mask, the classification output of the teacher model, the regression output of the teacher model, the classification output of the student model, and the regression output of the student model includes: Determining a first response distillation loss based on a classification loss function corresponding to the teacher model, a classification output of the teacher model, and a classification output of the student model; Determining a second response distillation loss based on the regression loss function corresponding to the teacher model, the regression output of the teacher model, and the regression output of the student model; The response distillation loss is determined based on an operation condition of the image mask, the first response distillation loss, and the second response distillation loss.
12. A gesture detection device in a virtual reality scene, characterized in that: include: A first acquiring unit is used to acquire an image to be detected collected by a virtual reality device; a second acquisition unit, configured to acquire a gesture detection model, wherein the gesture detection model is obtained by self-distillation learning using a trained teacher model according to a feature distillation loss, a relationship distillation loss, and a response distillation loss, wherein the feature distillation loss is obtained based on the difference between features of the teacher model and features of the gesture detection model, the relationship distillation loss is obtained based on the relationship between different regions in the same image, and the response distillation loss is obtained based on the difference between the output of the teacher model and the output of the gesture detection model; a gesture detection unit, configured to perform gesture detection on the image to be detected using the gesture detection model to obtain a gesture detection result; An interaction unit is configured to perform an interaction operation in a virtual reality scene in response to the gesture detection result.
13. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program in the memory to execute the steps of the method for detecting gestures in a virtual reality scene according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plurality of instructions, which are suitable for being loaded by a processor to execute the steps of the gesture detection method in a virtual reality scene according to any one of claims 1 to 11.
15. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the gesture detection method in a virtual reality scene according to any one of claims 1 to 11 are implemented.
