A virtual human clothing detection method, device, equipment and readable storage medium

By introducing text input and mutual attention modules into the clothing detection model, image and text features are enhanced, which solves the problems of low fine-grainedness and poor interactivity of the existing clothing detection models, and achieves more accurate target recognition and positioning.

CN118379592BActive Publication Date: 2024-09-20HITHINK ROYALFLUSH INFORMATION NETWORK CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410805924.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-20
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

Existing clothing detection models can only complete closed-set tasks, making it difficult to distinguish clothes of different styles and colors. Their fine-grainedness is low, custom detection cannot be achieved, and interactivity is low.

Method used

The image-text mutual attention method and text-image mutual attention method based on text features and image features are used to enhance image and text features, and predict the target location and category through pooling processing and contrast loss constraints.

Benefits of technology

The fine-grained and multi-modal capabilities of clothing detection are improved, enabling the model to more accurately identify and locate targets, and enhancing the interactivity between users and the detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379592B
    Figure CN118379592B
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and readable storage medium for detecting clothing of a virtual person, which are applied to the technical field of target detection, including: enhancing image features by using an image-text mutual attention method based on text features and image features, and enhancing text features by using a text-image mutual attention method to obtain fused image enhancement features and fused text enhancement features; performing pooling processing on the fused image enhancement features to obtain global image features, and constraining the global image features and each fused text enhancement feature based on contrast loss to obtain constrained image features and constrained text features; predicting target positions and target categories based on constrained image features and constrained text features. The present invention adds interactive fusion with text features on the basis of extracting image features, so that both image features and text features have stronger feature expression capabilities, thereby improving the accuracy of clothing detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of target detection, and in particular to a method, device, equipment and readable storage medium for detecting clothing of a virtual person. Background Art

[0002] In recent years, research on object detection has made significant progress, and the detection of human clothing has gradually been applied to scenes such as augmented reality and the metaverse. Object detection models usually use a backbone network to extract image features from the input image, and then use a detection head to make predictions to obtain detection results. In the training phase, images with labeled target category objects are input to perform supervised training on the detection model. In the inference phase, images containing target category objects are input, and the detection model predicts the target category and outputs the location and category of the target category as the object detection result.

[0003] Currently, the widely used object detection models are all supervised training, so they can only complete closed-set tasks. In other words, in the inference stage, the detection model can only effectively predict the categories marked in the training set. If the user wants to detect other categories, the detection model cannot meet the needs well. In addition, due to the labeling cost of training data and model performance, the granularity of existing detection models is low. For example, clothes of different styles and colors are all detected as the same category, which makes it difficult to make further distinctions. In addition, existing detection models usually only accept image inputs, making it difficult to implement targeted detection of user-defined inputs, and the interactivity is low.

[0004] Therefore, the existing clothing detection has the technical problem of low detection performance. Summary of the invention

[0005] In view of this, an object of the present invention is to provide a virtual human clothing detection method, device, equipment and readable storage medium, which solves the technical problem of low clothing detection performance in the prior art.

[0006] In order to solve the above technical problems, the present invention provides a virtual human clothing detection method, comprising:

[0007] Based on the text features and the image features, the image features are enhanced by using the image-text mutual attention method, and the text features are enhanced by using the text-image mutual attention method, so as to obtain fused image enhancement features and fused text enhancement features; wherein the image features are images including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality;

[0008] Performing pooling processing on the fused image enhancement feature to obtain a global image feature, and performing constraint processing on the global image feature and each of the fused text enhancement features based on contrast loss to obtain a constrained image feature and a constrained text feature;

[0009] The target position and target category are predicted based on the constrained image features and the constrained text features.

[0010] Optionally, before enhancing the image features by using an image-text mutual attention method based on the text features and the image features, the method further includes:

[0011] Extract features of the input image and input text to obtain initial image features and initial text features;

[0012] The initial image features and the initial text features are enhanced to obtain the text features and the image features.

[0013] Optionally, the image features are enhanced by using an image-text mutual attention method based on the text features and the image features, and the text features are enhanced by using a text-image mutual attention method to obtain fused image enhancement features and fused text enhancement features, including:

[0014] The image-text mutual attention method is used to take the text features as input of the K matrix and the V matrix, and the image features as output of the Q matrix, to obtain the fused image enhancement features;

[0015] The text-image mutual attention method is used to take the image features as inputs of the K matrix and the V matrix, and the text features as outputs of the Q matrix, to obtain the fused text enhancement features.

[0016] Optionally, the fused image enhancement feature is pooled to obtain a global image feature, and the global image feature and each of the fused text enhancement features are constrained based on contrast loss to obtain a constrained image feature and a constrained text feature, including:

[0017] Perform average pooling processing on the fused image enhancement feature to obtain the global image feature; wherein the global image feature is ; is the number of image features;

[0018] Calculate the similarity between each global image feature and the fused text enhancement feature , , represents the number of fused text enhancement features, represents the fusion text enhancement feature, is the scaling factor, The subscript representing the global image features, A superscript indicating the fused text enhancement feature;

[0019] The contrast loss is calculated based on the similarity , represents the training batch size, represents an exponential function with the natural constant e as the base, The corner mark representing the global image features of the current batch, The subscript representing the fused text enhancement features of the current batch, the similarity include and ;

[0020] The global image feature and each text feature are constrained based on the contrast loss to obtain the constrained image feature and the constrained text feature.

[0021] Optionally, predicting the target position and target category based on the constrained image features and the constrained text features includes:

[0022] Performing category prediction based on the similarity between the global image features and the text features to obtain predicted classification parameters;

[0023] The target category is determined according to the classification parameters.

[0024] Optionally, performing category prediction based on the similarity between the global image feature and the text feature to obtain predicted classification parameters includes:

[0025] Normalizing the global image features and the text features to obtain normalized global image features and normalized text features;

[0026] Calculating the cosine similarity between each of the normalized global image features and each of the normalized text features;

[0027] After performing an ablation experiment using cosine similarity and preset similarity parameters, and processing using an activation function, a plurality of confidence prediction values ​​corresponding to each of the global image features are obtained; wherein the number of the confidence prediction values ​​is consistent with the number of text features;

[0028] The predicted classification parameter is determined according to the overlap degree of the image detection frame and the confidence prediction value.

[0029] Optionally, after predicting the target position and target category based on the constrained image features and the constrained text features, the method further includes:

[0030] Non-maximum suppression processing is performed on the position prediction and the target category to obtain detection results of each target object.

[0031] The present application also provides a virtual human clothing detection method, comprising:

[0032] A feature enhancement module, used to enhance the image feature by using an image-text mutual attention method based on text features and image features, and to enhance the text feature by using a text-image mutual attention method, so as to obtain a fused image enhancement feature and a fused text enhancement feature; wherein the image feature is an image including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality;

[0033] A contrast processing module, used for performing pooling processing on the fused image enhancement feature to obtain a global image feature, and performing constraint processing on the global image feature and each of the fused text enhancement features based on contrast loss to obtain a constrained image feature and a constrained text feature;

[0034] The target position and category prediction module is used to predict the target position and target category based on the constrained image features and the constrained text features.

[0035] The present application also provides a virtual human clothing detection device, comprising:

[0036] Memory for storing computer programs;

[0037] A processor is used to implement the steps of the above-mentioned virtual human clothing detection method when executing the computer program.

[0038] The present application also provides a readable storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the virtual human clothing detection method as described above are implemented.

[0039] It can be seen that the present invention enhances the image features by using the image-text mutual attention method based on the text features and the image features, and enhances the text features by using the text-image mutual attention method, so as to obtain the fused image enhancement features and the fused text enhancement features; wherein the image features are images including the clothes of the virtual person, the image-text mutual attention method is a method for realizing the information fusion of the text modality to the image modality, and the text-image mutual attention method is a method for realizing the information fusion of the image modality to the text modality; the fused image enhancement features are pooled to obtain the global image features, and the global image features and each fused text enhancement features are constrained based on the contrast loss to obtain the constrained image features and the constrained text features; the target position and the target category are predicted based on the constrained image features and the constrained text features. Compared with the current prediction based on annotation only, the present invention introduces text input, adds interactive fusion with text features on the basis of extracting image features, so that both image features and text features have stronger feature expression capabilities, and performs loss processing to enable the features of the two modalities to be further aligned in the feature space, so as to realize the multimodal capability of the model.

[0040] In addition, the present invention also provides a virtual human clothing detection device, equipment and readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 A flowchart of a virtual human clothing detection method provided by an embodiment of the present invention;

[0043] Figure 2 A flowchart of a method for detecting clothing of a virtual person provided by an embodiment of the present invention;

[0044] Figure 3 A structural framework diagram of a virtual human clothing detection method provided by an embodiment of the present invention;

[0045] Figure 4 A schematic diagram of a comparison processing module provided by an embodiment of the present invention;

[0046] Figure 5 A schematic diagram of the structure of a virtual human clothing detection device provided by an embodiment of the present invention;

[0047] Figure 6 A schematic diagram of the structure of a virtual human clothing detection device provided by an embodiment of the present invention;

[0048] Attached Figure 5-Figure 6 In the figure, the reference numerals are explained as follows: 100 - feature enhancement module; 200 - comparison processing module; 300 - target position and category prediction module; 10 - memory; 20 - processor; 30 - communication interface; 40 - communication bus. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] In recent years, the research on object detection has made significant progress, and the detection of human clothing has gradually been applied to scenarios such as augmented reality and metaverse.

[0051] The target detection model usually uses the backbone network to extract the image features of the input image, and then uses the detection head to make predictions to obtain the detection results. In the training phase, images with labeled target category objects are input to supervise the detection model. In the inference phase, images containing target category objects are input, and the detection model predicts the target category and outputs the location and category of the target category as the target detection result. The shortcomings of the existing target detection model are as follows: First, the currently widely used target detection models are all supervised training, so they can only complete closed set tasks. That is to say, in the inference phase, the detection model can only effectively predict the categories marked in the training set. If the user wants to detect other categories, the detection model cannot meet the needs well. Secondly, due to the annotation cost of training data and model performance, the granularity of the existing detection model is low. For example, clothes of different styles and colors are all detected as the same category, which is difficult to distinguish further. Finally, the existing detection model usually only accepts image input, which makes it difficult to achieve targeted detection of user-defined input and has low interactivity.

[0052] Please refer to Figure 1 , Figure 1 A flowchart of a virtual human clothing detection method provided by an embodiment of the present invention. The method may include:

[0053] S101, based on text features and image features, image features are enhanced using an image-text mutual attention method, and text features are enhanced using a text-image mutual attention method, to obtain fused image enhancement features and fused text enhancement features; wherein the image features are images including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality.

[0054] The executor of this embodiment is an electronic device. The text features of this embodiment are text features obtained by extracting features from the text input according to the requirements, wherein the specific method of extracting text features is not limited. For example, the text feature extraction method may be term frequency (TF): This is a statistical method used to calculate the number of times a word appears in a document. The term frequency can be used to screen out those words with a high frequency of occurrence, which may be more representative of the subject of the text; or it can be the inverse document frequency (IDF): IDF is an indicator to measure the distribution of words in a document collection. It tends to retain words that appear in a few documents but not in most documents. Such words often have a strong ability to distinguish. Or it can be TF-IDF: It combines term frequency (TF) and inverse document frequency (IDF). Words with higher TF-IDF values ​​can better reflect the characteristics of the document. This embodiment extracts features from the input image to obtain image features. This embodiment does not limit the specific feature extraction method. For example, the image feature extraction method can be SIFT features: Scale-invariant feature transform (SIFT) uses key points and gradient histograms to improve matching efficiency and stability, which is suitable for image recognition and matching problems; or it can also be ORB features: ORB is a fast feature point detection and descriptor extraction method, which is an improvement on SIFT and BRIEF algorithms; or it can also be deep learning feature extraction: With the development of deep learning, deep neural network models are also used for feature extraction, and they can automatically learn complex feature representations. The image-text mutual attention method in this embodiment is a technology for achieving matching between images and texts. It enhances the model's ability to understand cross-modal data through a cross-attention mechanism. The text-image mutual attention method in this embodiment is a technology for enhancing the model's understanding of the visual-semantic similarity between images and texts. It performs image-text matching calculations by combining the association features within and between modalities.

[0055] It can be understood that for image-text mutual attention, the image features are used as the Q matrix, and the text features are used as the K and V matrices:

[0056] .

[0057] in, is the original image feature, is the original text feature, is the number of channels of text features, , , They are the mapping matrices corresponding to Q, K, and V in the image-text mutual attention module, and I represents the image-text mutual attention result.

[0058] Text-image mutual attention, text features as Q matrix, image features as K, V matrix:

[0059] .

[0060] in, represents the text-image mutual attention result (fusion of text enhancement features), is the number of channels of image features, , , They are the mapping matrices corresponding to Q, K, and V in the text-image mutual attention module.

[0061] The two mutual attention modules enable the two features to be fully integrated.

[0062] Further, based on the above embodiment, in order to improve the effect of extracting image features and text features, before the above-mentioned image features are enhanced by the image-text mutual attention method based on text features and image features, it can also include: extracting features from the input image and input text to obtain initial image features and initial text features; enhancing the initial image features and initial text features to obtain text features and the image features. The specific method for enhancing the initial image features is not limited in this embodiment. For example, the method for enhancing the initial image features in this embodiment can be a spatial domain method: this type of method operates directly in the spatial domain of the image, that is, directly processes the pixel grayscale values ​​of the image. This includes point operations, such as adjusting the brightness and contrast of the image, and template processing, such as edge detection and sharpening. Alternatively, the method for enhancing the initial image features in this embodiment may also be a frequency domain method: in this method, the image is regarded as a two-dimensional signal, and operations are performed in the frequency domain by methods such as two-dimensional Fourier transform to enhance the features of the image; or this embodiment may also be a self-attention mechanism, which allows the model to consider the information of all other pixels when processing a certain pixel by calculating the relationship between each pixel or feature point inside the image. This helps to emphasize important features and suppress unimportant features, thereby achieving feature enhancement. This embodiment does not limit the specific method of text feature enhancement. For example, the method of text feature enhancement in this embodiment may be text enhancement based on context information: using context information to enhance text, such as by adding n-gram (language model algorithm based on statistics) features to capture the co-occurrence relationship between words; the method of text feature enhancement in this embodiment may be text enhancement based on a language generation model: using a pre-trained language model to generate new text samples, which can help the model learn richer language patterns; or this embodiment may be enhanced using a self-attention model, which allows the model to consider all other word units in the entire sentence when processing a word unit, so that long-distance dependencies can be captured, thereby enhancing the model's understanding of the text. Dynamic weight assignment: The self-attention mechanism assigns a weight to each word in the input sequence, and this weight is dynamically calculated based on the relationship between word units. In this way, important word units are given higher weights, while unimportant word units are suppressed, thereby enhancing features. Context-aware: When calculating the representation of a word unit, the self-attention model considers the information of the word unit in different contexts. This enables the model to generate different word unit representations depending on the context, thereby enhancing the expressiveness of the features. This embodiment improves the effect of extracting image features and text features by enhancing text features and image features.

[0063] Further, based on any of the above embodiments, in order to improve the relevance between text and image, the above-mentioned method of enhancing image features based on text features and image features using the image-text mutual attention method, and enhancing text features using the text-image mutual attention method, to obtain fused image enhancement features and fused text enhancement features, may include: using the image-text mutual attention method to take text features as inputs of K matrix and V matrix, and image features as outputs of Q matrix, to obtain fused image enhancement features; using the text-image mutual attention method to take image features as inputs of K matrix and V matrix, and text features as outputs of Q matrix, to obtain fused text enhancement features. This embodiment can effectively enhance the feature representation of the fused image by using K matrix and V matrix as inputs, and image features as outputs of Q matrix. The advantages of this mechanism are: enhancing the fitting ability of the model: by using three trainable parameter matrices to generate Q, K, and V matrices, the model can better capture the characteristics of the input data, thereby improving the fitting ability. Global dependency modeling: when processing a certain element, all other elements in the entire input sequence are taken into account, so that long-distance dependencies can be captured, thereby enhancing the representation ability of the feature. Flexibility and scalability: The design of Q, K, and V makes the self-attention mechanism very flexible and scalable, and can be applied to a variety of different tasks and model architectures. Improve the expressiveness of features: Through the self-attention mechanism, the model can automatically assign different weights according to different parts of the input data, which can highlight important information and suppress unimportant information, thereby obtaining a richer and more discriminative feature representation. In summary, through the input of the K matrix and the V matrix and the image features as the output of the Q matrix, not only the fitting ability of the model is enhanced, but also the global dependencies can be captured, improving the expressiveness of features and the calculation of semantic similarity.

[0064] S102, performing pooling processing on the fused image enhancement features to obtain global image features, and performing constraint processing on the global image features and each fused text enhancement feature based on contrast loss to obtain constrained image features and constrained text features.

[0065] This embodiment does not limit the specific pooling processing method. For example, the pooling processing method in this embodiment may be Max Pooling: This is one of the most commonly used pooling methods, which divides the input image into multiple rectangular regions and outputs the maximum value in each sub-region. This method helps to retain the significant features in the image while reducing the spatial size of the data, thereby reducing the amount of calculation and preventing overfitting. Or the pooling processing method in this embodiment may also be Average Pooling: Unlike Maximum Pooling, Average Pooling calculates the average value in each region as the output. This method can smooth the feature map and reduce the impact of noise. The pooling processing method in this embodiment may also be Global Pooling: Global Average Pooling and Global Maximum Pooling are two common global pooling operations, which are usually used in the last layer of the network to convert the feature map into a fixed-length vector for classification or other tasks.

[0066] Further, based on any of the above embodiments, in order to improve the accuracy of constraint processing, the above-mentioned pooling processing is performed on the fused image enhancement features to obtain global image features, and the global image features and each fused text enhancement feature are constrained based on contrast loss to obtain constrained image features and constrained text features, which may include: performing average pooling processing on the fused image enhancement features to obtain global image features; wherein the global image features are ; is the number of image features; calculate the similarity between each global image feature and the fused text enhancement feature , , M represents the number of fused text enhancement features, E represents the fused text enhancement features, is the scaling factor, i represents the subscript of the global image feature, and j represents the subscript of the fused text enhancement feature; the contrast loss L is calculated based on the similarity, , B represents the training batch size, exp represents the exponential function with the natural constant e as the base, The corner mark representing the global image features of the current batch, Indicates the subscript of the current batch of fused text enhancement features, similarity include and Based on the contrast loss, the global image feature and each text feature are constrained to obtain the constrained image feature and the constrained text feature. This embodiment can capture the global information of the entire image through average pooling processing, thereby improving the accuracy of subsequent constraint processing.

[0067] Further, based on any of the above embodiments, in order to improve the accuracy of target category determination, the above prediction of target position and target category based on constrained image features and constrained text features may include: performing category prediction based on the similarity between image enhancement features and text features to obtain predicted classification parameters; determining the target category according to the classification parameters. This embodiment does not limit the specific similarity calculation method. For example, the similarity calculation method in this embodiment can be implemented by methods such as cosine similarity and Euclidean distance. It can be understood that this embodiment determines the similarity between each global image feature and all text features, thereby determining the predicted classification parameters between each global image feature and all text features according to the similarity, and determining the classification parameters that meet the preset threshold from multiple predicted classification parameters. This embodiment calculates the similarity between all text features and each global image feature, thereby determining the classification result according to the similarity. The similarity calculation can accurately measure the similarity between two objects, which helps to make more accurate decisions in classification or matching tasks. For example, there are multiple classification prediction scores, and the text corresponding to the maximum score is selected as the prediction category. For example, if the input text is "cat, dog, person", then the image features obtained by the image are composed of many vectors, each of which can be understood as the feature of a local area, and then the similarity between the vector and the three text features of "cat", "dog", and "person" is calculated respectively. For example, if the vector has the highest similarity with "person", then the prediction is the category "person". At the same time, a threshold is set. If the maximum similarity is also lower than the threshold, the vector is considered to be background, that is, there is no object of the target category in the local area.

[0068] Further, based on any of the above embodiments, in order to improve the accuracy of determining the classification parameters, the above-mentioned category prediction based on the similarity between the global image features and the text features to obtain the predicted classification parameters may include: normalizing the global image features and the text features to obtain normalized global image features and normalized text features; calculating the cosine similarity between each normalized global image feature and each normalized text feature; performing an ablation experiment using the cosine similarity and preset similarity parameters, and processing using an activation function to obtain multiple confidence prediction values ​​corresponding to each global image feature; wherein the number of confidence prediction values ​​is consistent with the number of text features; and determining the predicted classification parameters based on the overlap of the image detection frame and the confidence prediction value.

[0069] This embodiment does not limit the specific preset similarity parameters. The range of the preset similarity parameters in this embodiment is about 10, that is, within the preset numerical range of about 10. In this embodiment, the text features whose overlap of the image detection frame is greater than the preset overlap threshold and the confidence prediction value is greater than the preset value can be used as the category of the image. It can be understood that this embodiment can help identify important modules or hyperparameters in the model through ablation experiments, thereby optimizing the model and removing those parts that have little effect on the performance of the model, thereby simplifying the model structure and reducing the consumption of computing resources. Combined with the overlap information of the image detection frame, it is possible to better handle occlusion, overlap and other problems in practical applications, and improve the generalization ability of the model in complex environments.

[0070] S103, predicting the target position and target category based on the constrained image features and the constrained text features.

[0071] This embodiment predicts the target position and target category based on the constrained image features and the constrained text features. The constrained image features and the constrained text features can be decoded to predict the target position and the target category respectively, wherein the category prediction is the prediction of the classification score based on the similarity of the constrained image features and the constrained text features.

[0072] Further, based on any of the above embodiments, in order to improve the accuracy of recognition, after predicting the target position and target category based on the constrained image features and the constrained text features, it can also include: performing non-maximum suppression processing on the position prediction and the target category to obtain the detection results of each target object. The non-maximum suppression processing of this embodiment can help determine and extract the bounding box that is most likely to represent the target object. By suppressing those lower score boxes that overlap with higher score boxes, it is ensured that only the most likely detection box is output, which helps the model to more accurately identify and locate the target, while improving the computational efficiency and robustness of the model.

[0073] The virtual human clothing detection method provided by the embodiment of the present invention may include: S101, enhancing the image features by using the image-text mutual attention method based on the text features and the image features, and enhancing the text features by using the text-image mutual attention method to obtain fused image enhancement features and fused text enhancement features; wherein the image features are images including the virtual human's clothing, the image-text mutual attention method is a method for realizing information fusion from the text modality to the image modality, and the text-image mutual attention method is a method for realizing information fusion from the image modality to the text modality; S102, performing pooling processing on the fused image enhancement features to obtain global image features, and constraining the global image features and each fused text enhancement feature based on contrast loss to obtain constrained image features and constrained text features; S103, predicting the target position and target category based on the constrained image features and the constrained text features. Compared with the current prediction based only on annotations, the present invention introduces text input, adds an attention module that interacts and fuses with text features on the basis of extracting image features, so that both image features and text features have stronger feature expression capabilities, and performs loss processing to enable the features of the two modalities to be further aligned in the feature space, thereby realizing the multimodal capability of the model; and, this embodiment improves the effect of extracting image features and text features by enhancing text features and image features; and, through the input of K matrix and V matrix and the output of image features as Q matrix, not only the fitting ability of the model is enhanced, but also the global dependency relationship can be captured, thereby improving the feature expression ability and Calculation of semantic similarity; and, this embodiment can capture the global information of the entire image through average pooling processing, thereby providing accuracy for subsequent constraint processing; and, by determining the classification result based on the similarity, the similarity calculation can accurately measure the similarity between two objects, which helps to make more accurate decisions in classification or matching tasks; and, this embodiment can help identify important modules or hyperparameters in the model through ablation experiments, thereby optimizing the model and removing those parts that have little effect on the model performance, thereby simplifying the model structure and reducing the consumption of computing resources; and, by suppressing those lower-score boxes that overlap with higher-score boxes, it is ensured that only the most likely detection box is output. Help the model to more accurately identify and locate targets, while improving the computational efficiency and robustness of the model.

[0074] In order to make the present invention easier to understand, please refer to Figure 2 , Figure 2 The flowchart of a virtual human clothing detection method provided by an embodiment of the present invention may specifically include:

[0075] S201: Obtain input image and input text.

[0076] The structural framework diagram of the virtual human clothing detection method corresponding to this embodiment is as follows: Figure 3 shown. Figure 3 The structural framework diagram of a virtual human clothing detection method provided by an embodiment of the present invention corresponds to the flowchart of a virtual human clothing detection method provided by the embodiment. , input text is .

[0077] S202: Use VIT to process the input image to obtain image features, and use CLIP to process the text to obtain text characteristics.

[0078] This embodiment uses ViT (Vision Transformer, a computer vision model based on deep learning) to obtain image features of the image. The text features of the text are obtained using the text encoder of the CLIP (Contrastive Language-Image Pre-training, a pre-training model for jointly learning text and image representation) model.

[0079] S203: Perform enhancement processing on the image features and the text features to obtain image enhancement features and text enhancement features.

[0080] This embodiment uses two self-attention modules to enhance image features and text features respectively.

[0081] S204. Use the image-text attention method and the text-image mutual attention method to process the image enhancement features and the text enhancement features respectively to obtain fused image enhancement features and fused text enhancement features.

[0082] This embodiment uses the image-text attention module and the text-image attention module in sequence to interactively fuse the features of the two modalities. In the image-text attention module, the text features are input as the K matrix and the V matrix, and the image features are input as the Q matrix to achieve information fusion from the text modality to the image modality. In the text-image attention module, the image features are input as the K matrix and the V matrix, and the text features are input as the Q matrix to achieve information fusion from the image modality to the text modality. The final enhanced image features and enhanced text features are denoted as I and E, respectively.

[0083] S205: Process the fused image enhancement features to obtain global image features.

[0084] In order to further align the image modality and the text modality, this embodiment constrains the two based on the contrast loss. Since the specific semantic information of each vector in the image feature is uncertain, the global image feature is obtained by average pooling, which is recorded as , where N is the number of image feature vectors.

[0085] S206 , constraining the global image features and the fused text enhancement features based on contrast loss to obtain constrained image features and constrained text features.

[0086] In this example, it is assumed that the training batch size is B, the number of text features is M, and in a batch of training data, each global image feature is calculated With text enhancement features Similarity between , which is calculated as: ,in, is the scaling factor. Then the contrast loss is calculated In this embodiment, the global image features and the fused text enhancement features can be constrained based on the contrast loss to obtain the constrained image features and the constrained text features as a contrast processing module. The schematic diagram of the contrast processing module is shown in FIG. Figure 4 As shown, Figure 4 A schematic diagram of a comparison processing module provided in an embodiment of the present invention.

[0087] S207, decoding is performed based on the constrained image features and the constrained text features to predict the target position and the target category; wherein the category prediction predicts the classification score based on the similarity between the constrained image features and the constrained text features.

[0088] S208: Perform non-maximum suppression processing on the target position and target category to obtain detection results of each target object.

[0089] This embodiment performs decoding based on fused image enhancement features and fused text enhancement features, and predicts the target position and target category respectively, wherein the category prediction is based on the similarity with to predict the classification score. After obtaining the position prediction and category prediction, after post-processing such as non-maximum suppression, the detection results of each target object are finally obtained.

[0090] Decoding step: For a vector in the image feature , the classification steps are to calculate

[0091] The similarity with all text features, that is:

[0092] .

[0093] in, is the scaling factor. Note that is the similarity between a single feature vector and the text feature, which is similar to the previous The meaning is different. Each element of is used with the sigmoid function (activation function) to obtain a final confidence prediction with a value between 0 and 1. (For example, if the input text is "dog, cat, person", then M=3, and the confidence of 3 categories is predicted in total), the corresponding category with the largest confidence is taken as the predicted category, and if the maximum confidence is still less than the threshold, it is considered to be the background area (for example, the maximum confidence corresponds to "person", but it is only 0.03, then the probability that the area is a "person" is still very small, so it is predicted as the background).

[0094] Position prediction step: Use the fully connected layer to predict, the input is , the output is 4 dimensions, representing the offset of the center coordinates ( , Two values), width and height offset (dw, dh two values, a total of 4 values, corresponding to 4 dimensions). The predicted offset is applied to the preset anchor box to obtain the final detection box (i.e. position).

[0095] The main technical solutions of the present invention are: 1. Use a large number of public data sets to train the pre-trained model; 2. Use human clothing data to fine-tune the pre-trained model. Figure 3 The overall framework of the present invention is demonstrated. This scheme uses a ready-made pre-trained text encoder, which can extract the features of the user input text; the backbone network uses the Vision Transformer (ViT) to preliminarily extract image features; after obtaining the image features and text features, the self-attention module, the image-text mutual attention module, and the text-image mutual attention module are used in turn to fully fuse the features of the two to obtain enhanced image features and enhanced text features; finally, the final position prediction and category prediction are performed based on the enhanced features to obtain the detection box.

[0096] The embodiment of the present invention introduces the text modality, adds text input on the basis of image input, utilizes the mutual attention module to fully integrate the features of the two modalities, and utilizes contrastive learning to further align the two in the feature space, ultimately realizing multimodal detection of the model, improving detection performance, and improving the interactivity between users and the detection model.

[0097] The following is an introduction to a virtual human clothing detection device provided by an embodiment of the present invention. The virtual human clothing detection device described below and the virtual human clothing detection method described above can be referenced to each other.

[0098] Please refer to Figure 5 , Figure 5 A schematic diagram of a virtual human clothing detection device provided by an embodiment of the present invention may include:

[0099] The feature enhancement module 100 is used to enhance the image feature by using the image-text mutual attention method based on the text feature and the image feature, and to enhance the text feature by using the text-image mutual attention method, so as to obtain a fused image enhancement feature and a fused text enhancement feature; wherein the image feature is an image including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality;

[0100] A contrast processing module 200 is used to perform pooling processing on the fused image enhancement feature to obtain a global image feature, and to perform constraint processing on the global image feature and each fused text enhancement feature based on contrast loss to obtain a constrained image feature and a constrained text feature;

[0101] The target position and category prediction module 300 is used to predict the target position and target category respectively based on the constrained image features and the constrained text features.

[0102] It should be further explained that, based on the above embodiment, the above virtual human clothing detection method may further include:

[0103] An initial image feature determination module is used to extract features from an input image and input text to obtain initial image features and initial text features;

[0104] The initial enhancement processing module is used to perform enhancement processing on the initial image features and the initial text features to obtain the text features and the image features.

[0105] It should be further explained that, based on any of the above embodiments, the feature enhancement module 100 may include:

[0106] A text feature enhancement unit, used to use the image-text mutual attention method to take the text features as inputs of a K matrix and a V matrix, and the image features as outputs of a Q matrix, to obtain the fused image enhancement features;

[0107] The image feature enhancement unit is used to use the text-image mutual attention method to take the image features as the input of the K matrix and the V matrix, and the text features as the output of the Q matrix to obtain the fused text enhancement features.

[0108] It should be further explained that, based on any of the above embodiments, the above comparison processing module 200 may include:

[0109] The average pooling processing unit is used to perform average pooling processing on the fused image enhancement feature to obtain the global image feature; wherein the global image feature ; N is the number of image features;

[0110] Similarity determination unit, used to calculate the similarity between each global image feature and the fused text enhancement feature , , M represents the number of fused text enhancement features, E represents the fused text enhancement features, is the scaling factor, i represents the subscript of the global image feature, and j represents the subscript of the fused text enhancement feature;

[0111] a contrast loss determining unit, configured to calculate the contrast loss L based on the similarity, , where B represents the training batch size, and exp represents an exponential function with the natural constant e as the base. The corner mark representing the global image features of the current batch, The subscript representing the fused text enhancement features of the current batch, the similarity include and ;

[0112] The constraint processing unit is used to constrain the global image feature and each text feature based on the contrast loss to obtain the constrained image feature and the constrained text feature.

[0113] It should be further explained that, based on the above embodiment, the target position and category prediction module 300 may include:

[0114] A classification parameter determination unit, configured to perform category prediction based on the similarity between the global image feature and the text feature to obtain a predicted classification parameter;

[0115] The target category determination unit is used to determine the target category according to the classification parameter.

[0116] It should be further explained that, based on the above embodiment, the above classification parameter determination unit may include:

[0117] A normalization subunit, used for normalizing the global image features and the text features to obtain normalized global image features and normalized text features;

[0118] A cosine similarity determination subunit, used to calculate the cosine similarity between each of the normalized global image features and each of the normalized text features;

[0119] A confidence prediction value determination subunit is used to perform an ablation experiment using cosine similarity and a preset similarity parameter, and then process using an activation function to obtain a plurality of confidence prediction values ​​corresponding to each of the global image features; wherein the number of the confidence prediction values ​​is consistent with the number of text features;

[0120] The classification parameter determination subunit is used to determine the predicted classification parameter according to the overlap degree of the image detection frame and the confidence prediction value.

[0121] It should be further explained that, based on any of the above embodiments, the above virtual human clothing detection method may further include:

[0122] The detection result determination module is used to perform non-maximum suppression processing on the position prediction and the target category to obtain the detection result of each target object.

[0123] It should be noted that the order of the modules and units in the above-mentioned virtual human clothing detection device can be changed without affecting the logic.

[0124] The virtual human clothing detection device provided by the embodiment of the present invention may include: a feature enhancement module 100, which is used to enhance the image feature based on the text feature and the image feature using the image-text mutual attention method, and enhance the text feature using the text-image mutual attention method to obtain a fused image enhancement feature and a fused text enhancement feature; wherein the image feature is an image including the clothing of the virtual person, the image-text mutual attention method is a method for realizing information fusion from the text modality to the image modality, and the text-image mutual attention method is a method for realizing information fusion from the image modality to the text modality; a contrast processing module 200, which is used to perform pooling processing on the fused image enhancement feature to obtain a global image feature, and constrain the global image feature and each fused text enhancement feature based on the contrast loss to obtain a constrained image feature and a constrained text feature; a target position and category prediction module 300, which is used to predict the target position and target category respectively based on the constrained image feature and the constrained text feature. Compared with the current prediction based only on annotations, the present invention introduces text input, adds an attention module that interacts and fuses with text features on the basis of extracting image features, so that both image features and text features have stronger feature expression capabilities, and performs loss processing to enable the features of the two modalities to be further aligned in the feature space, thereby realizing the multimodal capability of the model; and, this embodiment improves the effect of extracting image features and text features by enhancing text features and image features; and, through the input of K matrix and V matrix and the output of image features as Q matrix, not only the fitting ability of the model is enhanced, but also the global dependency relationship can be captured, thereby improving the feature expression ability and Calculation of semantic similarity; and, this embodiment can capture the global information of the entire image through average pooling processing, thereby providing accuracy for subsequent constraint processing; and, by determining the classification result based on the similarity, the similarity calculation can accurately measure the similarity between two objects, which helps to make more accurate decisions in classification or matching tasks; and, this embodiment can help identify important modules or hyperparameters in the model through ablation experiments, thereby optimizing the model and removing those parts that have little effect on the model performance, thereby simplifying the model structure and reducing the consumption of computing resources; and, by suppressing those lower-score boxes that overlap with higher-score boxes, it is ensured that only the most likely detection box is output. Help the model to more accurately identify and locate targets, while improving the computational efficiency and robustness of the model.

[0125] A virtual human clothing detection device provided by an embodiment of the present invention is introduced below. The virtual human clothing detection device described below and the virtual human clothing detection method described above can refer to each other.

[0126] Please refer to Figure 6 , Figure 6 A schematic diagram of a virtual human clothing detection device provided by an embodiment of the present invention may include:

[0127] A memory 10, used for storing computer programs;

[0128] The processor 20 is used to execute a computer program to implement the above-mentioned virtual human clothing detection method.

[0129] The memory 10 , the processor 20 , and the communication interface 30 all communicate with each other via a communication bus 40 .

[0130] In the embodiment of the present invention, the memory 10 is used to store one or more programs, and the program may include program code, and the program code includes computer operation instructions. In the embodiment of the present invention, the memory 10 may store programs for implementing the following functions:

[0131] Based on the text features and the image features, the image features are enhanced by using the image-text mutual attention method, and the text features are enhanced by using the text-image mutual attention method, so as to obtain the fused image enhancement features and the fused text enhancement features; wherein the image features are images including the clothes of the virtual person, the image-text mutual attention method is a method for realizing the information fusion from the text modality to the image modality, and the text-image mutual attention method is a method for realizing the information fusion from the image modality to the text modality;

[0132] Pooling is performed on the fused image enhancement features to obtain global image features, and constraining is performed on the global image features and each fused text enhancement feature based on contrast loss to obtain constrained image features and constrained text features;

[0133] The target location and target category are predicted based on the constrained image features and the constrained text features.

[0134] In a possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0135] In addition, the memory 10 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0136] The processor 20 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device, a microprocessor or any conventional processor, etc. The processor 20 may call a program stored in the memory 10 .

[0137] The communication interface 30 may be an interface of a communication module, and is used to connect to other devices or systems.

[0138] Of course, it should be noted that Figure 6 The structure shown does not constitute a limitation on the clothing detection device for a virtual person in the embodiment of the present invention. In actual applications, the clothing detection device for a virtual person may include Figure 6 More or fewer components than shown, or combinations of certain components.

[0139] The following is an introduction to a readable storage medium provided in an embodiment of the present invention. The readable storage medium described below and the virtual human clothing detection method described above can be referenced to each other.

[0140] The present invention also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned virtual human clothing detection method are implemented.

[0141] The readable storage medium may include: 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, and other media that can store program codes.

[0142] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0143] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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 the present invention.

[0144] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0145] The above is a detailed introduction to a virtual human clothing detection method, device, equipment and readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for detecting clothing of a virtual person, characterized in that: include: Based on the text features and the image features, the image features are enhanced by using the image-text mutual attention method, and the text features are enhanced by using the text-image mutual attention method, so as to obtain fused image enhancement features and fused text enhancement features; wherein the image features are images including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality; Performing pooling processing on the fused image enhancement feature to obtain a global image feature, and performing constraint processing on the global image feature and each of the fused text enhancement features based on contrast loss to obtain a constrained image feature and a constrained text feature; Predicting a target location and a target category based on the constrained image features and the constrained text features; The step of performing pooling processing on the fused image enhancement feature to obtain a global image feature, and performing constraint processing on the global image feature and each of the fused text enhancement features based on contrast loss to obtain a constrained image feature and a constrained text feature includes: Perform average pooling processing on the fused image enhancement feature to obtain the global image feature; wherein the global image feature is ; N is the number of image features; Calculate the similarity between each global image feature and the fused text enhancement feature , , M represents the number of fused text enhancement features, E represents the fused text enhancement features, is the scaling factor, i represents the subscript of the global image feature, and j represents the subscript of the fused text enhancement feature; Calculate the contrast loss L based on the similarity, , where B represents the training batch size, and exp represents an exponential function with the natural constant e as the base. The corner mark representing the global image features of the current batch, The subscript representing the fused text enhancement features of the current batch, the similarity include and ; The global image feature and each text feature are constrained based on the contrast loss to obtain the constrained image feature and the constrained text feature.

2. The virtual human clothing detection method according to claim 1, characterized in that: Before enhancing the image features by using the image-text mutual attention method based on the text features and the image features, the method further includes: Extract features of the input image and input text to obtain initial image features and initial text features; The initial image features and the initial text features are enhanced to obtain the text features and the image features.

3. The method for detecting clothing of a virtual person according to claim 1, characterized in that: The method of enhancing the image features by using an image-text mutual attention method based on the text features and the image features, and enhancing the text features by using a text-image mutual attention method, to obtain fused image enhancement features and fused text enhancement features, includes: The image-text mutual attention method is used to take the text features as input of the K matrix and the V matrix, and the image features as output of the Q matrix, to obtain the fused image enhancement features; The text-image mutual attention method is used to take the image features as inputs of the K matrix and the V matrix, and the text features as outputs of the Q matrix, to obtain the fused text enhancement features.

4. The method for detecting clothing of a virtual person according to claim 1, characterized in that: The predicting of the target position and the target category based on the constrained image features and the constrained text features includes: Performing category prediction based on the similarity between the global image features and the text features to obtain predicted classification parameters; The target category is determined according to the classification parameters.

5. The method for detecting clothing of a virtual person according to claim 4, characterized in that: The performing category prediction based on the similarity between the global image feature and the text feature to obtain the predicted classification parameters includes: Normalizing the global image features and the text features to obtain normalized global image features and normalized text features; Calculating the cosine similarity between each of the normalized global image features and each of the normalized text features; After performing an ablation experiment using the cosine similarity and a preset similarity parameter, and processing using an activation function, a plurality of confidence prediction values ​​corresponding to each of the global image features are obtained; wherein the number of the confidence prediction values ​​is consistent with the number of text features; The predicted classification parameter is determined according to the overlap degree of the image detection frame and the confidence prediction value.

6. The method for detecting clothing of a virtual person according to claim 1, characterized in that: After predicting the target position and target category based on the constrained image features and the constrained text features, the method further includes: Non-maximum suppression processing is performed on the position prediction and the target category to obtain detection results of each target object.

7. A virtual human clothing detection device, characterized in that: include: A feature enhancement module, used for enhancing the image feature by using an image-text mutual attention method based on text features and image features, and enhancing the text feature by using a text-image mutual attention method, to obtain a fused image enhancement feature and a fused text enhancement feature; wherein the image feature is an image including clothes of a virtual person, the image-text mutual attention method is a method for realizing information fusion from text modality to image modality, and the text-image mutual attention method is a method for realizing information fusion from image modality to text modality; A contrast processing module, used for performing pooling processing on the fused image enhancement feature to obtain a global image feature, and performing constraint processing on the global image feature and each of the fused text enhancement features based on contrast loss to obtain a constrained image feature and a constrained text feature; A target position and category prediction module, used for predicting a target position and a target category based on the constrained image features and the constrained text features; Among them, the contrast processing module includes: The average pooling processing unit is used to perform average pooling processing on the fused image enhancement feature to obtain the global image feature; wherein the global image feature is ; N is the number of image features; Similarity determination unit, used to calculate the similarity between each global image feature and the fused text enhancement feature , , M represents the number of fused text enhancement features, E represents the fused text enhancement features, is the scaling factor, i represents the subscript of the global image feature, and j represents the subscript of the fused text enhancement feature; a contrast loss determining unit, configured to calculate the contrast loss L based on the similarity, , where B represents the training batch size, and exp represents an exponential function with the natural constant e as the base. The corner mark representing the global image features of the current batch, The subscript representing the fused text enhancement features of the current batch, the similarity include and ; The constraint processing unit is used to constrain the global image feature and each text feature based on the contrast loss to obtain the constrained image feature and the constrained text feature.

8. A virtual human clothing detection device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the virtual human clothing detection method as described in any one of claims 1 to 6 when executing the computer program.

9. A readable storage medium, characterized in that: The readable storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the virtual human clothing detection method as described in any one of claims 1 to 6 are implemented.