Model training method, device, electronic device and storage medium

By pooling the feature map and calculating the loss value, the feature extraction network model is trained, which solves the problems of insufficient expression ability and low accuracy in the prior art, and achieves a higher accuracy rate of human weight recognition.

CN114445691BActive Publication Date: 2025-02-18SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111654018.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2025-02-18
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

The existing human weight recognition method based on feature extraction network model has shortcomings in terms of insufficient expression ability and low accuracy.

Method used

By pooling the feature map, the target feature vector is obtained, and the loss values ​​of the classification category and label category are determined based on the feature vector, and the feature extraction network model is then trained.

Benefits of technology

It enhances the expression ability of the model and improves the accuracy of human weight recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445691B_ABST
    Figure CN114445691B_ABST
Patent Text Reader

Abstract

The present invention discloses a model training method, device, electronic device and storage medium, the model training method comprises: performing pooling processing on a feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from a plurality of human sample images in a feature extraction network model; according to the target feature vector, determining the classification categories corresponding to the plurality of human sample images; calculating the loss values ​​of the label categories corresponding to the plurality of human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values; wherein the label category is used as a label to point to the corresponding human sample image. Thus, the expression ability of the model is enhanced and the accuracy rate of human weight recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of deep neural network, and in particular to a model training method, device, electronic device and storage medium. Background Art

[0002] With the development and progress of artificial intelligence technology, human weight recognition technology can track, match and identify target people across time and space. It has been widely used in all aspects of social life and is one of the research hotspots in the field of computer vision in recent years. Although the current method of extracting human image features based on feature extraction network models has many advantages such as fast inference speed and mature deployment tools, the model's expression ability is insufficient and the accuracy rate is low in human weight recognition. Summary of the invention

[0003] In a first aspect, the main purpose of the present invention is to provide a model training method, comprising:

[0004] Performing pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by performing feature extraction on multiple human sample images in a feature extraction network model;

[0005] Determining the classification categories corresponding to the plurality of human body sample images according to the target feature vector;

[0006] The loss values ​​of the label categories corresponding to the multiple human sample images are calculated according to the classification categories, so as to train the feature extraction network model according to the loss values; wherein the label categories are used as annotations to point to the corresponding human sample images.

[0007] Optionally, performing pooling processing on the feature map to obtain a target feature vector includes:

[0008] Segmenting the feature map into a plurality of pixel regions;

[0009] Perform generalized average calculation on each pixel area respectively to obtain the generalized average value corresponding to each pixel area;

[0010] The generalized average values ​​corresponding to the multiple pixel point areas are combined to obtain the target feature vector.

[0011] Optionally, calculating the loss values ​​of the label categories corresponding to the plurality of human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values ​​includes:

[0012] Determining the number of times the plurality of human sample images are trained in the feature extraction network model, each training iteration including a fixed number of batch images;

[0013] When the number of training times is an odd number, a plurality of first batch images are determined from the training set of the feature extraction network model; wherein the plurality of first batch images are randomly extracted from the training set;

[0014] Calculate first loss values ​​corresponding to the plurality of first batch images according to the first loss function and the second loss function;

[0015] Parameters of the feature extraction network model are updated according to the first loss value.

[0016] Optionally, the calculating the loss values ​​of the label categories corresponding to the plurality of human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values, further includes:

[0017] When the number of training times is an even number, a plurality of second batches of pictures are determined from the training set of the feature extraction network model; wherein the plurality of second batches of pictures are pictures corresponding to a plurality of different human identity information in the training set;

[0018] Calculate the second loss values ​​corresponding to the plurality of second batches of images according to the second loss function and the third loss function;

[0019] The parameters of the feature extraction network model are updated according to the second loss value.

[0020] Optionally, the method further comprises:

[0021] After the plurality of human body sample images are input into the feature extraction network model for initial training, the feature amplitudes of the human body sample images in the training set of the feature extraction network model are calculated;

[0022] Determine whether the characteristic amplitude corresponding to each of the human body sample images meets a preset condition;

[0023] When the human body sample picture is a first type of human body sample picture that meets a preset condition, deleting the first type of human body sample picture;

[0024] When the human body sample image is a second type of human body sample image that does not meet the preset conditions, the second type of human body sample image is retained and re-input into the feature extraction network model for training in the next round of training.

[0025] Optionally, the method further comprises:

[0026] Obtaining scene images captured by an image acquisition device;

[0027] Detecting the scene image to determine a human body coordinate area in the scene image;

[0028] Cutting the human body coordinate area to obtain the human body sample image;

[0029] The human body sample pictures are input into a database to construct an image base library.

[0030] Optionally, the method further comprises:

[0031] Determine a reference feature vector corresponding to the image to be retrieved according to the input image to be retrieved;

[0032] Querying the image base library for a plurality of target feature vectors corresponding to the reference feature vector;

[0033] Calculating feature similarities between a reference feature vector and the plurality of target feature vectors;

[0034] A human body sample image corresponding to the image to be retrieved is determined according to the feature similarity.

[0035] In a second aspect, an embodiment of the present invention provides a model training device, comprising:

[0036] A pooling module is used to perform pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model;

[0037] A determination module, used to determine the classification categories corresponding to the plurality of human sample images according to the target feature vector;

[0038] A calculation module is used to calculate the loss value of the label category corresponding to the multiple human sample images according to the classification category, and a training module is used to train the feature extraction network model according to the loss value; wherein the label category is used as a annotation to point to the corresponding human sample image.

[0039] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned model training method when executing the computer program.

[0040] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the model training method as described above are implemented.

[0041] The above solution of the present invention includes at least the following beneficial effects:

[0042] The model training method provided by the present invention first performs pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model; according to the target feature vector, the classification categories corresponding to the multiple human sample images are determined; according to the classification category, the loss value of the label category corresponding to the multiple human sample images is calculated, and finally the feature extraction network model is trained according to the loss value; wherein the label category is used as a label to point to the corresponding human sample image. This enhances the expression ability of the model and improves the accuracy of human weight recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0044] Figure 1 A schematic diagram of the overall process of the model training method provided by an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of a specific flow chart of step S10 provided in an embodiment of the present invention;

[0046] Figure 3 Another schematic diagram of a flow chart of a model training method provided by an embodiment of the present invention;

[0047] Figure 4 Another schematic diagram of a flow chart of a model training method provided by an embodiment of the present invention;

[0048] Figure 5 A schematic diagram of a process for constructing an image base library provided by an embodiment of the present invention;

[0049] Figure 6 A schematic diagram of a flow chart of a method for identifying human weight provided by an embodiment of the present invention;

[0050] Figure 7 A structural block diagram of a model training device provided by an embodiment of the present invention;

[0051] Figure 8 This is a structural block diagram of an electronic device provided by an embodiment of the present invention.

[0052] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] The terms "first", "second", "third", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any variation thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.

[0055] First, the scheme of the embodiment of the present application is introduced by way of examples with reference to the relevant drawings.

[0056] like Figure 1 As shown, a specific embodiment of the present invention provides a model training method, comprising:

[0057] S10, performing pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by performing feature extraction on multiple human sample images in a feature extraction network model.

[0058] In this embodiment, the human body sample image can be obtained by being collected and cropped by an image acquisition device, such as a scene image collected by a camera, a camera or other device. The human body sample image can be obtained by cropping the human body area. The human body sample image has image features corresponding to it, and the image features include color features, edge features, shape features, texture features, etc. Since the human body sample image contains a lot of data, it will be very slow when calculated. Therefore, the human body sample image can be used to extract features in a feature extraction network model. Feature extraction means extracting effective features from the human body sample image. The feature can be expressed as a numerical value. The larger the absolute value of the numerical value, the more obvious the feature. The feature map is obtained by extracting the human body sample image, and then the feature map can be pooled. It can be understood that the pooling process is represented by dimensionality reduction and compression of the input feature map so that machine learning can speed up the calculation speed.

[0059] like Figure 2 As shown, the specific implementation of the above step S10 includes:

[0060] S11, dividing the feature map into multiple pixel regions;

[0061] S12, performing generalized average calculation on each pixel region respectively to obtain a generalized average value corresponding to each pixel region;

[0062] S13, combining the generalized average values ​​corresponding to the multiple pixel point areas to obtain a target feature vector.

[0063] In this embodiment, the human sample image is extracted through the feature extraction network model to obtain a feature map. In the pooling process, each feature map can first be divided into multiple pixel areas, each pixel area has multiple pixels, and each pixel corresponds to a numerical value. By performing generalized averaging calculation on the multiple numerical values ​​of each pixel area, the generalized average value corresponding to each pixel area can be determined, and the multiple generalized average values ​​are combined to obtain a target feature vector. The target feature vector can be used to represent multiple features of the human sample image; for example, if the target feature vector is a 512-dimensional feature vector, it means that the corresponding human sample image is projected into a 512-dimensional Euclidean space, so that the distance between the target feature vectors can be used to distinguish whether they belong to the same person.

[0064] For example, the feature extraction network model extracts a feature map composed of 20 pixel areas, each pixel area contains 4×4=16 pixels, and the generalized average of the 16 pixels is calculated by generalized averaging. Since there are 20 pixel areas, 20 generalized averages can be obtained. By combining the 20 generalized averages, the corresponding target feature vector can be obtained.

[0065] In an optional embodiment, the feature extraction network model may adopt a ResNet50 residual neural network, and in the pooling process, generalized mean pooling (GeM) with an exponential parameter p may be used to convert the feature map into a fixed size; the formula for generalized mean calculation is as follows:

[0066]

[0067] Among them, f (g) represents the feature map extracted by the feature extraction network model, K represents the decomposition of the feature map into K regions, x represents the value of each pixel on each feature map in the region, p is the pooling adjustment factor, χ k represents each region, |χ k | represents the number of regions. The generalized average pooling strategy mainly divides the feature map into K regions, adjusts each region with exponent p, and then averages and Indexation, and finally combining the generalized average values ​​obtained in different regions to obtain the target feature vector, thereby maximally reducing information loss and achieving higher accuracy in human weight recognition.

[0068] S20. Determine the classification categories corresponding to the multiple human sample images according to the target feature vector.

[0069] In this embodiment, each human sample image can be represented by a target feature vector, which can be a high-dimensional feature vector. The high-dimensional feature vector can accurately describe human features. By comparing the distances between different feature vectors, the probability that different human images have the same human label can be determined. The closer the feature distance, the higher the probability that they are the same person.

[0070] S30. Calculate the loss values ​​of the label categories corresponding to the multiple human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values; wherein the label categories are used as annotations to point to the corresponding human sample images.

[0071] In this embodiment, human sample images can be annotated manually or by machine before training, and each human sample image has multiple label categories. The target feature vector obtained after the human sample image is compositely pooled in the pooling layer can be input into the fully connected classification layer to determine the classification category, and then the classification category is compared with the label category to calculate the loss value. Thus, the feature extraction network model is trained and updated through gradient backpropagation, thereby reducing the loss value, enhancing the expression ability of the model, and achieving higher accuracy in human weight recognition; wherein, gradient backpropagation is represented by passing the loss value (backward layer by layer, and then each layer of the network will calculate the gradient according to the error returned, and then update the parameters of the model to improve the accuracy and stability of the model.

[0072] The model training method provided by the present invention first performs pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model; according to the target feature vector, the classification categories corresponding to the multiple human sample images are determined; according to the classification category, the loss values ​​of the label categories corresponding to the multiple human sample images are calculated, and finally the feature extraction network model is trained according to the loss value; wherein the label category is used as a label to point to the corresponding human sample image. This enhances the expression ability of the model and improves the accuracy of human weight recognition.

[0073] like Figure 3 As shown, the steps after training the feature extraction network model include:

[0074] 101. Determine the number of training times of a plurality of human sample images in a feature extraction network model, where each training iteration includes a fixed number of batch images;

[0075] 102. When the number of training times is an odd number, a plurality of first batch images are determined from the training set of the feature extraction network model; wherein the plurality of first batch images are randomly selected from the training set;

[0076] 103. Calculate first loss values ​​corresponding to the first batch of images according to the first loss function and the second loss function;

[0077] 104. When the number of training times is an even number, a plurality of second batches of images are determined from the training set of the feature extraction network model; wherein the plurality of second batches of images are images corresponding to a plurality of different human identity labels in the training set;

[0078] 105. Calculate second loss values ​​corresponding to the plurality of second batch images according to the second loss function and the third loss function;

[0079] 106. Update parameters of the feature extraction network model according to the first loss value and the second loss value.

[0080] In this embodiment, the first loss function can be an Arcface (Additive Angular Margin Loss) loss function, which is expressed as an additive angular margin loss function and can be used to expand the distance between different categories; the second loss function can be a cross entropy loss function, which is used to calculate the probability of each category; the third loss function can be a triplet loss function, which is a triplet loss function that makes the distance between samples within a category smaller than the distance between samples of different categories through learning.

[0081] Among them, since there may be problems such as missing label categories, the loss value between the classification category and the label category is determined to train and update the model; the first loss value is obtained by respectively calculating the loss and summing the first loss function and the second loss function, and the second loss value is obtained by respectively calculating the loss and summing the second loss function and the third loss function; after each training is completed, it can be determined whether the number of trainings is odd or even. When the number of trainings is odd, n first batch pictures can be randomly extracted from the training set of the feature extraction network model for training again, and the first loss function and the second loss function are used to calculate the first loss value corresponding to the classification category and the label category in the n first batch pictures, and then the first loss value is used to update the parameters of the feature extraction network model; when the number of trainings is even, Since the human sample images in the training set correspond to multiple different human identity labels, multiple second batch images corresponding to each human identity label can be determined. For example, k second batch images are selected from p human identity labels for training, and the second loss function and the third loss function are used to calculate the second loss values ​​corresponding to the classification categories and label categories in the k second batch images, and then the parameters of the feature extraction network model are updated through the second loss values. It can be understood that after the first training is completed, n first batch images can be randomly extracted from the training set for training again. After the second training is completed, k second batch images corresponding to p human identity labels can be determined from the training set for training. In this way, the model is continuously trained to make the model more accurate.

[0082] like Figure 4 As shown, in an optional embodiment, the steps of the model training method provided by the present invention further include:

[0083] 201. After a plurality of human sample images are input into a feature extraction network model for initial training, characteristic amplitudes of human sample images in a training set of the feature extraction network model are calculated;

[0084] 202. Determine whether the characteristic amplitude corresponding to each human body sample image meets a preset condition;

[0085] 203. When the human body sample image is a first type of human body sample image that meets the preset conditions, the first type of human body sample image is deleted;

[0086] 204. When the human body sample image is a second type of human body sample image that does not meet the preset conditions, the second type of human body sample image is retained and re-input into the feature extraction network model for training in the next round of training.

[0087] In this embodiment, due to the huge number of training set images and various collection methods, noise images inevitably appear in the training set, such as strong light, low light, truncated human images or non-human images, etc., which will appear in the training set. The features extracted from these images are very different from the features extracted from normal human sample images, which is specifically manifested in the different amplitude distribution of feature vectors. After the first training of the feature extraction network model is completed, the feature amplitudes corresponding to all human sample images in the training set can be calculated. Among them, the preset condition is expressed as the top 5% of the feature amplitude, the first type of human sample images are expressed as the human sample images with the top 5% of the feature amplitude, and the second type of human sample images are expressed as the human sample images with the feature amplitude lower than the top 5%. In other words, the larger the feature amplitude, the lower the quality of the human sample image. Therefore, the first type of human sample images with the top 5% of the feature amplitude can be deleted, and the second type of human sample images can be input into the feature extraction network model again for training.

[0088] It can be understood that the feature amplitude obtained by the feature extraction network model can be used to represent the quality of the human sample image. Therefore, the feature amplitude calculation formula is as follows:

[0089]

[0090] Among them, |A| represents the feature amplitude, and x represents the response value of each pixel in the feature map. This patent finds that the feature amplitude of low-quality noise images is generally large. Therefore, after the first round of model training, the 5% training images with the largest feature amplitude are eliminated and the model is retrained to improve the model stability.

[0091] For example, after the first round of training is completed, the training set contains 3000 human sample images. By calculating the feature amplitudes of the 3000 human sample images, after the calculation is completed, 150 human sample images have the largest feature amplitudes, and the remaining 2850 feature amplitudes are all lower than the above 150 human sample images. Therefore, the above 150 human sample images can be deleted, and the remaining 2850 human sample images can be input into the model again for training, which can further improve the stability of the model and make the model more accurate in recognizing human weight.

[0092] like Figure 5 As shown, the steps of the model training method provided by the present invention also include:

[0093] 301. Obtain a scene image acquired by an image acquisition device;

[0094] 302. Detect the scene image to determine a human body coordinate area in the scene image;

[0095] 303. Crop the human body coordinate area to obtain a human body sample image;

[0096] 304. Input the human body sample images into the database to construct an image base.

[0097] In this embodiment, the image acquisition device can be a camera, a webcam, or a capture machine. After the image acquisition device acquires a video stream or a captured scene image, the scene image can be detected through a human body detection model, and the human body coordinate area can be determined. By cropping the human body coordinate area, the human body sample image can be determined and input into a database, thereby forming an image base library. When it is necessary to train the feature extraction network model, the human body sample image can be input from the image base library into the feature extraction network model for extraction, and then pooled and alternately sampled through multiple loss functions, and finally input into the feature network model for training, thereby improving the stability and accuracy of the model.

[0098] For example, a scene image contains a square, multiple pedestrians, trees, etc. The human body detection model can identify pedestrians as foreground images and the square and trees as background images. Therefore, the pedestrian area can be located and cropped, and then multiple human body sample images of different pedestrians can be determined, and then entered into the database to construct an image base library.

[0099] like Figure 6 As shown, in an optional embodiment, after the model training is completed, the human weight recognition method provided in the embodiment of the present invention includes:

[0100] 401. Determine a reference feature vector corresponding to the image to be retrieved according to the input image to be retrieved;

[0101] 402. Query multiple target feature vectors corresponding to the reference feature vector in the image base database;

[0102] 403. Calculate feature similarity between a reference feature vector and a plurality of target feature vectors;

[0103] 404. Determine a human body sample image corresponding to the image to be retrieved according to the feature similarity.

[0104] In this embodiment, human body weight recognition is represented as human body re-recognition, which is mainly used to determine whether there is a specific pedestrian in an image or video sequence to compensate for the visual limitations of a fixed camera. In the process of human body weight recognition, the feature extraction network model obtained through the above training can be used to re-recognize pedestrians; the image to be retrieved can be acquired by an image acquisition device, by pooling the image to be retrieved to determine a reference feature vector, and then comparing the reference feature vector with multiple target feature vectors in the image base library, and then determining the feature similarity between the reference feature vector and the target feature vector. When the feature similarity between a certain target feature vector and the reference feature vector is closest, it means that the human body sample image corresponding to the target feature vector is consistent with the image to be retrieved. Therefore, the human body sample image can be recommended, and then the features such as the character information corresponding to the image to be retrieved are determined, so that the accuracy of human body weight recognition is higher; optionally, the reference feature vector and multiple target feature vectors can be sorted according to the feature similarity between them, and then the corresponding target feature vector is determined.

[0105] like Figure 7 As shown, an embodiment of the present invention provides a model training device 10, comprising:

[0106] The pooling module 11 is used to perform pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model;

[0107] A determination module 12, used to determine the classification categories corresponding to the plurality of human sample images according to the target feature vector;

[0108] The calculation module 13 is used to calculate the loss value of the label category corresponding to multiple human sample images according to the classification category, and the training module 14 is used to train the feature extraction network model according to the loss value; wherein the label category is used as an annotation to point to the corresponding human sample image.

[0109] The model training device 10 provided by the present invention first performs pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model; according to the target feature vector, the classification categories corresponding to the multiple human sample images are determined; according to the classification category, the loss value of the label category corresponding to the multiple human sample images is calculated, and finally the feature extraction network model is trained according to the loss value; wherein the label category is used as a label to point to the corresponding human sample image. This enhances the expression ability of the model and improves the accuracy of human weight recognition.

[0110] It should be noted that the model training device 10 provided in the specific embodiment of the present invention is a device corresponding to the above-mentioned model training method, and all embodiments of the above-mentioned model training method are applicable to the model training device 10. The above-mentioned model training device 10 embodiments all have corresponding modules corresponding to the steps in the above-mentioned model training method, and can achieve the same or similar beneficial effects. In order to avoid excessive repetition, each module in the model training device 2 will not be described in detail here.

[0111] like Figure 8 As shown, a specific embodiment of the present invention further provides an electronic device 20, including a memory 202, a processor 201, and a computer program stored in the memory 202 and executable on the processor 201, wherein the processor 201 implements the steps of the above-mentioned model training method when executing the computer program.

[0112] Specifically, the processor 201 is used to call the computer program stored in the memory 202 to perform the following steps:

[0113] The feature map is pooled to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model;

[0114] According to the target feature vector, the classification categories corresponding to the multiple human sample images are determined;

[0115] The loss values ​​of the label categories corresponding to the multiple human sample images are calculated according to the classification categories, so as to train the feature extraction network model according to the loss values; wherein the label categories are used as annotations to point to the corresponding human sample images.

[0116] Optionally, the processor 201 performs pooling processing on the feature map to obtain a target feature vector, including:

[0117] Divide the feature map into multiple pixel regions;

[0118] Perform generalized average calculation on each pixel area respectively to obtain the generalized average value corresponding to each pixel area;

[0119] The generalized average values ​​corresponding to multiple pixel regions are combined to obtain the target feature vector.

[0120] Optionally, the processor 201 calculates the loss values ​​of the label categories corresponding to the multiple human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values, including:

[0121] Determine the number of training times of multiple human sample images in the feature extraction network model, where each training iteration includes a fixed number of batches of images;

[0122] When the number of training times is an odd number, multiple first batch images are determined from the training set of the feature extraction network model; wherein the multiple first batch images are randomly selected from the training set;

[0123] Calculate first loss values ​​corresponding to the first batch of images according to the first loss function and the second loss function;

[0124] The parameters of the feature extraction network model are updated according to the first loss value.

[0125] Optionally, the label category includes a corresponding human identity label; the processor 201 calculates the loss value of the label category corresponding to the plurality of human sample images according to the classification category, so as to train the feature extraction network model according to the loss value, and further includes:

[0126] When the number of training times is an even number, a plurality of second batches of images are determined from the training set of the feature extraction network model; wherein the plurality of second batches of images are images corresponding to a plurality of different human identity labels in the training set;

[0127] Calculate second loss values ​​corresponding to the plurality of second batch images according to the second loss function and the third loss function;

[0128] The parameters of the feature extraction network model are updated according to the second loss value.

[0129] Optionally, the method executed by the processor 201 further includes:

[0130] After a plurality of human sample images are input into the feature extraction network model for initial training, the feature amplitudes of the human sample images in the training set of the feature extraction network model are calculated;

[0131] Determine whether the characteristic amplitude corresponding to each human sample image meets the preset conditions;

[0132] When the human body sample image is a first type of human body sample image that meets the preset conditions, the first type of human body sample image is deleted;

[0133] When the human body sample image is a second type of human body sample image that does not meet the preset conditions, the second type of human body sample image is retained, and the feature extraction network model is re-input for training in the next round of training.

[0134] Optionally, the method executed by the processor 201 further includes:

[0135] Obtaining scene images captured by an image acquisition device;

[0136] Detect the scene image to determine the human body coordinate area in the scene image;

[0137] Crop the human body coordinate area to obtain a human body sample image;

[0138] The human sample images are input into the database to construct an image base.

[0139] Optionally, the method executed by the processor 201 further includes:

[0140] Determine a reference feature vector corresponding to the image to be retrieved according to the input image to be retrieved;

[0141] Querying a plurality of target feature vectors corresponding to the reference feature vector in the image base library;

[0142] Calculating feature similarities between a reference feature vector and a plurality of target feature vectors;

[0143] The human body sample image corresponding to the image to be retrieved is determined according to the feature similarity.

[0144] That is, in a specific embodiment of the present invention, the processor 201 of the electronic device 20 implements the steps of the above-mentioned model training method when executing the computer program, thereby enhancing the expression ability of the model and improving the accuracy of human weight recognition.

[0145] It should be noted that since the processor 201 of the electronic device 20 implements the steps of the above-mentioned model training method when executing a computer program, all embodiments of the above-mentioned model training method are applicable to the electronic device 20 and can achieve the same or similar beneficial effects.

[0146] The computer-readable storage medium provided in the embodiment of the present invention stores a computer program. When the computer program is executed by the processor, the various processes of the model training method or the application-side model training method provided in the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0147] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0148] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0149] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A model training method, characterized in that: include: Performing pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by performing feature extraction on multiple human sample images in a feature extraction network model; Determining the classification categories corresponding to the plurality of human body sample images according to the target feature vector; Calculating the loss value of the label category corresponding to the plurality of human sample images according to the classification category, so as to train the feature extraction network model according to the loss value; wherein the label category is used as a label to point to the corresponding human sample image; the label category includes a corresponding human identity label; The step of calculating the loss values ​​of the label categories corresponding to the plurality of human sample images according to the classification categories, so as to train the feature extraction network model according to the loss values, comprises: Determining the number of times the plurality of human sample images are trained in the feature extraction network model, each training iteration including a fixed number of batch images; When the number of training times is an odd number, a plurality of first batch images are determined from the training set of the feature extraction network model; wherein the plurality of first batch images are randomly extracted from the training set; Calculate first loss values ​​corresponding to the plurality of first batch images according to the first loss function and the second loss function; Update parameters of the feature extraction network model according to the first loss value; When the number of training times is an even number, a plurality of second batches of pictures are determined from the training set of the feature extraction network model; wherein the plurality of second batches of pictures are pictures corresponding to a plurality of different human identity labels in the training set; Calculate the second loss values ​​corresponding to the plurality of second batches of images according to the second loss function and the third loss function; The parameters of the feature extraction network model are updated according to the second loss value.

2. The model training method according to claim 1, characterized in that: The pooling process of the feature map to obtain the target feature vector includes: Segmenting the feature map into a plurality of pixel regions; Perform generalized average calculation on each pixel area respectively to obtain the generalized average value corresponding to each pixel area; The generalized average values ​​corresponding to the multiple pixel point areas are combined to obtain the target feature vector.

3. The model training method according to claim 1, characterized in that: The method further comprises: After the plurality of human sample images are input into the feature extraction network model for the first training, the feature amplitude of the human sample images in the training set of the feature extraction network model is calculated; the feature amplitude calculation formula is: Among them, | A | represents the characteristic amplitude, x Represents the response value of each pixel in the feature map; Determine whether the characteristic amplitude corresponding to each of the human body sample images meets a preset condition; When the human body sample picture is a first type of human body sample picture that meets a preset condition, deleting the first type of human body sample picture; When the human body sample image is a second type of human body sample image that does not meet the preset conditions, the second type of human body sample image is retained and re-input into the feature extraction network model for training in the next round of training.

4. The model training method according to claim 1, characterized in that: The method further comprises: Obtaining scene images captured by an image acquisition device; Detecting the scene image to determine a human body coordinate area in the scene image; Cutting the human body coordinate area to obtain the human body sample image; The human body sample pictures are input into a database to construct an image base library.

5. The model training method according to claim 4, characterized in that: The method further comprises: Determine a reference feature vector corresponding to the image to be retrieved according to the input image to be retrieved; Querying the image base library for a plurality of target feature vectors corresponding to the reference feature vector; Calculating feature similarities between a reference feature vector and the plurality of target feature vectors; A human body sample image corresponding to the image to be retrieved is determined according to the feature similarity.

6. A model training device, characterized in that: include: A pooling module is used to perform pooling processing on the feature map to obtain a target feature vector; wherein the feature map is obtained by extracting features from multiple human sample images in a feature extraction network model; A determination module, used to determine the classification categories corresponding to the plurality of human sample images according to the target feature vector; A calculation module, used to calculate the loss value of the label category corresponding to the multiple human sample images according to the classification category, and a training module, used to train the feature extraction network model according to the loss value; wherein the label category is used as a annotation to point to the corresponding human sample image; the label category includes a corresponding human identity label; the calculation of the loss value of the label category corresponding to the multiple human sample images according to the classification category, so as to train the feature extraction network model according to the loss value, including: determining the number of times the multiple human sample images are trained in the feature extraction network model, each training iteration including a fixed number of batches of images; when the number of training times is an odd number, extracting the images from the feature extraction network model; Determine multiple first batch pictures from the training set; wherein the multiple first batch pictures are randomly extracted from the training set; calculate the first loss values ​​corresponding to the multiple first batch pictures according to the first loss function and the second loss function; update the parameters of the feature extraction network model according to the first loss value; when the number of training times is an even number, determine multiple second batch pictures from the training set of the feature extraction network model; wherein the multiple second batch pictures are pictures corresponding to multiple different human identity labels in the training set; calculate the second loss values ​​corresponding to the multiple second batch pictures according to the second loss function and the third loss function; update the parameters of the feature extraction network model according to the second loss value.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the model training method as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the model training method as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Image retrieval method based on sorting learning and multivariate loss

    CN110188225A

  • Pedestrian re-identification method based on global-local feature dynamic alignment

    CN113408492A