A clothing recognition method, system, medium and device

By using the multi-scale feature fusion technology of the coloring network and YOLOv5 model combined with the coordinate attention module in surveillance videos, the problem of clothing recognition in low-definition videos is solved, and the accuracy and efficiency of pedestrian clothing recognition in surveillance videos are improved.

CN115100681BActive Publication Date: 2024-10-15JINAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210721153.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2024-10-15
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

It is difficult for existing technology to effectively identify pedestrians' clothing in low-definition surveillance videos, resulting in low work efficiency for video surveillance personnel.

Method used

A coloring network is used to color-fill black-and-white videos and a full-color image database is constructed. Combined with the YOLOv5 model and the coordinate attention module, the accuracy of clothing recognition is improved through multi-scale feature fusion and composite detection.

Benefits of technology

It improves the accuracy and efficiency of clothing recognition, is suitable for camera video environments in various scenarios, expands the size of the data set, and enhances the plasticity and applicability of recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115100681B_ABST
    Figure CN115100681B_ABST
Patent Text Reader

Abstract

The present invention discloses a clothing recognition method, system, medium and equipment, which includes the following steps: obtaining camera videos in multiple scenes, coloring the black and white videos therein, integrating to obtain a full-color image database, deframing and annotating the image database, constructing a clothing data set, constructing a clothing recognition network based on a YOLOv5 model, adding a coordinate attention module at the end of the backbone network layer, replacing the splicing module in the YOLOv5 model with a Concat_bifpn module in the Neck network layer; training a clothing recognition network based on the clothing data set; performing composite detection, recognizing the characters in the test set based on the YOLOv5 model, cropping and extracting to obtain a portrait result set, and inputting the clothing recognition network to obtain a clothing recognition result image set. The present invention solves the problem of difficult target detection in a camera environment, and achieves an efficient target detection effect with a balance between accuracy and speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image analysis of computer vision, and in particular to a clothing recognition method, system, medium and equipment. Background Art

[0002] In recent years, video surveillance has been installed in every street, community, shopping mall and supermarket in the city. Every day, the video surveillance in every street, community, shopping mall and supermarket in the country generates a massive data flow in TB units. With the rapid development of information technology in the future, it may reach a higher order of magnitude. People receive more and more information, which is becoming more and more complex. However, not all of this massive data is what people need. So people began to think about how to use image processing technology to solve this problem - mining valuable information from massive video data.

[0003] In video surveillance, pedestrians are one of the main targets, so the study of their effective identification is particularly important. People recognition generally refers to facial recognition, but due to the low clarity of surveillance images, it is very difficult to identify different pedestrians through facial recognition, so many researchers focus on the problem of pedestrian appearance recognition in video images. If effective appearance recognition can be performed, such as effectively identifying the color or type of clothing of pedestrians in the video, combined with video retrieval technology, the work efficiency of video surveillance personnel can be improved. Therefore, it is of great practical significance to study how to improve the accuracy and efficiency of clothing recognition algorithms to meet actual needs. Summary of the invention

[0004] In order to overcome the defects and shortcomings of the prior art, the present invention provides a clothing recognition method, which collects camera videos, performs preprocessing, passes the videos through a coloring network to obtain colored video images, and annotates them after de-framing to form a data set for training the clothing recognition model so that it can be used for clothing recognition tasks in this scenario. Finally, a composite detection method is used to improve the recognition accuracy.

[0005] A second object of the present invention is to provide a clothing recognition system.

[0006] A third object of the present invention is to provide a storage medium.

[0007] A fourth object of the present invention is to provide a computing device.

[0008] In order to achieve the above object, the present invention adopts the following technical solutions:

[0009] The present invention provides a clothing recognition method, comprising the following steps:

[0010] Obtain camera videos in multiple scenes, divide them into black and white videos and non-black and white videos, fill the black and white videos with colors through a coloring network, and integrate the colored videos with the non-black and white videos to obtain a full-color image database;

[0011] Deframe the full-color image database, annotate the valid data images, and construct a clothing dataset;

[0012] A clothing recognition network is built based on the YOLOv5 model, which has a backbone network layer, a neck network layer, and an output layer connected in sequence.

[0013] Add a coordinate attention module at the end of the backbone network layer. The coordinate attention module uses the coordinate attention mechanism to obtain feature information.

[0014] In the Neck network layer, the concatenation module in the YOLOv5 model is replaced with the Concat_bifpn module that integrates the multi-scale feature fusion algorithm to fuse the features of the shallow network and the deep network, and learn the importance of different input features by presetting learnable weights;

[0015] The Neck network layer is provided with a plurality of Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with a plurality of prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head;

[0016] The first fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fifth fusion module through the next layer;

[0017] The second fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fourth fusion module through the next layer;

[0018] The third fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, it is output to the first prediction head of the output layer through the next layer, and outputs the first scale feature;

[0019] The fourth fusion module fuses the output of the previous layer, the output of the next layer of the second fusion module, and the output of the backbone network layer, and after fusion, outputs it to the second prediction head of the output layer through the next layer to output the second scale feature;

[0020] The fifth fusion module fuses the output of its previous layer, the output of the next layer of the first fusion module, and the output of the backbone network layer, and after fusion, outputs it to the third prediction head of the output layer through the next layer, and outputs the third scale feature;

[0021] The sixth fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, outputs it to the fourth prediction head of the output layer through the next layer, and outputs the fourth scale feature;

[0022] The coordinate attention module outputs features to the first fusion module after passing through the convolution layer and upsampling layer;

[0023] Training clothing recognition network based on clothing dataset;

[0024] Perform composite detection, identify the characters in the test set based on the YOLOv5 model, crop and extract to obtain the portrait result set, input the portrait result set into the clothing recognition network for recognition, and obtain the clothing recognition result image set.

[0025] As a preferred technical solution, the coloring network includes an instance coloring network and a full image coloring network, which respectively perform instance coloring and full image coloring, and the instance coloring network and the full image coloring network perform end-to-end training at corresponding levels;

[0026] The instance colorization network and the full-image colorization network extract instance image features and full-image features. After multi-layer convolutional layer training, the full-image weights and instance weights are obtained. The instance image features and instance weights are combined to form the full-image feature size. The full-image features and each group of instance image features are weightedly fused according to the corresponding weights to obtain the colored image, and then the colored video image is obtained.

[0027] As a preferred technical solution, the coordinate attention module adopts the coordinate attention mechanism to obtain feature information. The specific calculation process is:

[0028] The coordinate attention module decomposes each input feature from dimensions h and w. The decomposed tensors are processed by global pooling to generate tensors X. h and the tensor X w , the concatenated tensor X is input into the convolutional block h and X w Generate an encoded Y, specifically expressed as:

[0029]

[0030] in, Indicates connection X w and X h , * represents the convolution operation, G and f represent the normalization and activation functions respectively, and W represents the convolution filter;

[0031] Split Y again to get and , specifically expressed as:

[0032] ;

[0033] in, Split ()express Split Function, used to split the string;

[0034] Convolution and activation and , the final output is:

[0035]

[0036] Among them, F represents convolution, Represents the activation function.

[0037] As a preferred technical solution, the Concat_bifpn module learns the importance of different input features by presetting learnable weights. The weight of each input layer is specifically expressed as:

[0038]

[0039] in, X i represents the input of each layer, W i represents the weight of each input layer, represents a constant;

[0040] The output is expressed as:

[0041]

[0042] Among them, Y fin Indicates the output result, Conv represents the convolution operation, Relu is the activation function, and N represents the number of input layers.

[0043] As a preferred technical solution, the first fusion module fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the first fusion module, and outputs the fusion to the C3 module of the next layer of the first fusion module.

[0044] The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head of the output layer;

[0045] The second fusion module fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module;

[0046] The fourth fusion module fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head of the output layer;

[0047] The third fusion module fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head of the output layer;

[0048] The sixth fusion module fuses the output of the eleventh layer of the backbone network layer with the convolutional layer of the previous layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head of the output layer;

[0049] The C3 module includes 3 convolutional layers plus a BottleneckCSP module.

[0050] In order to achieve the above second purpose, the present invention adopts the following technical solutions:

[0051] A clothing recognition system, comprising: a video acquisition module, a video segmentation module, a coloring module, an image database construction module, a video de-framing module, a labeling module, a clothing data set construction module, a clothing recognition network construction module, a clothing recognition network training module and a composite detection module;

[0052] The video acquisition module is used to acquire camera videos in multiple scenes;

[0053] The video division module is used to divide the video into black and white video and non-black and white video;

[0054] The coloring module is used to fill the black and white video with color through the coloring network.

[0055] The image database construction module is used to integrate the colored video with the non-black and white video to obtain a full-color image database;

[0056] The video de-framing module is used to de-frame the full-color image database;

[0057] The labeling module is used to label the valid data images;

[0058] The clothing data set construction module is used to construct a clothing data set;

[0059] The clothing recognition network construction module is used to construct a clothing recognition network based on the YOLOv5 model, and is provided with a backbone network layer, a Neck network layer and an output layer connected in sequence;

[0060] Add a coordinate attention module at the end of the backbone network layer. The coordinate attention module uses the coordinate attention mechanism to obtain feature information.

[0061] In the Neck network layer, the concatenation module in the YOLOv5 model is replaced with the Concat_bifpn module that integrates the multi-scale feature fusion algorithm to fuse the features of the shallow network and the deep network, and learn the importance of different input features by presetting learnable weights;

[0062] The Neck network layer is provided with a plurality of Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with a plurality of prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head;

[0063] The first fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fifth fusion module through the next layer;

[0064] The second fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fourth fusion module through the next layer;

[0065] The third fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, it is output to the first prediction head of the output layer through the next layer, and outputs the first scale feature;

[0066] The fourth fusion module fuses the output of the previous layer, the output of the next layer of the second fusion module, and the output of the backbone network layer, and after fusion, outputs it to the second prediction head of the output layer through the next layer to output the second scale feature;

[0067] The fifth fusion module fuses the output of its previous layer, the output of the next layer of the first fusion module, and the output of the backbone network layer, and after fusion, outputs it to the third prediction head of the output layer through the next layer, and outputs the third scale feature;

[0068] The sixth fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, outputs it to the fourth prediction head of the output layer through the next layer, and outputs the fourth scale feature;

[0069] The coordinate attention module outputs features to the first fusion module after passing through the convolution layer and upsampling layer;

[0070] The clothing recognition network training module is used to train the clothing recognition network based on the clothing data set;

[0071] The composite detection module is used to perform composite detection, identify the characters in the test set based on the YOLOv5 model, crop and extract to obtain a portrait result set, input the portrait result set into the clothing recognition network for recognition, and obtain a clothing recognition result image set.

[0072] As a preferred technical solution, the coloring network includes an instance coloring network and a full image coloring network, which respectively perform instance coloring and full image coloring, and the instance coloring network and the full image coloring network perform end-to-end training at corresponding levels;

[0073] The instance colorization network and the full-image colorization network extract instance image features and full-image features. After multi-layer convolutional layer training, the full-image weights and instance weights are obtained. The instance image features and instance weights are combined to form the full-image feature size. The full-image features and each group of instance image features are weightedly fused according to the corresponding weights to obtain the colored image, and then the colored video image is obtained.

[0074] As a preferred technical solution, the first fusion module fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the first fusion module, and outputs the fusion to the C3 module of the next layer of the first fusion module.

[0075] The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head of the output layer;

[0076] The second fusion module fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module;

[0077] The fourth fusion module fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head of the output layer;

[0078] The third fusion module fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head of the output layer;

[0079] The sixth fusion module fuses the output of the eleventh layer of the backbone network layer with the convolutional layer of the previous layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head of the output layer;

[0080] The C3 module includes 3 convolutional layers plus a BottleneckCSP module.

[0081] In order to achieve the third objective, the present invention adopts the following technical solutions:

[0082] A computer-readable storage medium stores a program, and when the program is executed by a processor, the clothing recognition method as described above is implemented.

[0083] In order to achieve the fourth objective, the present invention adopts the following technical solutions:

[0084] A computing device includes a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the clothing recognition method as described above is implemented.

[0085] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0086] (1) The present invention fuses the output of the original YOLOv5 model with that of the improved deep neural network model, and constructs a data set adapted to the target detection environment for collaborative training with the deep neural network, thereby solving the problem of target detection difficulty in a camera environment and achieving an efficient target detection effect with a balance between accuracy and speed.

[0087] (2) Most of the common clothing recognition methods use pictures taken in a studio environment for recognition. When the clarity is very high, the recognition effect is better. However, the image data taken by the camera has a relatively low clarity. The present invention directly uses the clothing recognition network for recognition in a complex camera video environment. Clothing recognition is performed based on image data with low clarity, and the detection range is wider.

[0088] (3) The present invention adds a colorization network in the preprocessing stage, which can perform colorization on night camera videos in various scenarios. The colorization effect is also good with high accuracy, and the original color of the scene can be well restored, so that the black and white camera video is no longer invalid and meaningless training data, which expands the scale of the data set. At the same time, it also has good scalability and plasticity and can be applied to various scenarios and fields.

[0089] (4) The clothing recognition network of the present invention directly processes the camera video environment. It is based on the YOLO algorithm and integrates multiple detection heads, coordinate attention mechanism and multi-scale feature fusion. Compared with the existing classic model, the present invention is more efficient and faster, and adopts a composite detection method to limit the recognition range, thereby improving the recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 Schematic diagram of the framework of the clothing recognition method of the present invention;

[0091] Figure 2 It is a schematic diagram of the framework of the coloring network of the present invention;

[0092] Figure 3 A schematic diagram of a framework constructed for the clothing dataset of the present invention;

[0093] Figure 4 Schematic diagram of each level structure of the clothing recognition network of the present invention;

[0094] Figure 5 It is a schematic diagram of the framework of the composite detection of the present invention. DETAILED DESCRIPTION

[0095] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0096] Example 1

[0097] like Figure 1 As shown, a clothing recognition method comprises the following steps:

[0098] S1: Build a video database, input the video image to be processed, and use the coloring network to colorize it, thereby converting the originally unusable black and white type video into valid data, expanding the scale of the database and improving recognition;

[0099] like Figure 2 As shown, the specific steps of establishing the video database in step S1 are as follows:

[0100] S11. Video collection and classification. Collect camera videos in various scenarios and classify them into black-and-white videos and non-black-and-white videos. If the video is black-and-white, it needs to be filled with color through a coloring network to improve recognition;

[0101] S12. Establish a coloring network model. By constructing two end-to-end trained backbone networks, including an instance coloring network and a full image coloring network, instance coloring and full image coloring are performed, and then two corresponding layers of the coloring network are constructed to perform end-to-end trained full convolutional neural networks;

[0102] S13, establish a fusion module. The features extracted from the instance coloring network and the full image coloring network are passed through three convolutional layers to learn the full image weight and the instance weight, and then the instance image features and the instance weight are combined to form the full image feature size. Finally, the full image features and each group of instance image features are weighted fused according to the corresponding weights to obtain the colored image, and then the colored video image is obtained.

[0103] S2: Establish a clothing dataset, integrate videos of various scenes, deframe the videos, and annotate valid data images through high-precision manual annotation to form an annotated usable training dataset;

[0104] like Figure 3 As shown, the specific steps of establishing the data set in step S2 are as follows:

[0105] S21: Integrate valid data: Integrate the colored video in step S11 with the non-black and white video, filter out distorted data, integrate the colored video with the non-black and white video, cover the surveillance video environment of multiple scenes and multiple applications, eliminate the non-scalability caused by a single scene to a certain extent, and build a video database;

[0106] S22: Dataset annotation: First, the integrated valid video data is deframed, and then the annotation tools are used to annotate the valid data images (with high image resolution and detection targets) (the annotation content is mainly headwear, tops, pants, shoes, and handheld objects) to establish a clothing dataset.

[0107] S3: Construct a clothing recognition network. Based on the YOLO algorithm, modify the model structure and adjust the model parameters under experimental conditions, retain effective model improvement strategies, and integrate three methods: multi-detection head, coordinate attention mechanism, and multi-scale feature fusion. This makes the network more suitable for recognition and detection under camera environments, and more efficiently uses the previously constructed data set for training, obtaining a clothing recognition model with good adaptation and improved effects.

[0108] like Figure 4 As shown, the clothing recognition model is built based on the original YOLOv5 model, and is provided with a backbone network Backbone, a Neck (PANet) network layer and an output layer Output connected in sequence. The Neck network layer is provided with multiple Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with multiple prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head;

[0109] like Figure 4 As shown in the figure, the Focus structure represents a slicing operation. For example, the original 608*608*3 image is input into the Focus structure. After the slicing operation, it first becomes a 304*304*12 feature map, and then undergoes a convolution operation with 32 convolution kernels, and finally becomes a 304*304*32 feature map. The arrow indicates to which layer the feature map obtained by this layer is passed.

[0110] The Conv module represents a normal convolution operation. The C3 module consists of three Conv layers plus a BottleneckCSP module. The BottleneckCSP module is used to extract deep semantic information of images in the Backbone network and to fuse feature maps of different scales in the Neck network to enrich semantic information. The SPP module is also called the feature pyramid model, which uses spatial pyramid pooling to convert feature maps of any size into feature vectors of fixed size. The coordinate attention module CoordAtt uses the coordinate attention mechanism. The Concat_bifpn module represents a concatenation module that integrates a multi-scale feature fusion algorithm. The Upsample module represents an upsampling module.

[0111] P3, P4, P5, and P6 represent prediction heads. The feature maps obtained by the four prediction heads are integrated to finally obtain the output result. The original YOLOv5 module only contains three prediction heads. After analyzing the existing data, it is found that the data captured by the camera has proportionally reduced the person, and the recognizable area of ​​the person's clothing has also become smaller accordingly, resulting in the person's clothing being less obvious. Therefore, this embodiment adds a prediction head for small objects. The multiple prediction head structure of this embodiment can detect a wider range of scales and can cope with the negative impact caused by the drastic change of the object's scale.

[0112] A coordinate attention module CoordAtt is added to the end of the Backbone network of the YOLOv5 model. CoordAtt is used to capture cross-channel information, as well as direction perception and position perception information, to help the model locate and identify targets of interest more accurately.

[0113] Specifically, each input X is decomposed into dimensions h and w, and the decomposed tensors are processed by global pooling to generate X h and X w In particular, decomposition before pooling helps preserve spatial location information. The concatenated tensor X is input to the convolutional block. h and X w will generate an encoded Y that incorporates X w and X h This series of operations is described as follows:

[0114]

[0115] in, Indicates connection X w and X h , * represents the convolution operation, G and f represent the normalization and activation functions respectively, and W represents the convolution filter;

[0116] Split Y again to get and , specifically expressed as:

[0117] ;

[0118] in, Split ()express Split Function, used to split the string;

[0119] Convolution and activation and , the final output is:

[0120]

[0121] Among them, F represents convolution, Represents the activation function, which is specifically expressed as:

[0122]

[0123] Through the above operations, the model can more accurately locate and identify targets of interest.

[0124] In this embodiment, the idea of ​​multi-scale features is used to replace the ordinary splicing module in the original YOLOv5 model with a splicing module that integrates BiFPN, that is, the Concat_bifpn module in the figure, which integrates the features of the shallow network and the deep network. Figure 4 In the direction indicated by the middle arrow, features are transferred from the shallow module to the deep module for feature fusion, and the importance of different input features is learned by giving learnable weights. The operation is repeated many times, and multi-scale feature fusion from top to bottom and bottom to top is performed to increase the recognition accuracy of the model.

[0125] The weight of each input layer is specifically expressed as:

[0126]

[0127] in, X i represents the input of each layer, W i represents the weight of each input layer, represents a constant, set to 0.0001;

[0128] The output is expressed as:

[0129]

[0130] Among them, Y fin Indicates the output result, Conv represents the convolution operation, Reluis the activation function, and N represents the number of input layers.

[0131] Through feature fusion and mapping, semantic features and spatial geographic features can be migrated in networks of different depths. This method is beneficial to the model's ability to extract and express features and improve the overall detection performance.

[0132] Combination Figure 4 As shown in the figure, Focus is regarded as the 0th layer, and the arrows indicate the transmission relationship between each layer. The first fusion module (the fifteenth layer) fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the first fusion module, and then outputs it to the C3 module of the next layer of the first fusion module.

[0133] The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head (P5) of the output layer;

[0134] The second fusion module (layer 19) fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module;

[0135] The fourth fusion module (the 26th layer) fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head (P4) of the output layer;

[0136] The third fusion module (the 23rd layer) fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head (P3) of the output layer;

[0137] The sixth fusion module (32nd layer) fuses the output of the eleventh layer of the backbone network layer with the previous convolutional layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head (P6) of the output layer.

[0138] The clothing dataset obtained in step S22 is used to train the clothing recognition model, and the clothing recognition model is applied to detection in a camera video environment, where the detection content includes headwear, tops, pants, shoes, handheld objects, etc.;

[0139] During the training process, the model parameters are adjusted, and methods such as data enhancement and regularization are used to prevent overfitting, making the model more suitable for clothing recognition detection. The clothing recognition model is obtained through training.

[0140] Table 1 shows the comparison of various indicators of several commonly used methods and the core detection model used in the method of the present invention:

[0141] Table 1 Comparison of various indicators of existing common technical methods and the method of this embodiment

[0142]

[0143] S4: Perform composite detection, first use the general YOLOv5 model to identify the people in the test set, identify the person images in the test set at a higher speed, perform cropping and extraction, and then put the processed detection source into the clothing recognition detection network for higher precision recognition detection. This method can reduce the recognition error rate and prevent the physical misidentification of other colors similar to clothes from being the data category of the embodiment.

[0144] like Figure 5 As shown, the specific steps of performing composite detection in step S4 are as follows:

[0145] S41: Put the data to be detected into the general YOLOv5 model to detect the portrait. The data set used by the general YOLOv5 model is the MSCOCO data set, which covers 80 categories. The data set has very mature human detection performance, so the data is used to train YOLOv5, and the model is used to detect the overall portrait, and the detected overall portrait coordinates are fed back;

[0146] S42: The overall portrait coordinates fed back in step S41 are cropped to crop the portrait, and the processed data is put into the clothing recognition detection network trained in step S3 for recognition, and finally the result is obtained.

[0147] Example 2

[0148] This embodiment provides a clothing recognition system, including: a video acquisition module, a video segmentation module, a coloring module, an image database construction module, a video de-framing module, a labeling module, a clothing data set construction module, a clothing recognition network construction module, a clothing recognition network training module and a composite detection module;

[0149] As a preferred technical solution, the video acquisition module is used to acquire camera videos in multiple scenes;

[0150] As a preferred technical solution, the video division module is used to divide the video into black and white video and non-black and white video;

[0151] As a preferred technical solution, the coloring module is used to fill the black and white video with color through the coloring network.

[0152] As a preferred technical solution, the image database construction module is used to integrate the colored video with the non-black and white video to obtain a full-color image database;

[0153] As a preferred technical solution, the video de-framing module is used to de-frame the full-color image database;

[0154] As a preferred technical solution, the annotation module is used to annotate valid data images;

[0155] As a preferred technical solution, the clothing data set construction module is used to construct a clothing data set;

[0156] As a preferred technical solution, the clothing recognition network construction module is used to construct a clothing recognition network based on the YOLOv5 model, and is provided with a backbone network layer, a Neck network layer and an output layer connected in sequence;

[0157] Add a coordinate attention module at the end of the backbone network layer. The coordinate attention module uses the coordinate attention mechanism to obtain feature information.

[0158] In the Neck network layer, the concatenation module in the YOLOv5 model is replaced with the Concat_bifpn module that integrates the multi-scale feature fusion algorithm to fuse the features of the shallow network and the deep network, and learn the importance of different input features by presetting learnable weights;

[0159] The Neck network layer is provided with a plurality of Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with a plurality of prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head;

[0160] The first fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fifth fusion module through the next layer;

[0161] The second fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fourth fusion module through the next layer;

[0162] The third fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, it is output to the first prediction head of the output layer through the next layer, and outputs the first scale feature;

[0163] The fourth fusion module fuses the output of the previous layer, the output of the next layer of the second fusion module, and the output of the backbone network layer, and after fusion, outputs it to the second prediction head of the output layer through the next layer to output the second scale feature;

[0164] The fifth fusion module fuses the output of its previous layer, the output of the next layer of the first fusion module, and the output of the backbone network layer, and after fusion, outputs it to the third prediction head of the output layer through the next layer, and outputs the third scale feature;

[0165] The sixth fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, outputs it to the fourth prediction head of the output layer through the next layer, and outputs the fourth scale feature;

[0166] The coordinate attention module outputs features to the first fusion module after passing through the convolution layer and upsampling layer;

[0167] As a preferred technical solution, the clothing recognition network training module is used to train the clothing recognition network based on the clothing data set;

[0168] As a preferred technical solution, the composite detection module is used to perform composite detection, identify the characters in the test set based on the YOLOv5 model, crop and extract to obtain a portrait result set, input the portrait result set into the clothing recognition network for recognition, and obtain a clothing recognition result image set.

[0169] In this embodiment, the coloring network includes an instance coloring network and a full image coloring network, which respectively perform instance coloring and full image coloring, and the instance coloring network and the full image coloring network perform end-to-end training at corresponding levels;

[0170] The instance colorization network and the full-image colorization network extract instance image features and full-image features. After multi-layer convolutional layer training, the full-image weights and instance weights are obtained. The instance image features and instance weights are combined to form the full-image feature size. The full-image features and each group of instance image features are weightedly fused according to the corresponding weights to obtain the colored image, and then the colored video image is obtained.

[0171] In this embodiment, the first fusion module fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the first fusion module, and outputs the fusion to the C3 module of the next layer of the first fusion module.

[0172] The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head of the output layer;

[0173] The second fusion module fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module;

[0174] The fourth fusion module fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head of the output layer;

[0175] The third fusion module fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head of the output layer;

[0176] The sixth fusion module fuses the output of the eleventh layer of the backbone network layer with the convolutional layer of the previous layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head of the output layer;

[0177] In this embodiment, the C3 module includes 3 convolutional layers plus a BottleneckCSP module.

[0178] Example 3

[0179] This embodiment provides a storage medium, which may be a storage medium such as ROM, RAM, magnetic disk, or optical disk. The storage medium stores one or more programs, and when the program is executed by a processor, the clothing recognition method of Embodiment 1 is implemented.

[0180] Example 4

[0181] This embodiment provides a computing device, which may be a desktop computer, a laptop computer, a smart phone, a PDA handheld terminal, a tablet computer or other terminal device with a display function. The computing device includes a processor and a memory, and the memory stores one or more programs. When the processor executes the program stored in the memory, the clothing recognition method of embodiment 1 is implemented.

[0182] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A clothing recognition method, characterized in that: The steps include: Obtain camera videos in multiple scenes, divide them into black and white videos and non-black and white videos, fill the black and white videos with colors through a coloring network, and integrate the colored videos with the non-black and white videos to obtain a full-color image database; The coloring network includes an instance coloring network and a full image coloring network, which respectively perform instance coloring and full image coloring, and the instance coloring network and the full image coloring network perform end-to-end training on corresponding levels; The instance coloring network and the full image coloring network extract instance image features and full image features, and after multi-layer convolutional layer training, the full image weights and instance weights are obtained. The instance image features and instance weights are combined to form full image features. The full image features and each group of instance image features are weightedly fused according to the corresponding weights to obtain a colored image, and then a colored video image is obtained. Deframe the full-color image database, annotate the valid data images, and construct the clothing dataset. The specific steps are as follows: Integrate effective data: Integrate the colored video with the non-black and white video, filter out distorted data, integrate the colored video with the non-black and white video, cover the surveillance video environment of multiple scenes and multiple applications, to a certain extent eliminate the non-scalability caused by a single scene, and build a video database; Dataset annotation: First, deframe the integrated valid video data, and then use annotation tools to annotate the valid data images to establish a clothing dataset; A clothing recognition network is built based on the YOLOv5 model, which has a backbone network layer, a neck network layer, and an output layer connected in sequence. Add a coordinate attention module at the end of the backbone network layer. The coordinate attention module uses the coordinate attention mechanism to obtain feature information. In the Neck network layer, the concatenation module in the YOLOv5 model is replaced with the Concat_bifpn module that integrates the multi-scale feature fusion algorithm to fuse the features of the shallow network and the deep network, and learn the importance of different input features by presetting learnable weights; The Neck network layer is provided with a plurality of Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with a plurality of prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head; The first fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fifth fusion module through the next layer; The second fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fourth fusion module through the next layer; The third fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, it is output to the first prediction head of the output layer through the next layer, and outputs the first scale feature; The fourth fusion module fuses the output of the previous layer, the output of the next layer of the second fusion module, and the output of the backbone network layer, and after fusion, outputs it to the second prediction head of the output layer through the next layer to output the second scale feature; The fifth fusion module fuses the output of its previous layer, the output of the next layer of the first fusion module, and the output of the backbone network layer, and after fusion, outputs it to the third prediction head of the output layer through the next layer, and outputs the third scale feature; The sixth fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, outputs it to the fourth prediction head of the output layer through the next layer, and outputs the fourth scale feature; The coordinate attention module outputs features to the first fusion module after passing through the convolution layer and upsampling layer; Training clothing recognition network based on clothing dataset; Perform composite detection, identify the characters in the test set based on the YOLOv5 model, crop and extract to obtain the portrait result set, input the portrait result set into the clothing recognition network for recognition, and obtain the clothing recognition result image set.

2. The clothing recognition method according to claim 1, characterized in that: The coordinate attention module uses the coordinate attention mechanism to obtain feature information. The specific calculation process is: The coordinate attention module decomposes each input feature from dimensions h and w. The decomposed tensors are processed by global pooling to generate tensors X. h and the tensor X w , the concatenated tensor X is input into the convolutional block h and X w Generate an encoded Y, specifically expressed as: in, Indicates connection X w and X h , * represents the convolution operation, G and f represent the normalization and activation functions respectively, and W represents the convolution filter; Split Y again to get and , specifically expressed as: ; in, Split ()express Split Function, used to split the string; Convolution and activation and , the final output is: Among them, F represents convolution, Represents the activation function.

3. The clothing recognition method according to claim 1, characterized in that: The concat_bifpn module learns the importance of different input features by presetting learnable weights. The weight of each input layer is specifically expressed as: in, X i represents the input of each layer, W i represents the weight of each input layer, represents a constant; The output is expressed as: Among them, Y fin Indicates the output result, Conv represents the convolution operation, Relu is the activation function, and N represents the number of input layers.

4. The clothing recognition method according to claim 1, characterized in that: The first fusion module fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the first fusion module, and outputs the fusion to the C3 module of the next layer of the first fusion module. The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head of the output layer; The second fusion module fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module; The fourth fusion module fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head of the output layer; The third fusion module fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head of the output layer; The sixth fusion module fuses the output of the eleventh layer of the backbone network layer with the convolutional layer of the previous layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head of the output layer; The C3 module includes 3 convolutional layers plus a BottleneckCSP module.

5. A clothing recognition system, characterized in that: include: Video acquisition module, video segmentation module, colorization module, image database construction module, video de-framing module, annotation module, clothing data set construction module, clothing recognition network construction module, clothing recognition network training module and composite detection module; The video acquisition module is used to acquire camera videos in multiple scenes; The video division module is used to divide the video into black and white video and non-black and white video; The colorization module is used to fill the black-and-white video with color through a colorization network, wherein the colorization network includes an instance colorization network and a full-image colorization network, which respectively perform instance colorization and full-image colorization, and the instance colorization network and the full-image colorization network perform end-to-end training at corresponding levels; The instance coloring network and the full image coloring network extract instance image features and full image features, and after multi-layer convolutional layer training, the full image weights and instance weights are obtained. The instance image features and instance weights are combined to form full image features. The full image features and each group of instance image features are weightedly fused according to the corresponding weights to obtain a colored image, and then a colored video image is obtained. The image database construction module is used to integrate the colored video with the non-black and white video to obtain a full-color image database; The video de-framing module is used to de-frame the full-color image database; The labeling module is used to label the valid data images; The clothing data set construction module is used to construct a clothing data set, specifically including: Integrate effective data: Integrate the colored video with the non-black and white video, filter out distorted data, integrate the colored video with the non-black and white video, cover the surveillance video environment of multiple scenes and multiple applications, to a certain extent eliminate the non-scalability caused by a single scene, and build a video database; Dataset annotation: First, deframe the integrated valid video data, and then use annotation tools to annotate the valid data images to establish a clothing dataset; The clothing recognition network construction module is used to construct a clothing recognition network based on the YOLOv5 model, and is provided with a backbone network layer, a Neck network layer and an output layer connected in sequence; Add a coordinate attention module at the end of the backbone network layer. The coordinate attention module uses the coordinate attention mechanism to obtain feature information. In the Neck network layer, the concatenation module in the YOLOv5 model is replaced with the Concat_bifpn module that integrates the multi-scale feature fusion algorithm to fuse the features of the shallow network and the deep network, and learn the importance of different input features by presetting learnable weights; The Neck network layer is provided with a plurality of Concat_bifpn modules, including a first fusion module, a second fusion module, a third fusion module, a fourth fusion module, a fifth fusion module and a sixth fusion module; the output layer is provided with a plurality of prediction heads, including a first prediction head, a second prediction head, a third prediction head and a fourth prediction head; The first fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fifth fusion module through the next layer; The second fusion module fuses the output of its previous layer with the output of the backbone network layer, and after fusion, it is output to the fourth fusion module through the next layer; The third fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, it is output to the first prediction head of the output layer through the next layer, and outputs the first scale feature; The fourth fusion module fuses the output of the previous layer, the output of the next layer of the second fusion module, and the output of the backbone network layer, and after fusion, outputs it to the second prediction head of the output layer through the next layer to output the second scale feature; The fifth fusion module fuses the output of its previous layer, the output of the next layer of the first fusion module, and the output of the backbone network layer, and after fusion, outputs it to the third prediction head of the output layer through the next layer, and outputs the third scale feature; The sixth fusion module fuses the output of the previous layer with the output of the backbone network layer, and after fusion, outputs it to the fourth prediction head of the output layer through the next layer, and outputs the fourth scale feature; The coordinate attention module outputs features to the first fusion module after passing through the convolution layer and upsampling layer; The clothing recognition network training module is used to train the clothing recognition network based on the clothing data set; The composite detection module is used to perform composite detection, identify the characters in the test set based on the YOLOv5 model, crop and extract to obtain a portrait result set, input the portrait result set into the clothing recognition network for recognition, and obtain a clothing recognition result image set.

6. The clothing recognition system according to claim 5, characterized in that: The first fusion module fuses the output of the eighth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the first fusion module, and outputs the fusion to the C3 module of the next layer of the first fusion module. The fifth fusion module fuses the output of the C3 module in the next layer of the first fusion module, the output of the eighth layer of the backbone network layer, and the output of the convolutional layer in the previous layer of the fifth fusion module, and outputs the fusion to the C3 module in the next layer of the fifth fusion module, and outputs the third scale feature through the third prediction head of the output layer; The second fusion module fuses the output of the sixth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the second fusion module, and outputs it to the C3 module of the next layer of the second fusion module; The fourth fusion module fuses the output of the sixth layer of the backbone network layer, the output of the C3 module of the next layer of the second fusion module, and the output of the convolutional layer of the previous layer of the fourth fusion module, and outputs it to the C3 module of the next layer of the fourth fusion module, and outputs the second scale feature through the second prediction head of the output layer; The third fusion module fuses the output of the fourth layer of the backbone network layer with the output of the upsampling layer of the previous layer of the third fusion module, and outputs it to the C3 module of the next layer of the third fusion module, and outputs the first scale feature through the first prediction head of the output layer; The sixth fusion module fuses the output of the eleventh layer of the backbone network layer with the convolutional layer of the previous layer of the sixth fusion module, and outputs it to the C3 module of the next layer of the sixth fusion module, and outputs the fourth scale feature through the fourth prediction head of the output layer; The C3 module includes 3 convolutional layers plus a BottleneckCSP module.

7. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the clothing recognition method as described in any one of claims 1 to 4 is implemented.

8. A computing device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, the clothing recognition method as described in any one of claims 1 to 4 is implemented.