Method and device for identifying bounding box in image, storage medium and electronic equipment
By using the Kalman filter and key point detection model to predict and correct bounding boxes in virtual reality devices, the problem of low detection efficiency caused by complex calculations of the neural network model is solved, and more efficient bounding box detection is achieved.
Patent Information
- Application Number
- CN202310261881.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-09-10
AI Technical Summary
In virtual reality devices, the neural network model has high computational complexity when used to identify bounding boxes in images, resulting in low detection efficiency and difficulty in meeting practical application needs.
The Kalman filter and key point detection model are used to reduce computational complexity and improve detection efficiency by predicting and correcting bounding boxes.
Compared with the neural network model, the combination of the Kalman filter and the key point detection model reduces resource occupation, improves the efficiency of bounding box detection, and solves the problem of low detection efficiency.
Smart Images

Figure CN118628709A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method and device for identifying a bounding box in an image, a storage medium, and an electronic device. Background Art
[0002] In the application scenarios of virtual reality devices, it is usually necessary to recognize human movements, for example, to recognize hand gestures. By performing convolution operations on images taken by virtual reality devices through neural network models, the palm bounding box in the image can be recognized, and the recognition accuracy of neural network models is relatively high. However, the computational complexity of neural network models is relatively high, more resources are required, and the computational time is relatively long, which makes it difficult to meet the actual application of virtual reality.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] Embodiments of the present application provide a method and apparatus for identifying a bounding box in an image, a storage medium, and an electronic device, so as to at least solve the technical problem of low efficiency in detecting a bounding box in an image.
[0005] According to one aspect of an embodiment of the present application, a method for identifying a bounding box in an image is provided, comprising: predicting a bounding box in a k-th frame image through a Kalman filter corrected for the k-1th time to obtain a predicted bounding box for the k-th frame, wherein k is greater than or equal to 1, and the Kalman filter corrected for the 0th time is an uncorrected Kalman filter; detecting key points in the predicted bounding box of the k-th frame using a key point detection model to obtain a plurality of key points in the predicted bounding box of the k-th frame, and confidences corresponding to the plurality of key points; when the confidence is greater than or equal to a preset threshold, inferring the observed bounding box of the k-th frame through the plurality of key points; and correcting the predicted bounding box of the k-th frame through the observed bounding box of the k-th frame to obtain a bounding box of the k-th frame in the image of the k-th frame.
[0006] Optionally, the correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image includes: determining the difference between the k-th frame observation bounding box and the k-th frame prediction bounding box as the k-th frame prediction difference; determining the k-th frame prediction error covariance by using the k-1-th frame update error covariance, wherein the k-1-th frame update error covariance is the covariance after updating the k-1-th frame prediction error covariance; and correcting the k-th frame prediction bounding box by using the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image.
[0007] Optionally, the k-th frame prediction bounding box is corrected by the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image, including: determining the Kalman gain corresponding to the k-1th corrected Kalman filter according to the k-1th frame prediction error covariance to obtain the k-th frame Kalman gain; correcting the k-th frame prediction bounding box by the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image.
[0008] Optionally, the k-th frame prediction bounding box is corrected by using the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image, including: determining the product of the k-th frame Kalman gain and the k-th frame prediction difference as a correction value; and determining the sum of the correction value and the k-th frame prediction bounding box as the k-th frame bounding box in the k-th frame image.
[0009] Optionally, after obtaining the Kalman gain of the kth frame, the method further includes: correcting the k-1th corrected Kalman filter by using the kth frame Kalman gain and the kth frame prediction error covariance to obtain the kth corrected Kalman filter, wherein the kth corrected Kalman filter is used to predict the bounding box in the k+1th frame image.
[0010] Optionally, the k-1th corrected Kalman filter is corrected by the k-th frame Kalman gain and the k-th frame prediction error covariance to obtain the k-th corrected Kalman filter, including: updating the k-th frame prediction error covariance by the k-th frame Kalman gain to obtain the k-th frame updated error covariance; determining the k+1-th frame prediction error covariance by the k-th frame updated error covariance; and determining the Kalman gain corresponding to the k-th corrected Kalman filter according to the k+1-th frame prediction error covariance.
[0011] Optionally, the k-th frame observation bounding box is obtained by reverse deducing the multiple key points, including: determining the minimum and maximum values of the horizontal coordinates, and the minimum and maximum values of the vertical coordinates among the multiple key points; the coordinates determined by the minimum value of the horizontal coordinate and the minimum value of the vertical coordinate are the upper left corner coordinates of the k-th frame observation bounding box; the coordinates determined by the maximum value of the horizontal coordinate and the maximum value of the vertical coordinate are the upper right corner coordinates of the k-th frame observation bounding box.
[0012] Optionally, the method also includes: when the confidence level is less than the preset threshold, calling a bounding box detection model; obtaining the k-th frame observation bounding box through the bounding box detection model; and correcting the k-th frame prediction bounding box through the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0013] According to another aspect of an embodiment of the present application, a device for determining a bounding box in an image is also provided, including: a prediction module, used to predict a bounding box in the kth frame image through a Kalman filter corrected for the k-1th time, to obtain a predicted bounding box of the kth frame, wherein k is greater than or equal to 1, and the Kalman filter corrected for the 0th time is an uncorrected Kalman filter; a detection module, used to detect key points in the predicted bounding box of the kth frame using a key point detection model, to obtain multiple key points in the predicted bounding box of the kth frame, and confidences corresponding to the multiple key points; a reverse inference module, used to reversely obtain an observed bounding box of the kth frame through the multiple key points when the confidence is greater than or equal to a preset threshold; and a correction module, used to correct the predicted bounding box of the kth frame through the kth observation bounding box to obtain the kth frame bounding box in the kth frame image.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned method for identifying a bounding box in an image when running.
[0015] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being 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 performs the method for identifying a bounding box in an image as described above.
[0016] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the method for identifying a bounding box in an image through the computer program.
[0017] In an embodiment of the present application, a bounding box in an image is predicted by a Kalman filter to obtain a predicted bounding box. A key point detection model is used to detect key points in the predicted bounding box, and the observed bounding box is obtained by inverse deduction through the key points. The predicted bounding box is corrected by the observed bounding box to obtain the bounding box in the image. Compared with the convolution operation of a neural network on an image, the Kalman filter and the key point detection model have low computational complexity and occupy fewer resources. The purpose of improving detection efficiency is achieved, thereby solving the technical problem of low efficiency of bounding box detection in an image. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 is a schematic diagram of an application environment of an optional method for identifying a bounding box in an image according to an embodiment of the present application;
[0020] Figure 2 is a flowchart of an optional method for a bounding box in an image according to an embodiment of the present application;
[0021] Figure 3 is an optional structural block diagram according to an embodiment of the present application;
[0022] Figure 4 is an optional flow chart according to an embodiment of the present application;
[0023] Figure 5 is a schematic diagram of an optional bounding box according to an embodiment of the present application;
[0024] Figure 6 This is another optional structural block diagram according to an embodiment of the present application. ;
[0025] Figure 7 is a schematic structural diagram of an optional device for identifying a bounding box in an image according to an embodiment of the present application;
[0026] Figure 8 is a block diagram of a computer system structure of an optional electronic device according to an embodiment of the present application;
[0027] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretation:
[0031] Extended Reality XR: It is the collective name of Virtual Reality VR, Augmented Reality AR, and Mixed Reality MR. Through wearable devices and computer technology, XR can bring the audience an environment that combines reality and virtuality and human-computer interaction.
[0032] VR (Virtual Reality) is a virtual three-dimensional world created by computer technology. It uses computers to generate a simulated environment to provide users with simulations of vision, hearing and other senses, creating a strong sense of "immersion" and "presence". Virtual reality devices are mostly in the form of helmets or glasses, providing users with a fully enclosed perspective. What users see is the real world simulated by computer technology, so it is called virtual reality.
[0033] AR (Augmented Reality) is a technology that integrates real-world information and virtual-world information. AR can superimpose the real environment and virtual information on the same screen in real time, irradiate virtual 3D content into the real world, and be perceived by human senses, thus achieving a sensory experience beyond reality. Augmented reality technology can not only effectively reflect the content of the real world, but also display virtual information content in real scenes.
[0034] MR (Mixed reality): Mixed reality technology introduces real scene information into the virtual environment, builds an interactive feedback information loop between the virtual world, the real world and the user, and enhances the realism of the user experience. It combines with real-time content rendering technology to create an immersive virtual environment. It places people in a mixed world of virtual and real world, creating a new visual environment that contains both physical entities and virtual information. The realization of mixed reality is based on a virtual environment that can interact with various things in the real world.
[0035] Kalman filtering: An algorithm that uses the linear system state equation to optimally estimate the system state through the system input and output observation data. Since the observation data includes the influence of noise and interference in the system, the optimal estimate can also be regarded as a filtering process.
[0036] Bounding box detection model: various object detection models in images in the existing technology, such as Yolo series models, RCNN series models, etc.
[0037] Bounding box: It is an algorithm to find the optimal bounding space of a discrete point set. The basic idea is to use a slightly larger geometric body with simpler characteristics (called a bounding box) to approximate a complex geometric object. It has a wide range of applications in virtual reality, computer-aided design and manufacturing, games, and robotics.
[0038] The method of identifying bounding boxes in an image of the present application can be applied to the field of image recognition, and the application scenarios include but are not limited to autonomous driving, assisted driving, virtual reality, etc. Taking virtual reality as an example, the present application can be applied to a virtual game scene of virtual reality, where the player wears a virtual reality device to enter the virtual game scene, and a three-dimensional virtual world is generated by a computer. The player can interact with virtual objects in the virtual game scene through the virtual reality device. The player's actions can be identified by the virtual reality device, and the computer maps the actions performed by the player to the virtual character corresponding to the virtual game scene, thereby realizing the interaction between the player's virtual character and other virtual objects in the virtual game scene (including but not limited to other virtual characters, virtual objects, etc.).
[0039] The present application is described below in conjunction with embodiments:
[0040] According to one aspect of an embodiment of the present application, a method for identifying a bounding box in an image is provided. Optionally, in this embodiment, the method for identifying a bounding box in an image can be applied to Figure 1 In the hardware environment composed of the server 101 and the terminal device 103 shown in FIG. Figure 1As shown, the server 101 is connected to the terminal 103 through a network, and can be used to provide services for the terminal device or the application installed on the terminal device. The application can be a virtual reality application, a video application, an instant messaging application, a browser application, a game application, etc. A database 105 can be set on the server or independently of the server to provide data storage services for the server 101, for example, a game data storage server. The above network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The terminal device 103 can be a terminal configured with an application, and can include but is not limited to at least one of the following: a virtual reality device, a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a handheld computer, a MID (Mobile Internet Devices, mobile Internet devices), a PAD, a desktop computer, a smart TV and other computer devices. The above server can be a single server, or a server cluster composed of multiple servers, or a cloud server. The application 107 using the above method for identifying the bounding box in the image is displayed through the terminal device 103 or other connected display devices.
[0041] Define the process model in the Kalman filter, where the previous state x k-1 Transition to the next state x k The formula is as follows:
[0042] x k =Fx k-1 +w k-1
[0043] Where F is the state transition matrix, acting on the previous state vector x k-1 It can be set to the following matrix, which means that the change of the state position coordinate is linearly determined by the speed, and the speed remains unchanged when there is no correction:
[0044]
[0045] where w k-1 is the process noise, which is a Gaussian distribution with a mean of 0 and a covariance of Q:
[0046] w k-1 ~N(0,Q)
[0047] In the above formula, the covariance Q is set to the following matrix according to the experimental results:
[0048]
[0049] Define the observation model that matches the process model in the Kalman filter, where the formulas for states and observations are as follows:
[0050] z k =H+v k
[0051] where z k is the observation vector, i.e. the observed bounding box coordinates:
[0052] z k =[x1,y1,x2,y2] T
[0053] H is the observation matrix, which means that the expression of the state is equivalent to the observation value. Since only the bounding box coordinates are to be evaluated, the velocity state will not be reflected in the observation:
[0054] The format of the bounding box state vector x in the Kalman filter is defined as follows:
[0055]
[0056] In the above formula, x1, y1 are the coordinates of the upper left corner of the bounding box, x2, y2 are the coordinates of the lower right corner of the bounding box, and the corresponding is the speed of the upper left corner of the bounding box, is the speed of the lower right corner of the bounding box. The units of the above variables are all pixels.
[0057]
[0058] v k is the measurement noise, which is a Gaussian distribution with a mean of 0 and a covariance of R:
[0059] v k ~N(0,R)
[0060] The covariance R in the above formula can be set to the following matrix according to the experimental results:
[0061]
[0062] Combination Figure 2 As shown, the above method for identifying bounding boxes in an image is implemented in the following steps:
[0063] S202, predicting a bounding box in the k-th frame image by using the Kalman filter corrected for the k-1th time to obtain a predicted bounding box for the k-th frame, wherein k is greater than or equal to 1, and the Kalman filter corrected for the 0th time is an uncorrected Kalman filter;
[0064] The above-mentioned bounding box can be various bounding boxes in the field of image recognition, for example, a palm bounding box for identifying gestures, a head bounding box for identifying the head, or a leg bounding box for identifying the legs. In the following embodiments of the present application, a palm bounding box is taken as an example.
[0065] S204, using a key point detection model to detect key points in the prediction bounding box of the k-th frame, to obtain a plurality of key points in the prediction bounding box of the k-th frame, and confidences corresponding to the plurality of key points;
[0066] The key point detection model may be a key point detection model in the prior art. For example, the mediapipe in the prior art may identify 21 key points of a palm and further identify gestures.
[0067] S206, when the confidence level is greater than or equal to a preset threshold, inversely inferring the observation bounding box of the kth frame through the multiple key points;
[0068] S208 , correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0069] The above is only an example and is not specifically limited in this embodiment.
[0070] The Kalman filter predicts the bounding box in the image using the following formula:
[0071]
[0072] in, is the predicted bounding box of the kth frame, is the bounding box of the k-1th frame in the k-1th frame image. When the uncorrected initial Kalman filter detects the bounding box in the first frame image, The bounding box is obtained by a bounding box detection model (a neural network model, such as a CNN convolutional model) for recognizing a previous frame image before the first frame image.
[0073] F is the state transition matrix:
[0074]
[0075] like Figure 3 The structural block diagram and Figure 4 The flowchart shown may include the following steps:
[0076] Step S101, the k-th frame image may be an image captured by a virtual reality device, the k-th frame image is used as the current frame, the k-1-th modified Kalman filter is called to predict the palm bounding box of the current frame, and the k-th frame predicts the bounding box;
[0077] Step S102, cropping a local image from the k-th frame image according to the k-th frame prediction bounding box;
[0078] Step S103, using the local image as the input of the key point model, obtaining multiple key points output by the key point model and their confidences. The multiple key points may be a matrix of (x, y) coordinates of 21 joint points of the palm;
[0079] Step S104, determining whether the confidence level is greater than or equal to a preset threshold, which can be set according to actual conditions, for example, 0.5, 0.6, 0.7, etc.;
[0080] Step S105, if the confidence C is greater than or equal to a preset threshold, then inversely calculate the bounding box from the multiple key points to obtain the k-th frame observation bounding box;
[0081] Step S106, correcting the predicted bounding box of the kth frame by using the observed bounding box of the kth frame, and using the corrected bounding box of the kth frame as the bounding box of the palm in the kth frame image.
[0082] In the above embodiment, a bounding box detection model (a neural network model in the prior art, such as a CNN convolution model) can be used to give the two-dimensional coordinates of the initial palm bounding box, and the bounding box is used to update the Kalman filter. The subsequent frames directly use the Kalman filter to predict the bounding box, crop the image according to the predicted bounding box, input the key point model for key point detection, and then use the key point model output coordinates to inversely calculate an observed bounding box of the palm, and use the observed bounding box to correct the Kalman filter, thereby forming a closed loop. The bounding box detection model is run again only when the credibility of the key point model prediction output is lower than the threshold. This can avoid the need for the bounding box detection model in the prior art to detect the bounding box in each frame of the image, thereby saving resources and achieving high efficiency.
[0083] Optionally, the correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image includes: determining the difference between the k-th frame observation bounding box and the k-th frame prediction bounding box as the k-th frame prediction difference; determining the k-th frame prediction error covariance by using the k-1-th frame update error covariance, wherein the k-1-th frame update error covariance is the covariance after updating the k-1-th frame prediction error covariance; and correcting the k-th frame prediction bounding box by using the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image.
[0084] Optionally, the k-th frame prediction bounding box is corrected by the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image, including: determining the Kalman gain corresponding to the k-1th corrected Kalman filter according to the k-1th frame prediction error covariance to obtain the k-th frame Kalman gain; correcting the k-th frame prediction bounding box by the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image.
[0085] Optionally, the k-th frame prediction bounding box is corrected by using the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image, including: determining the product of the k-th frame Kalman gain and the k-th frame prediction difference as a correction value; and determining the sum of the correction value and the k-th frame prediction bounding box as the k-th frame bounding box in the k-th frame image.
[0086] The prediction difference of the kth frame is calculated according to the following formula:
[0087]
[0088] in, is the prediction difference of the kth frame, z k is the observation bounding box of the kth frame, is the predicted bounding box of the kth frame. In this application, the bounding box involved in the formula refers to the coordinate matrix of the bounding box. H is the observation matrix:
[0089]
[0090] The prediction error covariance of the kth frame is calculated according to the following formula:
[0091]
[0092] in, is the prediction error covariance of the kth frame, is the update error covariance of the k-1th frame, F is the above state transition matrix, and Q is the covariance:
[0093]
[0094] The Kalman gain of the kth frame is obtained by the following formula:
[0095]
[0096] Among them, K k is the Kalman gain of the kth frame, is the prediction error covariance of the kth frame, H is the observation matrix, and R is the covariance:
[0097]
[0098] The k-th frame bounding box in the k-th frame image is calculated by the following formula:
[0099]
[0100] in, is the k-th frame bounding box in the k-th frame image, is the predicted bounding box of the kth frame, K k is the Kalman gain of the kth frame mentioned above, is the prediction difference of the kth frame mentioned above.
[0101] Optionally, after obtaining the Kalman gain of the kth frame, the method further includes: correcting the k-1th corrected Kalman filter by using the kth frame Kalman gain and the kth frame prediction error covariance to obtain the kth corrected Kalman filter, wherein the kth corrected Kalman filter is used to predict the bounding box in the k+1th frame image.
[0102] As an optional implementation, the correction of the Kalman filter after the k-1th correction includes but is not limited to updating the Kalman gain and the error covariance, and the updated Kalman gain and the error covariance are used to predict the bounding box in the next frame image (the k+1th frame image). In this embodiment, the accuracy of the Kalman filter prediction can be improved by continuously correcting the Kalman filter.
[0103] Optionally, the k-1th corrected Kalman filter is corrected by the k-th frame Kalman gain and the k-th frame prediction error covariance to obtain the k-th corrected Kalman filter, including: updating the k-th frame prediction error covariance by the k-th frame Kalman gain to obtain the k-th frame updated error covariance; determining the k+1-th frame prediction error covariance by the k-th frame updated error covariance; and determining the Kalman gain corresponding to the k-th corrected Kalman filter according to the k+1-th frame prediction error covariance.
[0104] The k-th frame update error covariance is obtained by the following formula:
[0105]
[0106] in, is the update error covariance of the kth frame, I is the identity matrix, K k is the Kalman gain of the kth frame, H is the observation matrix, is the prediction error covariance of the kth frame.
[0107] Furthermore, the prediction error covariance of the k+1th frame can be obtained by the following formula:
[0108]
[0109] in, is the prediction error covariance of the k+1th frame, F is the above state transition matrix, and Q is the above covariance.
[0110] The Kalman gain corresponding to the k-th modified Kalman filter can be obtained by the following formula (used to predict the bounding box of the k+1-th frame image, which can be called the k+1-th frame Kalman gain):
[0111]
[0112] Among them, K k+1 is the Kalman gain corresponding to the k-th modified Kalman filter, is the prediction error covariance of the k+1th frame, H is the observation matrix, and R is the covariance.
[0113] Optionally, the k-th frame observation bounding box is obtained by reverse deducing the multiple key points, including: determining the minimum and maximum values of the horizontal coordinates, and the minimum and maximum values of the vertical coordinates among the multiple key points; the coordinates determined by the minimum value of the horizontal coordinate and the minimum value of the vertical coordinate are the upper left corner coordinates of the k-th frame observation bounding box; the coordinates determined by the maximum value of the horizontal coordinate and the maximum value of the vertical coordinate are the upper right corner coordinates of the k-th frame observation bounding box.
[0114] As an optional implementation, the bounding box state vector may be:
[0115]
[0116] like Figure 5 As shown, x1, y1 are the coordinates of the upper left corner of the bounding box, x2, y2 are the coordinates of the lower right corner of the bounding box, and the corresponding is the speed of the upper left corner of the bounding box, is the speed of the lower right corner of the bounding box. The units of the above variables are all pixels.
[0117] Back-calculate the observation bounding box B of the kth frame through multiple key points t-1 , the formula is as follows:
[0118]
[0119] The above formula can be used to obtain the coordinates x1, y1 of the upper left corner of the bounding box observed in the kth frame, and the coordinates x2, y2 of the lower right corner of the bounding box observed in the kth frame.
[0120] Optionally, the method also includes: when the confidence level is less than the preset threshold, calling a bounding box detection model; obtaining the k-th frame observation bounding box through the bounding box detection model; and correcting the k-th frame prediction bounding box through the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0121] As an optional implementation, the above-mentioned bounding box detection model can be a neural network model, such as a Yolo series model, an RCNN series model, etc. Figure 4 The flowchart shown also includes:
[0122] Step S107: If the confidence level is less than the preset threshold, the k-th frame image is used as input, and the bounding box detection model is run to calculate the palm bounding box to obtain the k-th frame observation bounding box. Figure 6 As shown, the k-th frame prediction bounding box is corrected by the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image. The specific correction method is the same as the correction method in the above embodiment.
[0123] This application can greatly reduce the operating frequency of the bounding box detection model, improve the frame rate of the gesture recognition process, reduce the equipment cost, and has good application prospects.
[0124] The present application can be applied to palm bounding box detection in gesture recognition in virtual reality devices. By correctly setting and initializing, the bounding box obtained by inverting the key points output by the key point model is used to continuously correct the Kalman filter, so that the Kalman filter can output a stable and correct palm bounding box with a high probability, thereby avoiding frequent calls to the bounding box detection depth model, thereby achieving the purpose of improving the frame rate of the entire gesture detection process and reducing device power consumption.
[0125] It is understandable that in the specific implementation of this application, related data such as user information 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.
[0126] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0127] According to another aspect of the embodiments of the present application, a device for identifying a bounding box in an image is provided for implementing the above-mentioned method for identifying a bounding box in an image. Figure 7 As shown, the device includes: a prediction module 72, used to predict the bounding box in the k-th frame image through the Kalman filter after the k-1th correction, and obtain the k-th frame prediction bounding box, wherein k is greater than or equal to 1, and the Kalman filter after the 0th correction is an uncorrected Kalman filter; a detection module 74, used to detect the key points in the k-th frame prediction bounding box using a key point detection model, and obtain multiple key points in the k-th frame prediction bounding box, and the confidences corresponding to the multiple key points; a reverse inference module 76, used to reversely obtain the k-th frame observation bounding box through the multiple key points when the confidence is greater than or equal to a preset threshold; a correction module 78, used to correct the k-th frame prediction bounding box through the k-th frame observation bounding box, and obtain the k-th frame bounding box in the k-th frame image.
[0128] Optionally, the above-mentioned device is also used to determine the difference between the k-th frame observation bounding box and the k-th frame prediction bounding box as the k-th frame prediction difference; determine the k-th frame prediction error covariance through the k-1-th frame update error covariance, wherein the k-1-th frame update error covariance is the covariance after updating the k-1-th frame prediction error covariance; correct the k-th frame prediction bounding box through the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image.
[0129] Optionally, the device is also used to determine the Kalman gain corresponding to the k-1th corrected Kalman filter according to the kth frame prediction error covariance to obtain the kth frame Kalman gain; correct the kth frame prediction bounding box by the kth frame Kalman gain and the kth frame prediction difference to obtain the kth frame bounding box in the kth frame image.
[0130] Optionally, the device is also used to determine the product of the Kalman gain of the kth frame and the prediction difference of the kth frame as a correction value; and determine the sum of the correction value and the kth frame prediction bounding box as the kth frame bounding box in the kth frame image.
[0131] Optionally, the device is also used to correct the k-1th corrected Kalman filter by the kth frame Kalman gain and the kth frame prediction error covariance after obtaining the kth frame Kalman gain to obtain the kth corrected Kalman filter, wherein the kth corrected Kalman filter is used to predict the bounding box in the k+1th frame image.
[0132] Optionally, the device is also used to update the prediction error covariance of the kth frame through the kth frame Kalman gain to obtain the updated error covariance of the kth frame; determine the prediction error covariance of the k+1th frame through the updated error covariance of the kth frame; and determine the Kalman gain corresponding to the kth revised Kalman filter according to the k+1th frame prediction error covariance.
[0133] Optionally, the device is also used to determine the minimum and maximum values of the horizontal coordinates, and the minimum and maximum values of the vertical coordinates among the multiple key points; the coordinates determined by the minimum value of the horizontal coordinate and the minimum value of the vertical coordinate are the upper left corner coordinates of the observation bounding box of the kth frame; the coordinates determined by the maximum value of the horizontal coordinate and the maximum value of the vertical coordinate are the upper right corner coordinates of the observation bounding box of the kth frame.
[0134] Optionally, the device is also used to call a bounding box detection model when the confidence level is less than the preset threshold; obtain the k-th frame observation bounding box through the bounding box detection model; correct the k-th frame prediction bounding box through the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0135] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processor 801, various functions provided in the embodiments of the present application are executed.
[0136] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0137] Figure 8 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0138] It should be noted that Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0139] like Figure 8 As shown, the computer system 800 includes a central processing unit 801 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 802 (ROM) or the program loaded from the storage part 808 to the random access memory 803 (RAM). Various programs and data required for system operation are also stored in the random access memory 803. The central processing unit 801, the read-only memory 802 and the random access memory 803 are connected to each other through a bus 804. The input / output interface 805 (Input / Output interface, i.e., I / O interface) is also connected to the bus 804.
[0140] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.
[0141] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processor 801, various functions defined in the system of the present application are executed.
[0142] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned method for identifying a bounding box in an image is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0143] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0144] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0145] S1, predicting the bounding box in the k-th frame image through the Kalman filter after the k-1th correction, to obtain the predicted bounding box of the k-th frame, where k is greater than or equal to 1, and the Kalman filter after the 0th correction is the initial Kalman filter without correction;
[0146] S2, using a key point detection model to detect key points in the prediction bounding box of the k-th frame, to obtain a plurality of key points in the prediction bounding box of the k-th frame, and confidences corresponding to the plurality of key points;
[0147] S3, when the confidence level is greater than or equal to a preset threshold, inversely inferring the observation bounding box of the kth frame through the multiple key points;
[0148] S4, correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0149] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig. 9 The electronic device and the electronic equipment described above are not limited in structure. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations are shown.
[0150] Among them, the memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for identifying bounding boxes in images in the embodiments of the present application. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, implementing the above-mentioned method for identifying bounding boxes in images. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 may be specifically, but not limited to, used to store information such as images and bounding boxes. As an example, such as Fig. 9 As shown, the memory 902 may include, but is not limited to, the prediction module 92, the detection module 94, the reverse estimation module 96, and the correction module 98 in the device for identifying a bounding box in an image. In addition, other module units in the device for identifying a bounding box in an image may also be included but are not limited to, which will not be described in detail in this example.
[0151] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0152] In addition, the electronic device further includes: a display 908 for displaying the image; and a connection bus 910 for connecting various module components in the electronic device.
[0153] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0154] According to one aspect of the present application, a computer-readable storage medium is provided, and 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 the method for identifying a bounding box in an image provided in the above-mentioned various optional implementations.
[0155] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0156] S1, predicting the bounding box in the k-th frame image through the Kalman filter after the k-1th correction, to obtain the predicted bounding box of the k-th frame, where k is greater than or equal to 1, and the Kalman filter after the 0th correction is the initial Kalman filter without correction;
[0157] S2, using a key point detection model to detect key points in the prediction bounding box of the k-th frame, to obtain a plurality of key points in the prediction bounding box of the k-th frame, and confidences corresponding to the plurality of key points;
[0158] S3, when the confidence level is greater than or equal to a preset threshold, inversely inferring the observation bounding box of the kth frame through the multiple key points;
[0159] S4, correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
[0160] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0161] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0162] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0163] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0164] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0165] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0167] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for identifying a bounding box in an image, characterized in that: include: Predicting the bounding box in the k-th frame image by using the Kalman filter corrected for the k-1th time to obtain the predicted bounding box of the k-th frame, wherein k is greater than or equal to 1, and the Kalman filter corrected for the 0th time is the initial Kalman filter that has not been corrected; Using a key point detection model to detect key points in the prediction bounding box of the k-th frame, to obtain a plurality of key points in the prediction bounding box of the k-th frame and confidences corresponding to the plurality of key points; When the confidence level is greater than or equal to a preset threshold, the observation bounding box of the kth frame is obtained by reverse deduction through the multiple key points; The k-th frame prediction bounding box is corrected by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
2. The method according to claim 1, characterized in that The step of correcting the k-th frame prediction bounding box by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image includes: Determine the difference between the k-th frame observation bounding box and the k-th frame prediction bounding box as the k-th frame prediction difference; Determine the prediction error covariance of the k-th frame by using the updated error covariance of the k-1-th frame, wherein the updated error covariance of the k-1-th frame is the covariance after the prediction error covariance of the k-1-th frame is updated; The k-th frame prediction bounding box is corrected according to the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image.
3. The method according to claim 2, characterized in that The k-th frame prediction bounding box is corrected by using the k-th frame prediction difference and the k-th frame prediction error covariance to obtain the k-th frame bounding box in the k-th frame image, including: Determine the Kalman gain corresponding to the Kalman filter after the k-1th correction according to the prediction error covariance of the kth frame to obtain the Kalman gain of the kth frame; The k-th frame prediction bounding box is corrected by using the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image.
4. The method according to claim 3, characterized in that The k-th frame prediction bounding box is corrected by using the k-th frame Kalman gain and the k-th frame prediction difference to obtain the k-th frame bounding box in the k-th frame image, including: Determine the product of the k-th frame Kalman gain and the k-th frame prediction difference as a correction value; The sum of the correction value and the k-th frame prediction bounding box is determined as the k-th frame bounding box in the k-th frame image.
5. The method according to claim 3, characterized in that: After obtaining the Kalman gain of the kth frame, the method further includes: The k-1th corrected Kalman filter is corrected by using the k-th frame Kalman gain and the k-th frame prediction error covariance to obtain a k-th corrected Kalman filter, wherein the k-th corrected Kalman filter is used to predict the bounding box in the k+1th frame image.
6. The method according to claim 5, characterized in that The step of correcting the k-1th corrected Kalman filter by using the kth frame Kalman gain and the kth frame prediction error covariance to obtain the kth corrected Kalman filter comprises: The prediction error covariance of the kth frame is updated by using the kth frame Kalman gain to obtain an updated error covariance of the kth frame; Determine the prediction error covariance of the k+1th frame by updating the error covariance of the kth frame; The Kalman gain corresponding to the k-th corrected Kalman filter is determined according to the k+1-th frame prediction error covariance.
7. The method according to claim 5, characterized in that The step of inverting the k-th frame observation bounding box through the multiple key points includes: Determine the minimum value and the maximum value of the horizontal coordinates, and the minimum value and the maximum value of the vertical coordinates among the plurality of key points; The coordinate determined by the minimum value of the horizontal coordinate and the minimum value of the vertical coordinate is the coordinate of the upper left corner of the observation bounding box of the kth frame; The coordinates determined by the maximum value of the horizontal coordinate and the maximum value of the vertical coordinate are the coordinates of the upper right corner of the observation bounding box of the kth frame.
8. The method according to claim 1, characterized in that The method further comprises: When the confidence level is less than the preset threshold, calling a bounding box detection model; Obtaining the k-th frame observation bounding box through the bounding box detection model; The k-th frame prediction bounding box is corrected by using the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
9. A device for identifying a bounding box in an image, characterized in that: include: A prediction module is used to predict the bounding box in the k-th frame image through the Kalman filter after the k-1th correction to obtain the predicted bounding box of the k-th frame, wherein k is greater than or equal to 1, and the Kalman filter after the 0th correction is an uncorrected Kalman filter; A detection module, used to detect key points in the prediction bounding box of the k-th frame using a key point detection model, to obtain a plurality of key points in the prediction bounding box of the k-th frame, and confidences corresponding to the plurality of key points; A reverse inference module, configured to reversely infer the observation bounding box of the kth frame through the multiple key points when the confidence level is greater than or equal to a preset threshold; The correction module is used to correct the k-th frame prediction bounding box through the k-th frame observation bounding box to obtain the k-th frame bounding box in the k-th frame image.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 9.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.
12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 9 through the computer program.
