Pedestrian attribute recognition method, device, storage medium and electronic device

By pre-training the pedestrian attribute recognition model, the loss function of edge and basic local subgraphs is used to extract pedestrian local and global attributes, which solves the problem of insufficient accuracy and real-time accuracy of pedestrian attribute recognition in the prior art, and realizes efficient pedestrian attribute recognition and resource utilization.

CN114529991BActive Publication Date: 2025-04-08SHANGHAI SHANMA INTELLIGENT TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210191086.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2025-04-08
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

The existing pedestrian attribute recognition technology is difficult to effectively extract and compare the multidimensional features of the whole body of pedestrians, resulting in insufficient recognition accuracy and real-time performance. It is difficult to learn local attribute features with fixed labels, resulting in wasted computing and storage resources.

Method used

The pre-trained pedestrian attribute recognition model is used to calculate the loss between the edge pedestrian local subgraph and the basic pedestrian local subgraph, and the model is pre-trained to extract the pedestrian local and global attributes. The model includes a backbone network, a local attribute recognition network and a global attribute recognition network, and the global attribute recognition network is corrected through the supervision network.

Benefits of technology

It improves the accuracy of pedestrian attribute recognition, reduces the waste of computing and storage resources, simplifies the model structure, and maintains the ability to accurately judge pedestrian local attributes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114529991B_ABST
    Figure CN114529991B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, device, storage medium and electronic device for pedestrian attribute recognition. The pedestrian attribute recognition method includes: obtaining a pedestrian image to be recognized, and using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized, wherein, during the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local subgraph and the basic pedestrian local subgraph, and the pedestrian local attributes and the pedestrian global attributes are output. In the scheme of the embodiment of the present invention, since the pre-trained pedestrian attribute recognition model has learned the ability to divide the target object into local areas and the ability to detect the target area in the local area of ​​the target object, the recognition accuracy of the pedestrian attributes is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular, to a method, device, storage medium and electronic device for pedestrian attribute recognition. Background Art

[0002] With the widespread popularity of video surveillance and the continuous improvement of deep learning technology, the recognition and classification of pedestrian attributes have been widely used in the security field.

[0003] Long-term historical experience in the security field shows that human image data collected by cameras is an effective clue for investigation. Extracting biometric features based on video data and conducting personal identification can greatly improve the accuracy and effectiveness of public security handling. Traditional video analysis is to extract facial features to conduct identity recognition. However, it is difficult to capture frontal, unobstructed, and clear faces in real-life snapshot data, which makes personal identity recognition and trajectory tracking difficult. Therefore, multi-granular multi-dimensional pedestrian full-body feature extraction and comparison become very important. Through the extraction and comparison of pedestrian multi-dimensional features, it is determined whether the target pedestrian appearing in a camera at a certain moment has appeared in the surveillance video of another camera at another moment, so as to quickly discover and continuously track key personnel. The pedestrian feature extraction algorithm currently used in the industry is usually a deep network that extracts visual features (feature vectors) and semantic attribute features (features such as clothing style and color) separately, which occupies more computing resources and has poor real-time performance.

[0004] At present, most methods used for pedestrian attribute recognition and classification model training use fixed labels for supervised learning, and use the global features output by the network to classify the various categories of pedestrian attributes. For pedestrian attribute classification, which has attributes for all parts of the body, it is difficult to learn local attribute features through global features. This process is not only not concise, but also wastes computing and storage resources in the judgment process.

[0005] Moreover, pedestrians have many attributes, and simple network classification alone often fails to learn the attribute characteristics distributed at various positions of pedestrians. The method of dividing the analogies required at each position through segmentation will result in a large number of manual labeling tasks, which consumes a lot of manpower and time, and also causes a waste of computing and storage resources. Summary of the invention

[0006] In view of this, embodiments of the present invention provide a method, device, storage medium and electronic device for pedestrian attribute recognition to at least partially solve the above problems.

[0007] According to a first aspect of an embodiment of the present invention, a method for identifying pedestrian attributes is provided, comprising:

[0008] Obtain an image of a pedestrian to be identified;

[0009] Using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized; wherein, during the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph;

[0010] Output the pedestrian local attributes and the pedestrian global attributes.

[0011] In some other examples, the local attributes and global attributes of the pedestrian in the to-be-identified pedestrian image are identified using a pre-trained pedestrian attribute recognition model, including:

[0012] Extracting the basic feature map from the image of the pedestrian to be identified using the backbone network of the pre-trained pedestrian attribute recognition model;

[0013] Based on the basic feature map, using the local attribute recognition network of the pre-trained pedestrian attribute recognition model to determine the local attributes of pedestrians in different areas;

[0014] Based on the basic feature map, the global attribute recognition network of the pre-trained pedestrian attribute recognition model is used to determine the global attribute of the pedestrian.

[0015] In some other examples, after determining the pedestrian global attribute based on the basic feature map using the global attribute recognition network of the pre-trained pedestrian attribute recognition model, the method further includes:

[0016] Based on the local attributes of the pedestrian, the global attributes of the pedestrian are supervised by a supervision network to correct the global attributes of the pedestrian

[0017] According to a second aspect of an embodiment of the present invention, a method for training a pedestrian attribute recognition model is provided, comprising:

[0018] Get training samples;

[0019] Obtain an edge feature map through edge detection, obtain an edge local submap based on the edge feature map, obtain a basic feature map through a backbone network, and obtain a basic local submap based on the basic feature map;

[0020] Calculating the loss of the edge local sub-graph and the basic local sub-graph, and training the pedestrian attribute recognition model based on the loss;

[0021] Output the model parameters of the pedestrian attribute recognition model.

[0022] In some other examples, calculating the loss of the edge local sub-graph and the base local sub-graph, and training the pedestrian attribute recognition model based on the loss, includes:

[0023] The loss of the target area in the edge local sub-image and the basic local sub-image is calculated, and the pedestrian attribute recognition model is trained based on the loss.

[0024] According to a third aspect of an embodiment of the present invention, there is provided a pedestrian attribute recognition device, comprising:

[0025] A first acquisition module is used to acquire an image of a pedestrian to be identified;

[0026] A recognition module, used to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized by using a pre-trained pedestrian attribute recognition model; wherein, during the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph;

[0027] The attribute output module is used to output the local attributes of the pedestrian and the global attributes of the pedestrian.

[0028] According to a fourth aspect of an embodiment of the present invention, there is provided a pedestrian attribute recognition model training device, comprising:

[0029] A second acquisition module is used to acquire training samples;

[0030] A third acquisition module is used to obtain an edge feature map through edge detection, obtain an edge local sub-map based on the edge feature map, obtain a basic feature map through a backbone network, and obtain a basic local sub-map based on the basic feature map;

[0031] A calculation module, used for calculating the loss of the edge local sub-graph and the basic local sub-graph, and training the pedestrian attribute recognition model based on the loss;

[0032] The parameter output module is used to output the model parameters of the pedestrian attribute recognition model.

[0033] In some other examples, the computing module includes:

[0034] Used to calculate the loss of the target area in the edge local sub-image and the base local sub-image, and train the pedestrian attribute recognition model based on the loss

[0035] According to a fifth aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0036] According to a sixth aspect of an embodiment of the present invention, there is further provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0037] In the scheme of the embodiment of the present invention, based on obtaining a pedestrian image to be identified, a pre-trained pedestrian attribute recognition model is used to identify the local attributes and global attributes of the pedestrian in the pedestrian image to be identified. During the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local subgraph and the basic pedestrian local subgraph, and the local attributes and global attributes of the pedestrian are output. In the scheme of the embodiment of the present invention, since the pre-trained pedestrian attribute recognition model has learned the ability to divide the target object into local areas and the ability to detect the target area in the local area of ​​the target object, the recognition accuracy of the pedestrian attributes is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] 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 some embodiments recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0039] Figure 1 is a hardware structure block diagram of a mobile terminal of a pedestrian attribute recognition method according to an embodiment of the present invention;

[0040] Figure 2 is a flow chart of a pedestrian attribute recognition method according to an embodiment of the present invention;

[0041] Figure 3 is a flow chart of a pedestrian attribute recognition model training method according to an embodiment of the present invention;

[0042] Figure 4 is a structural block diagram of a pedestrian attribute recognition device according to an embodiment of the present invention;

[0043] Figure 5 is a structural block diagram of a pedestrian attribute recognition model training device according to an embodiment of the present invention;

[0044] Figure 6 It is a flowchart according to a specific embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions 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. All other embodiments obtained by ordinary technicians in the field based on the embodiments in the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.

[0046] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0047] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0048] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal of a pedestrian attribute recognition method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0049] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a pedestrian attribute recognition method in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0050] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0051] In order to better solve the problems raised in the above background technology, the present invention discloses a form attribute recognition method, device, storage medium and electronic device, which will be described in detail one by one in the following embodiments.

[0052] See also Figure 2 , Figure 2 A flowchart of a pedestrian attribute recognition method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:

[0053] S202, obtaining an image of a pedestrian to be identified;

[0054] S204, using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized; wherein, during the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph;

[0055] S206: Output the local attributes of the pedestrian and the global attributes of the pedestrian.

[0056] In this embodiment, the pedestrian image to be identified comes from a picture or video captured by an external image acquisition device.

[0057] The pedestrian image to be identified may be an image including a target object. In this embodiment, the target object is a pedestrian.

[0058] Preferably, the pedestrian attribute recognition model is a multi-task classification model, which can generate multiple outputs for one input. The input can be one or more images of the same target object, and the output can be multiple attributes of the target object, that is, multiple attributes of the pedestrian.

[0059] In some embodiments, the pedestrian attribute recognition model can identify multiple attributes of the target object, including the local attributes of the pedestrian and the global attributes of the pedestrian, and also including multiple different attributes of the local attributes of the pedestrian and multiple different attributes of the global attributes of the pedestrian. For example: the local attributes of the pedestrian include but are not limited to whether he is wearing a hat, whether he is wearing glasses, whether he is carrying a backpack, whether he is wearing trousers or a skirt, and the color of the upper body clothing or lower body clothing, etc.; the global attributes of the pedestrian include but are not limited to: age, gender, and orientation, etc.

[0060] Preferably, the local attributes of pedestrians in this embodiment include the attributes of the upper, middle and lower parts of the human body, which are the attributes of the pedestrian head area, the pedestrian upper body area and the pedestrian lower body area. The attributes of the pedestrian head area include but are not limited to whether the pedestrian wears a hat, whether the pedestrian wears glasses, hair (e.g., long hair, short hair), etc.; the attributes of the pedestrian upper body area include but are not limited to the color of the upper body clothes (e.g., red, etc.), the type of the upper body clothes (e.g., short-sleeved, long-sleeved jackets, etc.), whether the pedestrian carries a backpack, etc.; the attributes of the pedestrian lower body area include but are not limited to the color of the lower body clothes (e.g., red, etc.), the type of the lower body clothes (e.g., trousers, skirts, etc.), etc.

[0061] In some embodiments, the pedestrian attribute recognition model includes:

[0062] The backbone network is configured to extract a basic feature map based on the pedestrian image to be identified; wherein the basic feature map is used as an input of a local attribute recognition network and a global attribute recognition network.

[0063] The local attribute recognition network is configured to determine the local attribute information of pedestrians at different positions based on the basic feature map; and output the local attributes of pedestrians by inputting the basic feature map.

[0064] The global attribute recognition network is configured to determine global pedestrian attribute information based on the basic feature map and the pedestrian local attributes; and output the pedestrian global attributes by inputting the basic feature map and the pedestrian local attributes.

[0065] The classification network is configured to perform attribute classification based on the local attributes of the pedestrian and the global attributes of the pedestrian respectively; by inputting the local attributes of the pedestrian or the global attributes of the pedestrian, the local attribute classification of the pedestrian or the global attribute classification of the pedestrian is correspondingly output.

[0066] In some embodiments, the pedestrian attribute recognition model also includes a supervision network, which is configured to supervise the pedestrian's global attributes based on the pedestrian's local attributes; by inputting the pedestrian's local attributes and the pedestrian's global attributes, the corrected pedestrian's global attributes are correspondingly output.

[0067] In some embodiments, using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the image to be recognized includes:

[0068] S2042, extracting the basic feature map from the image of the pedestrian to be identified using the backbone network of the pre-trained pedestrian attribute recognition model;

[0069] S2044, based on the basic feature map, using the local attribute recognition network of the pre-trained pedestrian attribute recognition model to determine the local attributes of pedestrians in different areas;

[0070] S2046: Based on the basic feature map, determine the global attributes of the pedestrian using the global attribute recognition network of the pre-trained pedestrian attribute recognition model.

[0071] In some embodiments, step S2046 further includes a step:

[0072] S2048, based on the local attributes of the pedestrian, supervise the global attributes of the pedestrian through a supervision network to correct the global attributes of the pedestrian.

[0073] In some embodiments, the process of pre-training the pedestrian attribute recognition model includes first collecting a plurality of sample images; then labeling the collected sample images, labeling a plurality of attribute labels corresponding to the target object in each sample image, namely, a plurality of pedestrian local attributes and pedestrian global attributes, and determining the category to which the pedestrian local attributes belong and the category of the pedestrian global attributes and the percentage of each local area in the human body. In some embodiments, a plurality of sample images that have been labeled with attribute labels can also be directly obtained.

[0074] The sample image (sample picture) is input into the pedestrian attribute recognition model. When the sample picture passes through the backbone network, the feature map, i.e., the basic feature map, is output in the middle layer of the network. At the same time, the feature map is operated in two directions. One is to continue to pass through the deep network to output the global attributes of the pedestrian, and the other is to perform the next local information processing step to obtain the local attributes of the pedestrian.

[0075] Among them, in some embodiments, the local information processing process includes: first, performing an edge detection operation on the input sample image, that is, using an edge detection operator to perform a convolution operation on the sample image. The edge detection operator can outline the edge of the image change according to the brightness change, color difference, etc. in the image to obtain an edge feature map. Resize the edge feature map to make it equal to the size of the feature map output by the middle layer of the network, extract specific local areas (such as the pedestrian head area, the pedestrian upper body area, and the pedestrian lower body area) from the resized edge feature map according to the area percentage when marked, and perform loss calculation at the same position as the feature map output by the middle layer of the network. Where Loss = f(feature[h,w],Resize(G(image))[h,w]), where f is the loss function, feature is the basic feature map, image is the input sample image, G is the edge detection operator, h, w are the coordinates of a specific area (such as the pedestrian head area, the pedestrian upper body area, and the pedestrian lower body area). In this embodiment, h and w are the same for the two types of images. Through the calculation of the loss function, the model parameters are continuously corrected until the model converges. In the prior art, it is necessary to artificially divide the upper, middle and lower regions of the human body, and then use the target detection algorithm to detect the target area in each local area image, such as the color of the hat, backpack and pants. Since the edge detection operator can outline the edge of the pedestrian image, it makes the division of the upper, middle and lower regions of the human body and the edge of a local object in the human body in the picture more accurate and clear. Through the model training method provided in this embodiment, the model can learn the ability of edge detection, so that the model not only has the ability to divide the upper, middle and lower regions of the human body, but also is more accurate in detecting the target area in the local area picture through the target detection algorithm, thereby making the model more accurate in judging the local attributes of pedestrians.

[0076] Among them, in some other embodiments, the local information processing process includes: first, performing an edge detection operation on the input sample image, that is, performing a convolution operation on the sample image using an edge detection operator. The edge detection operator can outline the edge of the image change according to the brightness change, color difference, etc. in the image to obtain an edge feature map. Resize the edge feature map to make it equal to the size of the feature map output by the middle layer of the network, extract specific local areas (such as the pedestrian head area, the pedestrian upper body area, and the pedestrian lower body area) from the resized edge feature map according to the area percentage when marked, and perform loss calculation with the target area of ​​the specific local area of ​​the feature map output by the middle layer of the network. Wherein Loss = f(feature[h,w], Resize(G(image))[h,w]), where f is the loss function, feature is the basic feature map, image is the input sample image, and G is the edge detection operator. Different from the previous embodiment, the h and w of the two types of images are different, wherein the h and w of feature (basic feature map) are the coordinates of a specific area (e.g., the pedestrian head area, the pedestrian upper body area, and the pedestrian lower body area), while the latter is the h and w of the target area in the local area of ​​the image after resizing (e.g., the h and w of the hat). Through the calculation of the loss function, the model parameters are continuously corrected until the model converges. Different from the previous embodiment, through the model training method provided in this embodiment, in addition to enabling the model to learn the ability of edge detection, the model can not only have the ability to partially divide the upper, middle, and lower regions of the human body, but also has the ability to directly identify the target area in the local area image of the pedestrian without the need to detect the target area in the local area image through the target detection algorithm, which not only simplifies the model, but also maintains the model's ability to accurately judge the local attributes of the pedestrian.

[0077] In other embodiments, the global attributes of pedestrians are supervised by training the local attribute information of pedestrians. For example, when the hair in the local attribute of the head is long, the gender in the global attribute of the pedestrian should not be male, so that the model has a supervision network, so that the global attribute information of the pedestrian can be supervised and corrected through the local attribute information of the pedestrian during use.

[0078] like Figure 3 As shown, the present invention provides a method for training a person attribute recognition model, comprising:

[0079] S302, obtaining training samples;

[0080] S304, obtaining an edge feature map through edge detection, obtaining an edge local sub-map based on the edge feature map, and obtaining a basic feature map through a backbone network, and obtaining a basic local sub-map based on the basic feature map;

[0081] S306, calculating the loss of the edge local sub-graph and the basic local sub-graph, and training the pedestrian attribute recognition model based on the loss;

[0082] S308: output model parameters of the pedestrian attribute recognition model.

[0083] The training sample includes a plurality of sample images, each sample image corresponds to a plurality of pedestrian local attribute labels and a plurality of pedestrian global attribute labels;

[0084] In some other embodiments, step S306 further includes:

[0085] The loss of the target area in the edge local sub-image and the basic local sub-image is calculated, and the pedestrian attribute recognition model is trained based on the loss.

[0086] The method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, or by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0087] In this embodiment, a pedestrian attribute recognition device is also provided, which is used to implement the corresponding pedestrian attribute recognition methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module of the data processing device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0088] According to another embodiment of the present invention, Figure 4 , a pedestrian attribute recognition device is provided, comprising:

[0089] A first acquisition module 40 is used to acquire an image of a pedestrian to be identified;

[0090] The recognition module 50 is used to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized by using the pre-trained pedestrian attribute recognition model; wherein, during the pre-training process, the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph;

[0091] The attribute output module 60 is used to output the pedestrian local attributes and the pedestrian global attributes.

[0092] In some embodiments, the identification module 50 includes:

[0093] An extraction unit 52, configured to extract the basic feature map from the image of the pedestrian to be identified by using the backbone network of the pre-trained pedestrian attribute recognition model;

[0094] A first recognition unit 54 is used to determine the local attributes of pedestrians in different areas based on the basic feature map using the local attribute recognition network of the pre-trained pedestrian attribute recognition model;

[0095] The second recognition unit 56 is used to determine the pedestrian global attribute based on the basic feature map using the global attribute recognition network of the pre-trained pedestrian attribute recognition model.

[0096] In some embodiments, the identification module 50 further includes:

[0097] The supervision unit 58 is used to supervise the global attributes of the pedestrian through a supervision network based on the local attributes of the pedestrian, so as to correct the global attributes of the pedestrian.

[0098] According to another embodiment of the present invention, referring to Figure 5 , a pedestrian attribute recognition model training device is provided, comprising:

[0099] A second acquisition module 70, used to acquire training samples;

[0100] A third acquisition module 80 is used to obtain an edge feature map through edge detection, obtain an edge local sub-map based on the edge feature map, obtain a basic feature map through a backbone network, and obtain a basic local sub-map based on the basic feature map;

[0101] A calculation module 90, configured to calculate the loss of the edge local sub-graph and the basic local sub-graph, and train the pedestrian attribute recognition model based on the loss;

[0102] The parameter output module 100 is used to output the model parameters of the pedestrian attribute recognition model.

[0103] The training sample includes a plurality of sample images, each sample image corresponds to a plurality of pedestrian local attribute labels and a plurality of pedestrian global attribute labels;

[0104] In some other embodiments, the calculation module 90 further includes:

[0105] Used to calculate the loss of the target area in the edge local sub-image and the basic local sub-image, and train the pedestrian attribute recognition model based on the loss.

[0106] The present invention is described below by means of specific embodiments.

[0107] like Figure 6 As shown, a pedestrian image is first input (corresponding to the aforementioned step S202). Then, when the image passes through the backbone network, a feature map is output in the middle layer of the network. At the same time, the feature map is operated in two directions. One is to output the global features after continuing to pass through the deep network, and the other is to perform the next local information processing steps, such as Figure 6 As shown in the dotted box 3 (corresponding to the aforementioned step S204).

[0108] Then perform edge detection on the input image, that is, use the edge detection operator to perform convolution on the image. This operator can outline the image change edge (corresponding to Figure 6 Step 4).

[0109] Then resize the result of step 4 to make it equal to the size of the output feature map of the intermediate layer (corresponding to Figure 6 Step 5: resize), extract specific areas (i.e. pre-marked parts, head, body, legs) from the resized results, and calculate the loss at the same position as the feature map output by the middle layer of the network (corresponding to Figure 6 Step 5: loss).

[0110] Among them, Loss = f(feature[h,w], Resize(G(image))[h,w]), where f is the loss function, feature is the feature map, image is the input image, G is the edge detection operator, and h, w are specific areas (head, body, legs).

[0111] The global features output by the deep network are classified through the classification network to obtain the classification results of the global features (gender, age, orientation, etc.).

[0112] At this time, the classification network is used to classify the local feature map output by the middle layer, and the fixed local position outputs the attribute information of that position, such as whether the head is wearing a hat, whether the body is carrying a backpack, and the legs output the color of the lower body clothing. Because the specific position of the feature is fixed, the network's learning attention will only be focused on the learning of that position, which greatly improves the network's ability to learn local features.

[0113] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0114] In an exemplary embodiment, the computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0115] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0116] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0117] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0118] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0119] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A pedestrian attribute recognition method, characterized in that: include: Obtain an image of a pedestrian to be identified; Using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized; In the pre-training process, the category to which the local attribute of the pedestrian corresponding to the sample image belongs, the category to which the global attribute of the pedestrian belongs, and the percentage of the human body occupied by each local area are determined, and the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph; Outputting the local attributes of the pedestrian and the global attributes of the pedestrian; The method further includes: a global attribute recognition network is configured to determine global pedestrian attribute information based on a basic feature map and the pedestrian local attributes; by inputting the basic feature map and the pedestrian local attributes into the global attribute recognition network, the pedestrian global attributes are output, wherein the pedestrian attribute recognition model includes the global attribute recognition network; The method also includes: inputting a sample image into the pedestrian attribute recognition model, outputting a basic feature map of the sample image in the network middle layer of the backbone network of the pedestrian attribute recognition model, processing the basic feature map of the sample image using the deep network of the pedestrian attribute recognition model, and outputting the pedestrian global attribute of the sample image; and determining an image change edge according to brightness change and color difference in the sample image, and determining an edge feature map of the sample image based on the image change edge; adjusting the size of the edge feature map of the sample image so that the size of the edge feature map of the sample image is the same as the size of the basic feature map of the sample image; extracting a specific local area in the edge feature map of the sample image according to the percentage of the area pre-marked in the sample image, performing loss calculation on the specific local area and the area at the same position in the basic feature map of the sample image, and using the result of the loss calculation to correct the pedestrian attribute recognition model until the pedestrian attribute recognition model converges; Among them, Loss = f(feature[h, w], Resize(G(image))[h, w]), Loss represents the loss calculation, f represents the loss function, feature represents the basic feature map of the sample image, image represents the sample image, G represents the edge detection operator, and h and w represent the specific local areas.

2. The method according to claim 1, characterized in that: Using a pre-trained pedestrian attribute recognition model to recognize the local attributes and global attributes of the pedestrian in the pedestrian image to be recognized, including: Extracting the basic feature map from the image of the pedestrian to be identified using the backbone network of the pre-trained pedestrian attribute recognition model; Based on the basic feature map, using the local attribute recognition network of the pre-trained pedestrian attribute recognition model to determine the local attributes of the pedestrians in different areas; Based on the basic feature map, the global attribute recognition network of the pre-trained pedestrian attribute recognition model is used to determine the pedestrian global attribute.

3. The method according to claim 2, characterized in that After determining the pedestrian global attribute based on the basic feature map using the global attribute recognition network of the pre-trained pedestrian attribute recognition model, the method further includes: Based on the local attributes of the pedestrian, the global attributes of the pedestrian are supervised through a supervision network to correct the global attributes of the pedestrian.

4. A pedestrian attribute recognition model training method, characterized in that: include: Get training samples; Obtain an edge feature map through edge detection, obtain an edge local submap based on the edge feature map, obtain a basic feature map through a backbone network, and obtain a basic local submap based on the basic feature map; Calculating the loss of the edge local sub-graph and the basic local sub-graph, and training the pedestrian attribute recognition model based on the loss; Outputting model parameters of the pedestrian attribute recognition model; During the pre-training process of the pedestrian attribute recognition model, the category to which the local attribute of the pedestrian corresponding to the sample image belongs, the category to which the global attribute of the pedestrian belongs, and the percentage of each local area in the human body are determined; The method also includes: a global attribute recognition network is configured to determine global pedestrian attribute information based on the basic feature map and the pedestrian local attributes; by inputting the basic feature map and the pedestrian local attributes into the global attribute recognition network, the pedestrian global attributes are output, wherein the pedestrian attribute recognition model includes the global attribute recognition network; the method also includes: inputting a sample image into the pedestrian attribute recognition model, outputting the basic feature map of the sample image in the network middle layer of the backbone network of the pedestrian attribute recognition model, processing the basic feature map of the sample image using the deep network of the pedestrian attribute recognition model, and outputting the pedestrian global attributes of the sample image. attributes; and determining the image change edge according to the brightness change and color difference in the sample image, and determining the edge feature map of the sample image based on the image change edge; adjusting the size of the edge feature map of the sample image so that the size of the edge feature map of the sample image is the same as the size of the basic feature map of the sample image; extracting a specific local area in the edge feature map of the sample image according to the percentage of the area pre-marked in the sample image, performing loss calculation on the specific local area and the area at the same position in the basic feature map of the sample image, and using the result of the loss calculation to correct the pedestrian attribute recognition model until the pedestrian attribute recognition model converges; Among them, Loss = f(feature[h, w], Resize(G(image))[h, w]), Loss represents the loss calculation, f represents the loss function, feature represents the basic feature map of the sample image, image represents the sample image, G represents the edge detection operator, and h and w represent the specific local areas.

5. The method according to claim 4, characterized in that Calculating the loss of the edge local sub-graph and the base local sub-graph, and training the pedestrian attribute recognition model based on the loss, including: The loss of the target area in the edge local sub-image and the basic local sub-image is calculated, and the pedestrian attribute recognition model is trained based on the loss.

6. A pedestrian attribute recognition device, characterized in that: include: A first acquisition module is used to acquire an image of a pedestrian to be identified; A recognition module, used to recognize local attributes and global attributes of pedestrians in the image of pedestrians to be recognized by using a pre-trained pedestrian attribute recognition model; In the pre-training process, the category to which the local attribute of the pedestrian corresponding to the sample image belongs, the category to which the global attribute of the pedestrian belongs, and the percentage of the human body occupied by each local area are determined, and the pedestrian attribute recognition model is pre-trained by calculating the loss between the edge pedestrian local sub-graph and the basic pedestrian local sub-graph; An attribute output module, used for outputting the local attributes of the pedestrian and the global attributes of the pedestrian; The device is also used for: a global attribute recognition network is configured to determine global pedestrian attribute information based on a basic feature map and the pedestrian local attributes; by inputting the basic feature map and the pedestrian local attributes into the global attribute recognition network, the pedestrian global attributes are output, wherein the pedestrian attribute recognition model includes the global attribute recognition network; The device is also used to: input a sample image into the pedestrian attribute recognition model, output a basic feature map of the sample image in the network middle layer of the backbone network of the pedestrian attribute recognition model, process the basic feature map of the sample image using the deep network of the pedestrian attribute recognition model, and output the pedestrian global attribute of the sample image; and determine the image change edge according to the brightness change and color difference in the sample image, and determine the edge feature map of the sample image based on the image change edge; adjust the size of the edge feature map of the sample image so that the size of the edge feature map of the sample image is the same as the size of the basic feature map of the sample image; extract a specific local area in the edge feature map of the sample image according to the percentage of the area pre-marked in the sample image, perform loss calculation on the specific local area and the area at the same position in the basic feature map of the sample image, and use the result of the loss calculation to correct the pedestrian attribute recognition model until the pedestrian attribute recognition model converges; Among them, Loss = f(feature[h, w], Resize(G(image))[h, w]), Loss represents the loss calculation, f represents the loss function, feature represents the basic feature map of the sample image, image represents the sample image, G represents the edge detection operator, and h and w represent the specific local areas.

7. A pedestrian attribute recognition model training device, characterized in that: include: A second acquisition module is used to acquire training samples; A third acquisition module is used to obtain an edge feature map through edge detection, obtain an edge local sub-map based on the edge feature map, obtain a basic feature map through a backbone network, and obtain a basic local sub-map based on the basic feature map; A calculation module, used for calculating the loss of the edge local sub-graph and the basic local sub-graph, and training the pedestrian attribute recognition model based on the loss; A parameter output module, used for outputting model parameters of the pedestrian attribute recognition model; During the pre-training process of the pedestrian attribute recognition model, the category to which the local attribute of the pedestrian corresponding to the sample image belongs, the category to which the global attribute of the pedestrian belongs, and the percentage of each local area in the human body are determined; The device is also used for: a global attribute recognition network is configured to determine global pedestrian attribute information based on the basic feature map and the pedestrian local attributes; by inputting the basic feature map and the pedestrian local attributes into the global attribute recognition network, the pedestrian global attributes are output, wherein the pedestrian attribute recognition model includes the global attribute recognition network; The device is also used to: input a sample image into the pedestrian attribute recognition model, output a basic feature map of the sample image in the network middle layer of the backbone network of the pedestrian attribute recognition model, process the basic feature map of the sample image using the deep network of the pedestrian attribute recognition model, and output the pedestrian global attribute of the sample image; and determine the image change edge according to the brightness change and color difference in the sample image, and determine the edge feature map of the sample image based on the image change edge; adjust the size of the edge feature map of the sample image so that the size of the edge feature map of the sample image is the same as the size of the basic feature map of the sample image; extract a specific local area in the edge feature map of the sample image according to the percentage of the area pre-marked in the sample image, perform loss calculation on the specific local area and the area at the same position in the basic feature map of the sample image, and use the result of the loss calculation to correct the pedestrian attribute recognition model until the pedestrian attribute recognition model converges; Among them, Loss = f(feature[h, w], Resize(G(image))[h, w]), Loss represents the loss calculation, f represents the loss function, feature represents the basic feature map of the sample image, image represents the sample image, G represents the edge detection operator, and h and w represent the specific local areas.

8. The device according to claim 7, characterized in that The calculation module comprises: Used to calculate the loss of the target area in the edge local sub-image and the basic local sub-image, and train the pedestrian attribute recognition model based on the loss.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 3 or claims 4 to 5 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method described in any one of claims 1 to 3 or claims 4 to 5.

Citation Information

Patent Citations

  • Visual attribute recognition method and device and storage medium

    CN109447095A