Video structured model training method and related equipment
By inputting the frame images, detection frames and feature vectors in the video stream into the neural network for training, a video structured model with human body detection, quality score and feature output is generated, which solves the problem of limited video structuring speed in the existing technology. , achieving more efficient resource utilization and application performance.
Patent Information
- Application Number
- CN202011330035.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-11-24
AI Technical Summary
Existing video structured platforms have limitations in resource scheduling and speed, which affects practical applications, mainly due to excessive resource consumption caused by frequent calls to multiple models.
By inputting the current frame image in the video stream into the pre-trained human detection model, the detection frames are obtained, and these detection frames are input into the quality model and feature model, combined with the neural network for training, and a trained video structured model is generated to achieve Three-category output of human detection, quality scores and feature vectors.
It significantly improves the speed and accuracy of video structuring, reduces resource consumption, and improves the performance of practical applications.
Smart Images

Figure CN112418098B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a training method for a video structured model and related equipment. Background Art
[0002] With the rapid development of deep learning, deep learning has generated great practical value in practical applications. Looking at the current video structuring platforms, they are often composed of detection models, tracking models, and various attribute and quality models. In the video structuring process, these models need to be called in a series of ways. This series of calling processes has very high requirements for resource scheduling. In addition, since many models need to be called in the video structuring process, such as human feature models (ReID), human detection models, etc., the speed of video structuring is also greatly limited, which has a huge impact on practical applications. Summary of the invention
[0003] The embodiments of the present application disclose a video structuring model training method and related equipment, which are conducive to improving the speed of video structuring.
[0004] The first aspect of an embodiment of the present application discloses a method for training a video structured model, the method comprising: inputting a current frame image in a video stream into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image, wherein N is a positive integer; inputting the N human detection frames into a pre-trained quality model respectively to obtain N quality scores; inputting the N human detection frames into a pre-trained human feature model respectively to obtain N human feature vectors; and training a preset neural network model using the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors to obtain the trained video structured model.
[0005] In an exemplary embodiment, the inputting the target human body detection frame into the second sub-model to obtain a second score includes: performing multi-scale feature decomposition on the target human body detection frame to obtain a low-frequency feature component and a high-frequency feature component; dividing the low-frequency feature component into multiple regions; determining the information entropy corresponding to each of the multiple regions to obtain multiple information entropies; determining an average information entropy and a target mean square error based on the multiple information entropies; determining a target adjustment coefficient corresponding to the target mean square error; adjusting the average information entropy based on the target adjustment coefficient to obtain a target information entropy; determining a third score corresponding to the target information entropy according to a preset mapping relationship between information entropy and score; and obtaining the target shooting parameters corresponding to a target human body detection frame; determining the target low-frequency weight corresponding to the target shooting parameters according to a mapping relationship between a preset shooting parameter and a low-frequency weight, and determining the target high-frequency weight according to the target low-frequency weight; determining the target feature point distribution density according to the high-frequency feature component; determining a fourth score corresponding to the target feature point distribution density according to a preset mapping relationship between the feature point distribution density and the score; performing a weighted operation according to the third score, the fourth score, the target low-frequency weight and the target high-frequency weight to obtain a target clarity of the target human body detection frame; determining a second score corresponding to the target clarity according to a mapping relationship between the preset clarity of the human body detection frame and the score.
[0006] The second aspect of an embodiment of the present application discloses a training device for a video structured model, which includes: an acquisition unit, used to input a current frame image in a video stream into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image, wherein N is a positive integer; the acquisition unit is also used to input the N human detection frames into a pre-trained quality model to obtain N quality scores; the acquisition unit is also used to input the N human detection frames into a pre-trained human feature model to obtain N human feature vectors; a training unit is used to train a preset neural network model using the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors to obtain the trained video structured model.
[0007] A third aspect of an embodiment of the present application discloses a server, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in the method described in any one of the first aspect of the embodiment of the present application.
[0008] A fourth aspect of an embodiment of the present application discloses a chip, characterized in that it includes: a processor for calling and running a computer program from a memory, so that a device equipped with the chip executes a method as described in any one of the first aspects of the embodiment of the present application.
[0009] A fifth aspect of an embodiment of the present application discloses a computer-readable storage medium, characterized in that it stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute a method as described in any one of the first aspects of the embodiments of the present application.
[0010] A sixth aspect of the embodiments of the present application discloses a computer program product, which enables a computer to execute a method as described in any one of the first aspects of the embodiments of the present application.
[0011] It can be seen that in an embodiment of the present application, the current frame image in the video stream is first input into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image; then the N human detection frames are respectively input into a pre-trained quality model to obtain N quality scores; and the N human detection frames are respectively input into a pre-trained human feature model to obtain N human feature vectors; and then the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train the preset neural network model to obtain a trained video structuring model; since in the process of training the video structuring model, the frame image in the video stream, the human detection frame corresponding to the frame image, the quality score corresponding to the human detection frame, and the human feature vector corresponding to the human detection frame are used for model training at the same time, the video structuring model obtained after training simultaneously has three types of outputs: human detection, quality score, and human feature, thereby greatly improving the speed of video structuring. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 It is a flowchart of a method for training a video structured model provided in an embodiment of the present application;
[0014] Figure 2 It is a flowchart of another video structured model training method provided in an embodiment of the present application;
[0015] Figure 3It is a structural schematic diagram of a video structured model training device provided in an embodiment of the present application;
[0016] Figure 4 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0018] See also Figure 1 , Figure 1 It is a flow chart of a video structured model training method provided in an embodiment of the present application. The video structured model training method can be applied to a server, and the video structured model training method includes but is not limited to the following steps.
[0019] Step 101: input a current frame image in a video stream into a pre-trained human body detection model to obtain N human body detection frames corresponding to the current frame image, wherein N is a positive integer.
[0020] The human detection frame is used for pedestrian detection in video structuring, which is a region image after the pedestrian is framed, that is, a region image containing the pedestrian in the frame image. In addition, the human detection model can be a pedestrian detector.
[0021] Step 102: Input the N human body detection frames into pre-trained quality models respectively to obtain N quality scores.
[0022] The pre-trained quality model is used to evaluate the quality of each human detection frame to obtain a quality score of the human detection frame; the quality score is between 0 and 1, and the higher the quality score, the better the quality of the human detection frame, which is more conducive to video structuring. For example, the more complete the human body in the human detection frame, the higher the quality score corresponding to the human detection frame; the clearer the human body in the human detection frame, the higher the quality score corresponding to the human detection frame.
[0023] Step 103: input the N human body detection frames into pre-trained human body feature models respectively to obtain N human body feature vectors.
[0024] Step 104: train a preset neural network model using the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors to obtain the trained video structured model.
[0025] It can be seen that in an embodiment of the present application, the current frame image in the video stream is first input into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image; then the N human detection frames are respectively input into a pre-trained quality model to obtain N quality scores; and the N human detection frames are respectively input into a pre-trained human feature model to obtain N human feature vectors; and then the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train the preset neural network model to obtain a trained video structuring model; since in the process of training the video structuring model, the frame image in the video stream, the human detection frame corresponding to the frame image, the quality score corresponding to the human detection frame, and the human feature vector corresponding to the human detection frame are used for model training at the same time, the video structuring model obtained after training simultaneously has three types of outputs: human detection, quality score, and human feature, thereby greatly improving the speed of video structuring.
[0026] In an exemplary embodiment, the pre-trained quality model includes a first sub-model and a second sub-model, wherein the first sub-model is used to detect the integrity of the human body in the human body detection frame, and the second sub-model is used to detect the image quality of the human body detection frame, and the inputting the N human body detection frames into the pre-trained quality model to obtain N quality scores respectively includes: for each human body detection frame in the N human body detection frames, performing the following steps to obtain the N quality scores: inputting a target human body detection frame into the first sub-model to obtain a first score, wherein the target human body detection frame is any one of the N human body detection frames; inputting the target human body detection frame into the second sub-model to obtain a second score; obtaining a first weight value corresponding to the integrity of the human body in the target human body detection frame, and obtaining a second weight value corresponding to the image quality of the target human body detection frame, wherein the first weight value is greater than the second weight value, and the sum of the first weight value and the second weight value is 1; performing a weighted operation according to the first score, the second score, the first weight value, and the second weight value to obtain the quality score of the target human body detection frame.
[0027] The pre-trained quality model includes a first sub-model and a second sub-model. The first sub-model mainly scores the human body detection frame based on the completeness of the human body, while the second sub-model mainly scores the image based on the clarity of the human body image in the human body detection frame; and each model corresponds to a weight value, which is used to characterize its importance in scoring the human body detection frame. The higher the weight, the more important it is. The quality score calculation formula is: quality score = first score × first weight value + second score × second weight value, wherein the first score is the score given by the first model to the human body detection frame, and the second score is the score given by the second model to the human body detection frame; the first weight value is the weight corresponding to the completeness of the human body, which is used to characterize the influence of the completeness of the human body on the quality score; the second weight value is the weight corresponding to the image quality, which is used to characterize the influence of the image quality on the quality score, such as the influence of the clarity of the human body on the quality score.
[0028] Among them, the human body completeness refers to the ratio of the visible area of the human body to the theoretical area of the human body. The visible area of the human body is the area of the unobstructed part of the human body in the image, and the theoretical area of the human body refers to the maximum area of the human body in the image without obstruction.
[0029] It can be seen that in this example, the human body detection frame is scored according to the two dimensions of the human body completeness in the human body detection frame and the image quality of the human body detection frame (that is, the clarity of the human body in the human body detection frame), and the weight values corresponding to these two dimensions are set. Since the weight corresponding to the human body completeness dimension is greater than the weight corresponding to the image quality dimension of the human body detection frame, that is, the human body completeness has a greater impact on the quality score of the human body detection frame, and the more complete the human body in the human body detection frame is, the more human body features it contains, thereby ensuring that a higher quality score is given to the human body detection frame with more human body features, which is beneficial to improving the accuracy of video structuring.
[0030] In an exemplary embodiment, the inputting the target human body detection frame into the second sub-model to obtain a second score includes: performing multi-scale feature decomposition on the target human body detection frame to obtain a low-frequency feature component and a high-frequency feature component; dividing the low-frequency feature component into multiple regions; determining the information entropy corresponding to each of the multiple regions to obtain multiple information entropies; determining an average information entropy and a target mean square error based on the multiple information entropies; determining a target adjustment coefficient corresponding to the target mean square error; adjusting the average information entropy based on the target adjustment coefficient to obtain the target information entropy; determining a third score corresponding to the target information entropy according to a preset mapping relationship between the information entropy and the score; and obtaining the target human body detection frame. The method comprises the steps of: determining a target shooting parameter corresponding to a target human body detection frame; determining a target low-frequency weight corresponding to the target shooting parameter according to a mapping relationship between a preset shooting parameter and a low-frequency weight, and determining a target high-frequency weight according to the target low-frequency weight; determining a target feature point distribution density according to the high-frequency feature component; determining a fourth score corresponding to the target feature point distribution density according to a mapping relationship between a preset feature point distribution density and a score; performing a weighted operation according to the third score, the fourth score, the target low-frequency weight and the target high-frequency weight to obtain a target clarity of the target human body detection frame; and determining a second score corresponding to the target clarity according to a mapping relationship between the preset clarity of the human body detection frame and the score.
[0031] Among them, a multi-scale decomposition algorithm can be used to perform multi-scale feature decomposition on the target human detection frame to obtain low-frequency feature components and high-frequency feature components. The multi-scale decomposition algorithm can be at least one of the following: pyramid transform algorithm, wavelet transform, contourlet transform, shearlet transform, etc., which are not limited here. The target shooting parameter can be at least one of the following: ISO, exposure time, white balance parameter, focus parameter, etc., which are not limited here. In addition, in the embodiment of the present application, the value range of the adjustment coefficient can be -0.15 to 0.15; target information entropy = (1 + target adjustment coefficient) * average information entropy; target low-frequency weight + target high-frequency weight = 1; target feature point distribution density = total number of feature points of high-frequency feature components / region area; target clarity = third score * target low-frequency weight + fourth score * target high-frequency weight.
[0032] In this way, image quality evaluation can be performed based on the two dimensions of low-frequency component and high-frequency component of the target human detection frame, and the target clarity of the target human detection frame can be accurately obtained, thereby obtaining a second score corresponding to the target human detection frame.
[0033] In an exemplary embodiment, the inputting the N human body detection frames into a pre-trained human feature model respectively to obtain N human body feature vectors includes: for each human body detection frame in the N human body detection frames, performing the following steps to obtain the N human body feature vectors: determining human body key points in a target human body detection frame to obtain multiple first human body key points, wherein the target human body detection frame is any one of the N human body detection frames; determining a first number of human body key points in the target human body detection frame according to the multiple first human body key points; determining whether the first number is greater than a preset number; if the first number is greater than the preset number, calculating the human body feature vector corresponding to the target human body detection frame according to the multiple first human body key points.
[0034] Specifically, a plurality of human key points may be determined from the human detection frame, and then a human feature vector corresponding to the human detection frame may be calculated according to the pixel coordinates of the plurality of human key points in the human detection frame.
[0035] It can be seen that in this example, the human feature model obtains multiple human key points in the human detection frame by detecting the key points of the human body in the human detection frame, and then determines whether the number of the multiple human key points corresponding to the human detection frame is greater than the preset number, so as to determine whether there is a human body in the human detection frame. When the number of these multiple human key points is greater than the preset number, it means that there is a human body in the human detection frame, and the human feature vector corresponding to the human detection frame is calculated based on the multiple human key points, thereby ensuring that the human feature vector output by the human feature model is accurate.
[0036] In an exemplary embodiment, the method also includes: if the first number is less than or equal to the preset number, determining the target image enhancement algorithm corresponding to the first number according to the mapping relationship between the number of human key points in the target human detection frame and the image enhancement algorithm; performing image enhancement processing on the target human detection frame according to the target image enhancement algorithm to obtain an enhanced target human detection frame; determining the human key points in the enhanced target human detection frame to obtain multiple second human key points; calculating the human feature vector corresponding to the enhanced target human detection frame according to the multiple second human key points; and using the human feature vector corresponding to the enhanced target human detection frame as the human feature vector corresponding to the target human detection frame.
[0037] It should be understood that when the number of key points of the human body in the human body detection frame is less than the preset number, there may be no human body in the human body detection frame, or the image quality of the human body detection frame may be low, which is not conducive to the determination of the key points of the human body; the human body detection frame can be image enhanced, and the image enhancement algorithm used for the human body detection frame also has a mapping relationship with the number of key points of the human body in the human body detection frame. The number of key points in the human body detection frame is different, and the image enhancement algorithm used is also different. Since the determination of the key points of the human body is related to the clarity of the human body, that is, the number of key points of the human body that can be determined with different human clarity is also different; if different image enhancement algorithms are used to process images of different clarity, targeted image enhancement is achieved, that is, the image enhancement algorithm is selected according to the number of key points of the human body in the human body detection frame, and the appropriate image enhancement algorithm can be selected in one step to perform image enhancement on the human body detection frame, while improving the image enhancement effect, the speed of video structuring is further improved.
[0038] The image enhancement algorithm described in the embodiment of the present application includes: grayscale stretching, histogram equalization, wavelet transform, etc., which are not limited here. Furthermore, the fewer the number of key points in the human body detection frame, the better the enhancement effect of the selected image enhancement algorithm.
[0039] It can be seen that in this example, when the number of multiple human key points determined from the human detection frame is not greater than the preset number, the image enhancement algorithm is determined according to the mapping relationship between the number of human key points and the image enhancement algorithm; then the human detection frame is subjected to image enhancement processing according to the image enhancement algorithm, and the number of human key points in the enhanced human detection frame is determined, and the human feature vector of the human detection frame is calculated according to the human key points in the enhanced human detection frame, thereby further ensuring that the human feature vector output by the human feature model is accurate.
[0040] In an exemplary embodiment, before inputting the current frame image in the video stream into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image, the method also includes: determining whether the size of the current frame image is a predetermined size; if the size of the current frame image is not the predetermined size, processing the current frame image so that the size of the current frame image is the predetermined size.
[0041] Specifically, the size of the input image of the pedestrian detector is specified as 512×512, that is, the predetermined size is 512×512. Therefore, if the size of the current frame image is not 512×512, it needs to be processed to make its size 512×512.
[0042] It can be seen that in this example, when the size of the current frame image does not meet the predetermined size required for model training, it is preprocessed to make its size the predetermined size, thereby ensuring that each frame image in the video stream can be used for the training of the video structured model, which is beneficial to improving the accuracy of the model, that is, improving the accuracy of video structuring.
[0043] In an exemplary embodiment, the processing of the current frame image so that the size of the current frame image is the predetermined size includes: in the high dimension, if the height of the current frame image is greater than the height of the predetermined size, scaling the height of the current frame image to the height of the predetermined size; if the height of the current frame image is less than the height of the predetermined size, filling i rows of zeros in the row direction of the current frame image, wherein i is the difference between the height of the predetermined size and the height of the current frame image; in the wide dimension, if the width of the current frame image is greater than the width of the predetermined size, scaling the width of the current frame image to the width of the predetermined size; if the width of the current frame image is less than the width of the predetermined size, filling j columns of zeros in the column direction of the current frame image, wherein j is the difference between the width of the predetermined size and the width of the current frame image.
[0044] Specifically, if the size of the current frame image is larger than the predetermined size, and the height and width of the predetermined size are equal, the processing of the current frame image so that the size of the current frame image is the predetermined size includes: determining the ratio of the length of the long side of the current frame image to the length of the predetermined size, wherein, if the height of the current frame image is greater than or equal to the width, the length of the long side of the current frame image is the height of the current frame image; if the height of the current frame image is smaller than the width, the length of the long side of the current frame image is the width of the current frame image; the length of the predetermined size is the height or width of the predetermined size; based on The current frame image is reduced according to the ratio to obtain a first target image, wherein the length of the long side of the first target image is the length of the predetermined size; if the length of the short side of the first target image is equal to the length of the predetermined size, the first target image is the processed current frame image; if the length of the short side of the first target image is less than the length of the predetermined size, zeros are filled in the short side direction of the first target image to obtain a second target image, wherein the length of the short side of the second target image is the length of the predetermined size, and the second target image is the processed current frame image.
[0045] For example, the size of a frame image in a video stream is generally 1920×1080. If you want to change it to 512×512, you need to calculate the ratio of the long side (1920) to 512, and then scale the long side according to this ratio. After scaling, the short side is 288. Therefore, if the short side is less than 512 after scaling, it will be padded with zeros, that is, the short side is padded from 288 to 512.
[0046] It can be seen that in this example, when the size of the current frame image does not meet the predetermined size required for model training, if the size of the current frame image is larger than the predetermined size, then downscaling is performed to make the size of the current frame image the predetermined size; if the size of the current frame image is smaller than the predetermined size, then zero padding is performed to make the size of the current frame image the predetermined size; thereby ensuring that each frame image in the video stream can be used for the training of the video structured model, which is beneficial to improving the accuracy of the model, that is, improving the accuracy of video structuring.
[0047] In an exemplary embodiment, before the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train a preset neural network model to obtain the trained video structured model, the method further includes: converting the file format corresponding to the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors into a preset file format, wherein the preset file format is a file format suitable for the preset neural network training.
[0048] Specifically, the current frame image and the label files such as the human detection frame, quality score, human feature vector, etc. obtained through the current frame image are organized into a file format suitable for training, and then sent into a pre-designed larger preset neural network to start model training.
[0049] It can be seen that in this example, before training the model, the current frame image and the human detection frame, quality score, human feature vector and other label files obtained through the current frame image are organized into a file format suitable for training, which is beneficial to the training of the model.
[0050] See also Figure 2 , Figure 2 It is a flow chart of another video structured model training method provided in an embodiment of the present application. The video structured model training method can be applied to a server, and the video structured model training method includes but is not limited to the following steps.
[0051] 201. Obtain a current frame image from a video stream.
[0052] 202. Input the current frame image into a pre-trained human body detection model to obtain a human body detection frame of the current frame image.
[0053] The size of the current frame image extracted from the video stream is generally 1920×1080, and the input image size of the pre-trained human detection model (i.e., pedestrian detector) is 512×512. If the size of the current frame image needs to be changed to 512×512, the ratio of the long side (1920) to 512 of the current frame image is calculated, and then the long side is scaled according to this ratio. If the short side is less than 512, it is filled with 0. After the size of the current frame image is changed to 512×512, it is sent to the pedestrian detector to obtain all human detection frames in the current frame image.
[0054] 203. Input the human body detection frame of the current frame image into a pre-trained quality model and a pre-trained human body feature model respectively to obtain a human body feature vector and a quality score of each human body detection frame of the current frame image.
[0055] It should be understood that after all human detection frames are obtained, the human detection frame data are sent to the quality model and the Reid model in turn. The function of the Reid model is to extract the 256-dimensional human feature representation and obtain the feature vector of the human detection frame; the quality model evaluates the quality of each human detection frame and obtains the quality score of the human detection frame.
[0056] 204. Input the human body detection frame, human body feature vector, and quality score of the current frame image into a preset neural network model for training.
[0057] It should be understood that by setting the specified number of training times, batch size, learning rate, etc., the model is trained repeatedly and gradually learns to simultaneously output human detection boxes, quality scores, and human feature vectors until the loss of each output of the model reaches a specified value. The performance of the model is then tested with indicators such as accuracy, and it is considered to have met the requirements if it meets the specified requirements.
[0058] It can be seen that in the application embodiment, the image size of the video structuring model input is set to the input size of the human detection model, and the video structuring model outputs all the human detection frames in the image, the feature vector of each frame, and the quality score of each frame. The video structuring model is a three-task model. Compared with the existing model that uses three models, the video structuring speed is greatly improved.
[0059] The method of the embodiment of the present application is described in detail above, and the device of the embodiment of the present application is provided below.
[0060] See also Figure 3 , Figure 3300 is a structural diagram of a video structured model training device provided in an embodiment of the present application. The video structured model training device is applied to a server. The video structured model training device 300 may include an acquisition unit 301 and a training unit 302, wherein each unit is described in detail as follows:
[0061] An acquisition unit 301 is used to input a current frame image in a video stream into a pre-trained human body detection model to obtain N human body detection frames corresponding to the current frame image, wherein N is a positive integer;
[0062] The acquisition unit 301 is further used to input the N human detection frames into a pre-trained quality model to obtain N quality scores;
[0063] The acquisition unit 301 is further used to input the N human body detection frames into a pre-trained human body feature model to obtain N human body feature vectors;
[0064] The training unit 302 is used to train a preset neural network model using the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors to obtain the trained video structured model.
[0065] In an exemplary embodiment, the pre-trained quality model includes a first sub-model and a second sub-model, wherein the first sub-model is used to detect the integrity of the human body in the human body detection frame, and the second sub-model is used to detect the image quality of the human body detection frame. In the aspect of inputting the N human body detection frames into the pre-trained quality model to obtain N quality scores, the acquisition unit 301 is specifically used to: for each human body detection frame in the N human body detection frames, perform the following steps to obtain the N quality scores: input a target human body detection frame into the first sub-model to obtain a first score, wherein the target human body detection frame is any one of the N human body detection frames; input the target human body detection frame into the second sub-model to obtain a second score; obtain a first weight value corresponding to the integrity of the human body in the target human body detection frame, and obtain a second weight value corresponding to the image quality of the target human body detection frame, wherein the first weight value is greater than the second weight value, and the sum of the first weight value and the second weight value is 1; perform a weighted operation according to the first score, the second score, the first weight value, and the second weight value to obtain the quality score of the target human body detection frame.
[0066] In an exemplary embodiment, in terms of inputting the N human body detection frames into a pre-trained human feature model respectively to obtain N human body feature vectors, the acquisition unit 301 is specifically used to: for each human body detection frame in the N human body detection frames, perform the following steps to obtain the N human body feature vectors: determine the human body key points in the target human body detection frame to obtain a plurality of first human body key points, wherein the target human body detection frame is any one of the N human body detection frames; determine a first number of human body key points in the target human body detection frame according to the plurality of first human body key points; determine whether the first number is greater than a preset number; if the first number is greater than the preset number, calculate the human body feature vector corresponding to the target human body detection frame according to the plurality of first human body key points.
[0067] In an exemplary embodiment, the acquisition unit 301 is also used to: if the first number is less than or equal to the preset number, determine the target image enhancement algorithm corresponding to the first number according to the mapping relationship between the number of human key points in the target human detection frame and the image enhancement algorithm; perform image enhancement processing on the target human detection frame according to the target image enhancement algorithm to obtain an enhanced target human detection frame; determine the human key points in the enhanced target human detection frame to obtain multiple second human key points; calculate the human feature vector corresponding to the enhanced target human detection frame according to the multiple second human key points; and use the human feature vector corresponding to the enhanced target human detection frame as the human feature vector corresponding to the target human detection frame.
[0068] In an exemplary embodiment, before inputting the current frame image in the video stream into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image, the acquisition unit 301 is also used to: determine whether the size of the current frame image is a predetermined size; if the size of the current frame image is not the predetermined size, process the current frame image so that the size of the current frame image is the predetermined size.
[0069] In an exemplary embodiment, in terms of processing the current frame image so that the size of the current frame image is the predetermined size, the acquisition unit 301 is specifically used to: in high dimension, if the height of the current frame image is greater than the height of the predetermined size, scale the height of the current frame image to the height of the predetermined size; if the height of the current frame image is less than the height of the predetermined size, fill i rows of zeros in the row direction of the current frame image, wherein i is the difference between the height of the predetermined size and the height of the current frame image; in width dimension, if the width of the current frame image is greater than the width of the predetermined size, scale the width of the current frame image to the width of the predetermined size; if the width of the current frame image is less than the width of the predetermined size, fill j columns of zeros in the column direction of the current frame image, wherein j is the difference between the width of the predetermined size and the width of the current frame image.
[0070] In an exemplary embodiment, before the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train a preset neural network model to obtain the trained video structured model, the acquisition unit 301 is also used to: convert the file format corresponding to the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors into a preset file format, wherein the preset file format is a file format suitable for the preset neural network training.
[0071] It should be noted that the implementation of each unit can also refer to Figure 1 or Figure 2 Corresponding description of the method embodiment shown. Of course, the video structured model training device 300 provided in the embodiment of the present application includes but is not limited to the above-mentioned unit modules, for example: the video structured model training device 300 may also include a storage unit 303, and the storage unit 303 may be used to store the program code and data of the video structured model training device 300.
[0072] exist Figure 3In the training device 300 of the described video structuring model, the current frame image in the video stream is first input into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image; then the N human detection frames are respectively input into a pre-trained quality model to obtain N quality scores; and the N human detection frames are respectively input into a pre-trained human feature model to obtain N human feature vectors; then the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train a preset neural network model to obtain a trained video structuring model; because in the process of training the video structuring model, the frame image in the video stream, the human detection frame corresponding to the frame image, the quality score corresponding to the human detection frame, and the human feature vector corresponding to the human detection frame are used simultaneously for model training, the video structuring model obtained after training simultaneously has three types of outputs of human detection, quality score, and human feature, thereby greatly improving the speed of video structuring.
[0073] See also Figure 4 , Figure 4 4 is a schematic diagram of the structure of a server 410 provided in an embodiment of the present application. The server 410 includes a processor 411, a memory 412 and a communication interface 413. The processor 411, the memory 412 and the communication interface 413 are interconnected via a bus 414.
[0074] The memory 412 includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a portable read-only memory (CD-ROM), and the memory 412 is used for related computer programs and data. The communication interface 413 is used to receive and send data.
[0075] The processor 411 may be one or more central processing units (CPUs). When the processor 411 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.
[0076] The processor 411 in the server 410 is used to read the computer program code stored in the above-mentioned memory 412, and perform the following operations: input the current frame image in the video stream into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image, wherein N is a positive integer; input the N human detection frames into a pre-trained quality model respectively to obtain N quality scores; input the N human detection frames into a pre-trained human feature model respectively to obtain N human feature vectors; use the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors to train a preset neural network model to obtain the trained video structured model.
[0077] It should be noted that the implementation of each operation can also refer to Figure 1 or Figure 2 The corresponding description of the method embodiment shown.
[0078] exist Figure 4 In the described server 410, the current frame image in the video stream is first input into a pre-trained human detection model to obtain N human detection frames corresponding to the current frame image; then the N human detection frames are respectively input into a pre-trained quality model to obtain N quality scores; and the N human detection frames are respectively input into a pre-trained human feature model to obtain N human feature vectors; then the current frame image, the N human detection frames, the N quality scores, and the N human feature vectors are used to train the preset neural network model to obtain a trained video structuring model; since in the process of training the video structuring model, the frame image in the video stream, the human detection frame corresponding to the frame image, the quality score corresponding to the human detection frame, and the human feature vector corresponding to the human detection frame are used for model training at the same time, the video structuring model obtained after training simultaneously has three types of outputs: human detection, quality score, and human feature, thereby greatly improving the speed of video structuring.
[0079] The embodiment of the present application further provides a chip, the chip comprising at least one processor, a memory and an interface circuit, the memory, the transceiver and the at least one processor are interconnected via a line, a computer program is stored in the at least one memory; when the computer program is executed by the processor, Figure 1 or Figure 2 The method flow shown is realized.
[0080] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed on a computer, Figure 1 or Figure 2 The method flow shown is realized.
[0081] The present application also provides a computer program product. When the computer program product is run on a computer, Figure 1 or Figure 2 The method flow shown is realized.
[0082] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0083] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0084] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor.
[0085] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0086] It should also be understood that the first, second, third, fourth and various numerical numbers involved in this document are only distinctions made for the convenience of description and are not intended to limit the scope of the present application.
[0087] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0088] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0089] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0090] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0091] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as 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 devices or units, which can be electrical, mechanical or other forms.
[0092] The units described above 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.
[0093] 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.
[0094] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method shown in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0095] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0096] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0097] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A video structured model training method, characterized in that: include: Input the current frame image in the video stream into a pre-trained human body detection model to obtain N human body detection frames corresponding to the current frame image, where N is a positive integer; Inputting the N human body detection frames into a pre-trained quality model respectively to obtain N quality scores, wherein the pre-trained quality model includes a first sub-model and a second sub-model, wherein the first sub-model is used to detect the integrity of the human body in the human body detection frame, and the second sub-model is used to detect the image quality of the human body detection frame through multi-scale feature decomposition; Inputting the N human body detection frames into a pre-trained human feature model respectively to obtain N human body feature vectors, including: determining human body key points in a target human body detection frame to obtain a plurality of first human body key points, wherein the target human body detection frame is any one of the N human body detection frames; determining a first number of human body key points in the target human body detection frame according to the plurality of first human body key points; judging whether the first number is greater than a preset number; if the first number is less than or equal to the preset number, determining a target image enhancement algorithm corresponding to the first number according to a mapping relationship between the number of human body key points in the target human body detection frame and an image enhancement algorithm; performing image enhancement processing on the target human body detection frame according to the target image enhancement algorithm to obtain an enhanced target human body detection frame; and determining a human body feature vector corresponding to the target human body detection frame based on the enhanced target human body detection frame; The preset neural network model is trained using the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors to obtain the trained video structured model. The trained video structured model has three types of outputs: a human body detection frame, a quality score corresponding to the human body detection frame, and a human body feature vector corresponding to the human body detection frame.
2. The method according to claim 1, characterized in that The step of inputting the N human body detection frames into a pre-trained quality model to obtain N quality scores includes: For each human body detection frame in the N human body detection frames, perform the following steps to obtain the N quality scores: Inputting a target human detection frame into the first sub-model to obtain a first score, wherein the target human detection frame is any one of the N human detection frames; Inputting the target human body detection frame into the second sub-model to obtain a second score; Obtaining a first weight value corresponding to the integrity of a human body in the target human body detection frame, and obtaining a second weight value corresponding to the image quality of the target human body detection frame, wherein the first weight value is greater than the second weight value, and the sum of the first weight value and the second weight value is 1; A weighted operation is performed according to the first score, the second score, the first weight value, and the second weight value to obtain a quality score of the target human detection frame.
3. The method according to claim 1, characterized in that After determining whether the first number is greater than a preset number, the method further comprises: If the first number is greater than the preset number, a human feature vector corresponding to the target human detection frame is calculated based on the multiple first human key points.
4. The method according to claim 3, characterized in that The determining, based on the enhanced target human body detection frame, a human feature vector corresponding to the target human body detection frame comprises: Determine the human key points in the enhanced target human detection frame to obtain a plurality of second human key points; Calculate the human feature vector corresponding to the enhanced target human detection frame according to the multiple second human key points; The human feature vector corresponding to the enhanced target human detection frame is used as the human feature vector corresponding to the target human detection frame.
5. The method according to any one of claims 1 to 4, characterized in that: Before inputting the current frame image in the video stream into a pre-trained human body detection model to obtain N human body detection frames corresponding to the current frame image, the method further includes: Determining whether the size of the current frame image is a predetermined size; If the size of the current frame image is not the predetermined size, the current frame image is processed so that the size of the current frame image is the predetermined size.
6. The method according to claim 5, characterized in that The processing of the current frame image so that the size of the current frame image is the predetermined size includes: In high dimension, if the height of the current frame image is greater than the height of the predetermined size, the height of the current frame image is scaled to the height of the predetermined size; if the height of the current frame image is less than the height of the predetermined size, i rows of zeros are filled in the row direction of the current frame image, where i is the difference between the height of the predetermined size and the height of the current frame image; In the width dimension, if the width of the current frame image is larger than the width of the predetermined size, the width of the current frame image is scaled to the width of the predetermined size; if the width of the current frame image is smaller than the width of the predetermined size, j columns of zeros are filled in the column direction of the current frame image, where j is the difference between the width of the predetermined size and the width of the current frame image.
7. The method according to any one of claims 1 to 4, characterized in that: Before the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors are used to train a preset neural network model to obtain the trained video structured model, the method further includes: The file formats corresponding to the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors are converted into a preset file format, wherein the preset file format is a file format suitable for the preset neural network training.
8. A video structured model training device, characterized in that: include: An acquisition unit, used for inputting a current frame image in a video stream into a pre-trained human body detection model to obtain N human body detection frames corresponding to the current frame image, wherein N is a positive integer; The acquisition unit is further used to input the N human body detection frames into a pre-trained quality model respectively to obtain N quality scores, wherein the pre-trained quality model includes a first sub-model and a second sub-model, wherein the first sub-model is used to detect the integrity of the human body in the human body detection frame, and the second sub-model is used to detect the image quality of the human body detection frame through multi-scale feature decomposition; The acquisition unit is also used to input the N human body detection frames into a pre-trained human feature model to obtain N human body feature vectors, including: determining human body key points in a target human body detection frame to obtain a plurality of first human body key points, wherein the target human body detection frame is any one of the N human body detection frames; determining a first number of human body key points in the target human body detection frame according to the plurality of first human body key points; judging whether the first number is greater than a preset number; if the first number is less than or equal to the preset number, determining a target image enhancement algorithm corresponding to the first number according to a mapping relationship between the number of human body key points in the target human body detection frame and an image enhancement algorithm; performing image enhancement processing on the target human body detection frame according to the target image enhancement algorithm to obtain an enhanced target human body detection frame; and determining a human body feature vector corresponding to the target human body detection frame based on the enhanced target human body detection frame; A training unit is used to train a preset neural network model using the current frame image, the N human body detection frames, the N quality scores, and the N human body feature vectors to obtain the trained video structured model, wherein the trained video structured model has three types of outputs: a human body detection frame, a quality score corresponding to the human body detection frame, and a human body feature vector corresponding to the human body detection frame.
9. A server, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: It stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.
