Training sample determination method, network model training method, device and storage medium

By selecting target samples and target image samples based on similarity and image attribute information in the image sample set, the simple sample problem caused by random selection of training samples is solved, and the generalization ability of the network model and the effectiveness of the training samples are improved.

CN118675019BActive Publication Date: 2024-11-29ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411166378.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-29
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

In the prior art, random selection of training samples results in simple and easy identification of samples, affecting the generalization ability of network models, and it is difficult to obtain information-rich and effective training samples.

Method used

By obtaining the image sample set, select the target sample object according to the similarity between sample objects, and select the target image sample according to the image attribute information of the target sample object in different image samples to ensure the effectiveness of the inter-class and intra-class training samples.

Benefits of technology

It improves the information richness and effectiveness of the training samples, and enhances the distinction and generalization capabilities of the network model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118675019B_ABST
    Figure CN118675019B_ABST
Patent Text Reader

Abstract

The present application discloses a training sample determination method, a network model training method, a device and a storage medium, the method comprising: obtaining an image sample set, the image sample set including sample objects; selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set; selecting a target image sample from corresponding different image samples according to the image attribute information of each target sample object in different image samples, the target image sample is used for sample object recognition training. Thus, through the dual selection between classes and within classes, the information of the training sample is guaranteed to be rich and effective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a training sample determination method, a network model training method based on target object recognition, an electronic device and a computer-readable storage medium. Background Art

[0002] With the rapid development of image sensor technology, video acquisition devices are widely used, generating a large amount of video data. By identifying and analyzing these video data, we can grasp the movement of specific target objects. Using computer vision technology to retrieve the same target object in different video acquisition devices requires the relevant network model system to learn a large number of image samples to achieve the ability of autonomous recognition. Among them, the quality of image samples directly affects the accuracy and generalization ability of the network model.

[0003] At present, PK sampling is the most widely used batch sampler when selecting image samples for network model training. First, P sample objects are randomly selected from the image sample set, and then K image samples are randomly selected for each sample object to construct a batch of size P*K. As the scale of training data increases, the P sample objects randomly sampled in the batch are often easy to distinguish, resulting in the network model repeatedly training simple sample pairs, making the model unable to be effectively trained, affecting the final generalization ability. Summary of the invention

[0004] The main technical problem solved by the present application is to provide a training sample determination method, a network model training method based on target object recognition, an electronic device and a computer-readable storage medium, which can improve the effectiveness of training samples.

[0005] To solve the above technical problems, a technical solution adopted in the present application is: a training sample determination method is provided, the training sample determination method comprising: obtaining an image sample set, the image sample set including sample objects; selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set; selecting a target image sample from corresponding different image samples according to image attribute information of each target sample object in different image samples, the target image sample being used for sample object recognition training.

[0006] In some embodiments, the step of selecting a target sample object from each sample object based on the similarity between each sample object in the image sample set includes: selecting an initial sample object corresponding to each sample object from each sample object based on the image feature similarity between the image sample where each sample object is located and the image samples where other sample objects are located; and selecting the target sample object from each sample object based on the initial sample object corresponding to each sample object.

[0007] In some embodiments, the step of selecting the initial sample objects corresponding to each sample object from each sample object according to the image feature similarity between the image samples where each sample object is located and the image samples where other sample objects are located includes: selecting a first preset number of image samples from the image samples where each sample object is located as representative image samples of each sample object; determining a similarity matrix according to the image feature similarity between the image features of the representative image samples of each sample object and the image features of the representative image samples of other sample objects; and determining the initial sample objects corresponding to each sample object according to the similarity matrix.

[0008] In some embodiments, the step of selecting the target sample object from each sample object according to the initial sample object corresponding to each sample object comprises: constructing a sample object set with the sample objects in the image sample set; removing the sample objects that have been included in the target sample object set from the sample object set to obtain a removed sample object set, wherein the target sample object set is used to store the target sample object; in response to the initial sample object corresponding to the sample object not existing in the target sample object set, the sample object and the initial sample object corresponding to the sample object are included in the target sample object set; in response to the presence of a sample object included in the target sample object set in the initial sample object corresponding to the sample object, randomly selecting a number of sample objects to be included from the removed sample object set except the sample object and the initial sample object corresponding to the sample object, wherein the number of sample objects to be included is the number of sample objects in the initial sample object corresponding to the sample object that are included in the target sample object set; and including the sample objects that are not included in the target sample object set, the number of sample objects to be included, and the sample objects in the initial sample object corresponding to the sample object, into the target sample object set.

[0009] In some embodiments, the image attribute information includes image attribute categories, and the step of selecting target image samples from corresponding different image samples based on the image attribute information of each target sample object in different image samples includes: selecting a second preset number of image samples from image samples of different image attribute categories as initial image samples of the corresponding target sample object based on the image attribute category of the image samples where each target sample object is located; and determining the target image samples of the corresponding target sample object based on the relationship between the initial number of initial image samples of each target sample object and the preset number of image samples of the corresponding target sample object.

[0010] In some embodiments, the step of determining the target image samples of the corresponding target sample object according to the size relationship between the initial number of initial image samples of each target sample object and the preset number of image samples of the corresponding target sample object includes: in response to the initial number of initial image samples of the target sample object being greater than or equal to the preset number of image samples of the target sample object, randomly selecting the preset number of image samples from the initial image samples of the target sample object as the target image samples of the target sample object; in response to the initial number of initial image samples of the target sample object being less than the preset number of image samples of the target sample object, obtaining a first difference between the preset number of image samples and the initial number and the a second difference between the total number of image samples where the target sample object is located and the initial number; in response to the second difference being greater than or equal to the first difference, selecting image samples of the first difference from image samples other than the initial image samples of the target sample object in the image samples where the target sample object is located, and determining the image samples of the first difference and the initial image samples of the target sample object as target image samples of the target sample object; in response to the second difference being less than the first difference, selecting image samples of the first difference from image samples where the target sample object is located, and determining the image samples of the first difference and the initial image samples of the target sample object as target image samples of the target sample object.

[0011] In some embodiments, the step of obtaining an image sample set, wherein the image sample set includes sample objects, comprises: obtaining an initial image sample set, wherein the number of image samples in the initial image sample set is greater than the number of image samples in the image sample set; classifying the initial image sample set according to the sample objects to obtain image samples of each category; obtaining image feature similarities and minimum feature similarities between image samples of the same category; in response to the minimum feature similarity among image samples of each category being less than a preset feature similarity, deleting image samples of the corresponding category from the initial image sample set to obtain the image sample set.

[0012] To solve the above technical problems, another technical solution adopted in the present application is: a network model training method based on target object recognition is provided, and the network model training method includes: obtaining a target image sample to be trained, the target image sample is based on obtaining an image sample set, and the image sample set includes sample objects; selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set; selecting a target image sample from corresponding different image samples according to image attribute information of each target sample object in different image samples; inputting the target image sample into the network model to obtain a sample object output by the network model; calculating the loss value of the loss function between the sample object output by the network model and the actual sample object; training the network model with the goal of reducing the loss value until the loss value meets the preset requirements.

[0013] In some embodiments, the method further includes: in the process of training the network model with the goal of reducing the loss value, if the loss value does not meet the preset requirements, reselecting image samples to be trained from the image sample set to obtain an image sample set to be trained, wherein the image samples in the image sample set to be trained are determined based on the image attribute information of the target sample object in the image sample set in different image samples, and there are image samples in the target image sample set that are different from the image samples in the image sample set to be trained; inputting the image samples to be trained into the network model to obtain sample objects output by the network model; calculating the loss value of the loss function between the sample object output by the network model and the target sample object; training the network model with the goal of reducing the loss value until the loss value meets the preset requirements, thereby obtaining a network model that meets the requirements.

[0014] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, including a memory and a processor, the memory storing program instructions, and the processor calling the program instructions from the memory to execute the above-mentioned training sample determination method and / or the network model training method based on target object recognition.

[0015] To solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium including program data stored therein, wherein the program data is used to implement the above-mentioned training sample determination method and / or network model training method based on target object recognition when executed by a processor.

[0016] Compared with the current problem of randomly selecting training samples, which leads to the problem that training samples are simple and easy to identify, the above scheme proposes a training sample determination method, which includes: obtaining an image sample set, which includes sample objects; selecting target sample objects from each sample object according to the similarity between each sample object in the image sample set; selecting target image samples from corresponding different image samples according to the image attribute information of each target sample object in different image samples, and the target image samples are used for sample object recognition training. Therefore, the target sample objects are first selected according to the similarity of each sample object to ensure the validity of inter-class training samples; then the target image samples are selected according to the image attribute information of each target sample object in different image samples to ensure the validity of intra-class training samples; through the dual selection between classes and within classes, the information of the training samples is guaranteed to be rich and effective. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0018] Figure 1 is a flowchart of an exemplary embodiment of a method for determining a training sample shown in the present application;

[0019] Figure 2 yes Figure 1 A flow chart of an exemplary embodiment of step S120 in the training sample determination method is shown;

[0020] Figure 3 yes Figure 1 A flow chart of an exemplary embodiment of step S130 in the training sample determination method is shown;

[0021] Figure 4 yes Figure 1 A flowchart of an exemplary embodiment of step S110 in the training sample determination method is shown;

[0022] Figure 5 A flowchart of an exemplary embodiment of a network model training method shown in the present application;

[0023] Figure 6 It is a specific flow chart of an exemplary embodiment of the training sample determination method shown in the present application;

[0024] Figure 7 is a structural schematic diagram of an exemplary embodiment of a training sample determination device shown in the present application;

[0025] Figure 8 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;

[0026] Fig. 9 It is a structural schematic diagram of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.

[0028] First of all, it should be noted that before the network model based on target object recognition is applied, a large number of training samples will be used to train the network model to achieve autonomous recognition capabilities. Therefore, the quality of the training samples directly affects the accuracy and generalization ability of the network model, requiring the training samples to have a certain scale and diversity to ensure that the network model is well trained.

[0029] However, the current PK sampling is a random sampling, and metric learning is often used to constrain the feature space, so that the similarity of the same target object in different image samples is higher than the similarity of different target objects. However, as the scale of training data increases, the P target objects randomly sampled in the Batch (training sample batch) are often easy to distinguish, which is not informative and effective for metric learning. Repeated training of simple sample pairs makes it impossible to effectively train the network model, affecting the final generalization ability. Therefore, it is necessary to consider the sampling of difficult sample pairs when constructing the Batch.

[0030] Based on this, the present application proposes a training sample determination method, a network model training method based on target object recognition, an electronic device and a computer-readable storage medium. Figure 1 , Figure 1 It is a flowchart of an exemplary embodiment of the training sample determination method shown in the present application.

[0031] The execution subject of the training sample determination method may be a terminal device or a server or other processing device, wherein the terminal device may be a user equipment (UE), a computer, a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The execution subject of the training sample determination method may also be a training sample determination device. In some possible implementations, the training sample determination method may be implemented by a processor calling a computer-readable instruction stored in a memory.

[0032] Specifically, the training sample determination method of this embodiment includes the following steps:

[0033] S110: Acquire an image sample set, where the image sample set includes sample objects.

[0034] An image sample set refers to a set of image samples including sample objects. For example, the image samples can be collected by a video acquisition device, an image acquisition device, etc. The video acquisition device can be a camera installed in an area such as a road, and all images including sample objects taken by cameras on all roads in a certain geographical area within a certain period of time are used as image samples to form an image sample set.

[0035] Sample objects refer to objects that need to be identified. For example, sample objects can be vehicles, animals, etc. Vehicles can include license plates, car brands, etc. Sample objects and image samples can be one-to-one, one-to-many, or many-to-one, that is, one sample object may exist in multiple image samples, and one image sample may also contain multiple sample objects.

[0036] The training sample determination device uses all images including sample objects taken by the front-end camera within a certain period of time as image samples to form an image sample set.

[0037] S120: Selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set.

[0038] The similarity refers to the similarity between the image samples where each sample object is located, or may be the similarity between the pixel regions where each sample object is located in the image sample.

[0039] The target sample object refers to the sample object selected as the training sample, which can also be called the hard sample object. Exemplarily, the target sample object can be determined according to the similarity between the sample objects in the image sample set. As an example, the similarity between each sample object and other sample objects is obtained, and the first N sample objects of each sample object are selected in descending order according to the similarity to obtain the target sample object.

[0040] The training sample determination device obtains each sample object in the image sample set, calculates the similarity between the image samples where each sample object is located, determines the similarity between each sample object, and selects the target sample object according to the similarity. In order to ensure that the obtained inter-class sample information is rich and effective, the first N sample objects of each sample object can be selected from the largest to the smallest according to the similarity between each sample object and other sample objects to obtain the target sample object. As a result, the similarity between the obtained and selected sample objects is relatively large and difficult to distinguish, which increases the difficulty of inter-class recognition.

[0041] S130: selecting target image samples from corresponding different image samples according to image attribute information of each target sample object in different image samples, and the target image samples are used for sample object recognition training.

[0042] Image attribute information is used to describe the content and features of image samples. Exemplarily, image attribute information can be obtained by identifying and analyzing image samples. Exemplarily, image attribute information includes viewing angle attributes, camera attributes, and resolution attributes. The viewing angle attribute categories of image samples can include front, side, and back; according to the camera attributes of image samples, image samples of the same sample object belonging to the same camera can be divided into one category; according to the resolution attributes of image samples, image samples can be divided into three categories: high resolution, medium resolution, and low resolution.

[0043] The target image samples are used for sample object recognition training. Exemplarily, after the target sample objects are selected, target image samples corresponding to the sample objects are selected from the image samples corresponding to the target sample objects according to the image attribute categories of the image samples corresponding to the target sample objects.

[0044] After selecting the target sample object, the training sample determination device selects the target image sample of the target sample object according to the image attribute information of the same target sample object in different image samples, and uses the target image sample of each target sample object as sample object recognition training.

[0045] It can be seen that the training sample determination method of the embodiment of the present application obtains an image sample set, which includes sample objects; selects a target sample object from each sample object according to the similarity between each sample object in the image sample set; selects a target image sample from the corresponding different image samples according to the image attribute information of each target sample object in different image samples, and the target image sample is used for sample object recognition training. Thus, the target sample object is first selected according to the similarity of each sample object to ensure the validity of the inter-class training sample; then the target image sample is selected according to the image attribute information of each target sample object in different image samples to ensure the validity of the intra-class training sample; through the dual selection between classes and within classes, it is ensured that the training sample is rich in information and effective.

[0046] Based on the above embodiments, the embodiments of the present application adopt Figure 2 The flowchart details how to determine the target sample object based on the similarity between the sample objects. Figure 2 , Figure 2 yes Figure 1 The flowchart of an exemplary embodiment of step S120 in the training sample determination method is shown. Specifically, the process of selecting a target sample object from each sample object in the image sample set according to the similarity between each sample object in step S120 includes the following steps:

[0047] S210: Selecting an initial sample object corresponding to each sample object from each sample object according to the image feature similarity between the image sample where each sample object is located and the image samples where other sample objects are located.

[0048] Image feature similarity represents the similarity between image samples including different sample objects. Exemplarily, the image feature similarity can be obtained by calculating the similarity between image samples including different sample objects. The image feature similarity can be calculated by cosine similarity, Euclidean distance, etc.

[0049] The initial sample objects may also be referred to as the difficult sample objects corresponding to each sample object, and other sample objects that are most similar to the sample object may be used as the initial sample objects corresponding to the sample object. Generally, the initial sample objects of all sample objects may be set to the same number. Thus, the difficulty of distinguishing different sample objects is increased through similar sample objects, thereby improving the effectiveness of the training samples.

[0050] In some embodiments, any image sample where each sample object is located can be selected to calculate the image feature similarity, that is, randomly select an image for each sample object in the image sample set, or select the image sample containing the most sample object features, such as the front view. Specifically, the training sample determination device selects a first preset number of image samples from the image samples where each sample object is located as the representative image samples of each sample object; determines the similarity matrix based on the image feature similarity between the image features of the representative image samples of each sample object and the image features of the representative image samples of other sample objects; and determines the initial sample object corresponding to each sample object based on the similarity matrix. In this way, the feature similarity between each sample object and other sample objects can be obtained, so that the initial sample object corresponding to each sample object can be selected based on the feature similarity to ensure the difficulty between sample object classes.

[0051] The first preset number can be set according to requirements, for example, 1, 2, etc.

[0052] Exemplarily, first, the training sample determination device randomly selects one image sample from the image samples where the sample objects are located as the representative image sample of each sample object; the representative image sample of each sample object is subjected to feature extraction through the pre-trained network model to obtain the image features of the representative image sample of each sample object; the image feature similarity between the image features of the representative image samples of any two sample objects is calculated to obtain the similarity matrix generated by all sample objects , the similarity matrix is ​​a C-dimensional matrix; according to the similarity matrix, the first N initial sample objects of each sample object can be obtained, which is recorded as ,in, Represents the initial sample object.

[0053] In other embodiments, the image features of the image samples where each sample object is located can be calculated one-to-one with the image features of the image samples where other sample objects are located, wherein the redundant image samples in the sample objects with a large number of image samples are not included in the calculation; the image feature similarities calculated for each corresponding image sample are averaged to obtain the image feature similarities between each sample object and other sample objects, and a corresponding similarity matrix is ​​generated; and the initial sample object corresponding to each sample object is determined according to the corresponding similarity matrix. As an example, there are 45 image samples where the first sample object is located and 50 image samples where the second sample object is located. Then, 45 image samples are randomly selected from the image samples where the second sample object is located and calculated one-to-one with the image samples where the first sample object is located to obtain 45 image feature similarities; the 45 image feature similarities are averaged to obtain the image feature similarities between the first sample object and the second sample object.

[0054] S220: Selecting a target sample object from each sample object according to the initial sample object corresponding to each sample object.

[0055] The training sample determination device iteratively selects each sample object according to the initial sample object corresponding to each sample object to obtain the target sample object. In other embodiments, the training sample determination device can also group each sample object in the image sample set into groups of two, calculate the image feature similarity between the image samples where the two sample objects are located in each group; sort the image feature similarities of the sample objects in each group from large to small, and select the sample objects in the first N groups as the target sample objects.

[0056] Specifically, in some embodiments, the process of iteratively selecting each sample object includes: constructing a sample object set with sample objects in the image sample set; removing sample objects that have been included in the target sample object set from the sample object set to obtain a removed sample object set, the target sample object set being used to store the target sample object; in response to the initial sample object corresponding to the sample object not existing in the target sample object set, the sample object and the initial sample object corresponding to the sample object are included in the target sample object set; in response to the presence of a sample object included in the target sample object set in the initial sample object corresponding to the sample object, a number of sample objects are randomly selected from the removed sample object set except for the sample object and the initial sample object corresponding to the sample object, the number of sample objects included being the number of sample objects included in the target sample object set in the initial sample object corresponding to the sample object; and the sample objects that are not included in the target sample object set, the number of sample objects included, and the sample objects in the initial sample object corresponding to the sample object are included in the target sample object set. Thus, without increasing the number of iterations, the difficulty between sample object classes is increased, and partial randomness of PK sampling is retained, providing a highly effective training sample for subsequent training of the network model, thereby improving the discrimination ability and generalization ability of the network model.

[0057] In order to better understand the above iterative selection process, the first and second iterative selections are used as examples for detailed explanation:

[0058] First, initialize the sample object set constructed by the sample objects in the image sample set ,in, Indicates sample objects. In addition, the collection Including the initial sample object corresponding to the sample object, the collection The number of sample objects in the set is denoted as N; The set includes sample objects in the initial sample objects corresponding to the sample objects that are not included in the target sample object set. The number of sample objects in is denoted as n.

[0059] In the first iteration, from the sample object set A sample object is randomly selected from , Represents a sample object The corresponding initial sample object, Indicates the sample objects in the corresponding initial sample objects that are not included in the target sample object set, that is, ,in Indicates the intersection. Since no sample object is included in the target sample object set in the first iteration selection, that is, the set The number n and the set The number N is equal to; the sample object and its corresponding initial sample object Included in the target sample object set, that is The 1+N (1 represents the iterative sample object) selected in the first iteration , N represents the set The number of target sample objects is N, where represents a union;

[0060] Before the second iteration selection, the sample objects that have been included in the target sample object set are removed from the sample object set, and the sample object set after removal is obtained as the sample object set selected for the second iteration. Remove from the set S and update the set S; remove from the sample object set Randomly select sample objects , Represents a sample object The corresponding initial sample object, Indicates the sample objects in the corresponding initial sample objects that are not selected and included in the target sample object set, that is, ,in represents the intersection. The number n is equal to the set When the number N is If the corresponding initial sample object does not exist in the target sample object set, the sample object And the sample object The corresponding initial sample object Included in the target sample object set, that is The 1+N (1 represents the iterative sample object) selected in the second iteration , N represents the set The number of target sample objects is N; when the set The number n is less than the set When the number N is The remainder of Randomly select Nn sample objects from the set R. That is, from the sample object set Remove sample objects and sample objects The corresponding initial sample object Randomly select a number of sample objects Nn from the outside, and the number of sample objects Nn is included as the sample object The corresponding initial sample object The number of sample objects included in the target sample object set; the sample objects, set And the set R is included in the target sample object set, that is The 1+N (1 represents the iterative sample object) selected in the second iteration , N represents the set The number of target sample objects is N; and from the set Delete these 1+N sample objects.

[0061] Thus, the sample objects in the image sample set are iteratively selected for A times until the iteration requirements are met. Where A is the number of preset anchor point sample objects, and the number of sample objects in the final target sample object set is , the anchor sample object refers to the sample object selected for each iteration. When the number of sample objects in the set S is less than P, the current iterative training is stopped and a new round of iterative training is started.

[0062] In some other embodiments, repeated sample objects in each sample object and the initial sample object corresponding to each sample object may be deleted, and each sample object after the repeated sample object is deleted and the initial sample object corresponding to each sample object are determined as the target sample object.

[0063] It can be seen that the training sample determination method of the embodiment of the present application selects the initial sample object corresponding to each sample object from each sample object according to the image feature similarity between the image sample where each sample object is located and the image sample where other sample objects are located; and selects the target sample object from each sample object according to the initial sample object corresponding to each sample object. Therefore, by using the image feature similarity as the selection criterion for the initial sample object, initial sample objects with different image feature similarities can be selected according to actual needs, thereby improving the selection flexibility. By maintaining the set of sample objects that are not selected during each iterative selection process, it is ensured that each sample object will only appear once, with the same number of iterations as PK sampling.

[0064] Based on the above embodiments, the embodiments of the present application adopt Figure 3The flowchart explains in detail how to select the target image sample, please refer to Figure 3 , Figure 3 yes Figure 1 The flowchart of an exemplary embodiment of step S130 in the training sample determination method is shown. Specifically, the process of selecting target image samples from corresponding different image samples according to the image attribute information of each target sample object in different image samples in step S120 includes the following steps:

[0065] S310: Selecting a second preset number of image samples from image samples of different image attribute categories as initial image samples corresponding to the target sample objects according to the image attribute categories of the image samples where the target sample objects are located.

[0066] Image attribute categories refer to attribute categories under different image attributes. Exemplarily, image attribute information includes view angle attributes, camera attributes, and resolution attributes, etc., and image attribute categories include view angle attribute categories, camera attribute categories, and resolution attribute categories. Among them, the view angle attribute categories of image samples can include three categories: front, side, and back; according to the camera attribute categories of image samples, image samples of the same sample object belonging to the same camera can be divided into one category; according to the resolution attribute categories of image samples, image samples can be divided into three categories: large resolution, medium resolution, and small resolution. In some embodiments, for each target sample object, a random number p that obeys the U(0,1) uniform distribution can be generated. When p<0.25, sampling is performed according to the view angle attribute category of the image; when 0.25<=p<0.5, sampling is performed according to the camera attribute category of the image; when 0.5<=p<0.75, sampling is performed according to the resolution attribute category of the image; when p>=0.75, random sampling is performed, that is, K images are randomly selected from all image samples where the target sample object is located.

[0067] The second preset number can be set according to the requirements of the training scale. For example, for the same target sample object, one image sample of each of its different image attribute categories can be randomly selected as its initial image sample. Of course, the preset number can also be 2, 3, etc.

[0068] In other embodiments, the initial image samples may be selected in combination with multiple image attributes. As an example, the image samples of the same target sample object are first classified according to the view attribute category, with the front view being classified into one category, the side view being classified into one category, and the back view being classified into one category; then, one or more image samples with the highest resolution are selected from each view category as the initial image samples of the target sample.

[0069] The training sample determination device obtains the image attribute category of the image sample where each target sample object is located, and for each image attribute category, randomly selects one image sample from the image sample where the corresponding target sample object is located. As an example, the viewing angle of the image sample where the target sample object c is located includes the front and the side, then one image sample is selected from the image sample where the target sample object c is located at the front and the image sample where the target sample object c is located at the side as the initial image sample of the target sample object c.

[0070] S320: Determine target image samples corresponding to the target sample objects according to a size relationship between an initial number of initial image samples of each target sample object and a preset number of image samples corresponding to the target sample object.

[0071] The initial number refers to the number of initial image samples of each target sample object. The initial image samples of each target sample object are selected according to the image attribute category of the image sample where each target sample object is located. Therefore, the initial number of each target sample object is associated with the number of image attribute categories of the image sample where the corresponding target sample object is located.

[0072] The preset number of image samples refers to the preset number of image samples for selecting each target sample object. Generally speaking, the preset number of image samples for each target sample object is the same, but can also be different.

[0073] The training sample determination device determines the target image samples corresponding to the target sample objects according to the size relationship between the initial number of each target sample object and the preset number of image samples. In some embodiments, the following steps are specifically included: in response to the initial number of the initial image samples of the target sample object being greater than or equal to the preset number of image samples of the target sample object, randomly selecting the preset number of image samples from the initial image samples of the target sample object as the target image samples of the target sample object; in response to the initial number of the initial image samples of the target sample object being less than the preset number of image samples of the target sample object, obtaining the first difference between the preset number of image samples and the initial number and the second difference between the total number of image samples where the target sample object is located and the initial number; in response to the second difference being greater than or equal to the first difference, selecting the image samples of the first difference from the image samples where the target sample object is located except the initial image samples of the target sample object, and determining the image samples of the first difference and the initial image samples of the target sample object as the target image samples of the target sample object; in response to the second difference being less than the first difference, selecting the image samples of the first difference from the image samples where the target sample object is located, and determining the image samples of the first difference and the initial image samples of the target sample object as the target image samples of the target sample object.

[0074] As an example, suppose the total number of categories of a certain image attribute category of the image sample where the target sample object c is located is (For example, in the perspective attribute category, the target sample object c only has the front and side views, then =2), for each view attribute category, randomly select one image sample from the image samples of the target sample object c in each view attribute category to obtain image samples, that is, the initial number of initial image samples of the target sample object c is , and the preset number of image samples of the target sample object is ;when , and the number of remaining image samples of target sample object c is greater than or equal to Then randomly select the remaining image samples of the target sample object c image samples, a total of image samples, wherein the remaining image samples of the target sample object are image samples of the target sample object except the initial image samples of the target sample object; when , and the remaining image samples of the target sample object c are less than Then randomly select from all image samples where the target sample object c is located image samples, a total of image samples; when , and then from here Randomly select from the image samples image samples as the image samples used by the target sample object c in the current sample acquisition process. In the above method, each target sample object can be sampled. Image samples are collected to construct training samples that have been mined through difficult examples. At the same time, image samples are sampled according to image attribute categories to ensure that at least one image of each image attribute category is sampled, which increases the difficulty of examples while retaining randomness.

[0075] In other embodiments, the step of determining the target image samples of the corresponding target sample objects according to the size relationship between the initial image samples of each target sample object and the preset number of image samples of the corresponding target sample object may also include: if the initial number of the initial image samples of the target sample object is greater than or equal to the preset number of image samples of the corresponding target sample object, determining the initial image samples of the corresponding target sample object as the target image samples; if the initial number of the initial image samples of the target sample object is less than the preset number of image samples of the target sample object, obtaining a first difference between the preset number of image samples and the initial number and a second difference between the total number of image samples where the target sample object is located and the initial number; if the second difference is greater than or equal to the first difference, selecting image samples of the first difference from image samples other than the initial image samples of the target sample object in the image samples where the target sample object is located, and determining the image samples of the first difference and the initial image samples of the target sample object as the target image samples of the target sample object; if the second difference is less than the first difference, selecting image samples of the first difference from image samples where the target sample object is located, and determining the image samples of the first difference and the initial image samples of the target sample object as the target image samples of the target sample object. This ensures that the number of image samples for each target sample object is not less than the preset number of image samples, thereby ensuring the scale of the training samples.

[0076] Based on the above embodiments, the embodiments of the present application adopt Figure 4 The flowchart details how to obtain the image sample set. Figure 4 , Figure 4 yes Figure 1 The flowchart of an exemplary embodiment of step S110 in the training sample determination method is shown. Specifically, step S110 acquires an image sample set, and the process of including sample objects in the image sample set includes the following steps:

[0077] S410: Acquire an initial image sample set.

[0078] The initial image sample set refers to an unscreened image sample set, so the number of image samples in the initial image sample set is greater than the number of image samples in the image sample set. Exemplarily, the images captured by the front-end video capture device can be directly used as the initial images to form the initial image sample set.

[0079] The training sample determination device obtains images captured by the video acquisition device, and uses all images captured by the video acquisition device in a certain period of time as an initial image sample set.

[0080] S420: Classify the initial image sample set according to sample objects to obtain image samples of each category.

[0081] The training sample determination device classifies the image samples belonging to the same sample object in the initial image sample set into one category to obtain image samples of each category.

[0082] S430: Obtain image feature similarities and minimum feature similarities between image samples in the same category.

[0083] The training sample determination device obtains the image features of all image samples in the same category; calculates the image feature similarity between any two image samples in the same category, obtains the image feature similarity between any two image samples in the same category, and obtains the minimum feature similarity. The image features can be obtained by extracting features from all image samples in the initial image sample set using a pre-trained network model.

[0084] S440: In response to the minimum feature similarity in the initial image sample sets of each category being less than a preset feature similarity, the initial image sample sets of the corresponding categories are deleted from the initial image sample sets to obtain image sample sets.

[0085] The quality of each image sample in the initial image sample set is uneven. The image features of the same sample object in different image samples are very similar (for example, they are all front-facing, so it is easy to determine that they are the same sample object). A large number of such sample objects will cause the network model to over-learn simple sample object categories. Therefore, it is necessary to first select the effectiveness of image samples, delete the image samples with sample objects with high similarity from the initial image sample set, and obtain the image sample set.

[0086] The preset feature similarity can be preset to a value that is considered to have a lower validity for the corresponding sample object, for example, 85%, 90%, or 95%.

[0087] In other embodiments, image samples with low image quality may be deleted from the initial image sample set, or image samples with low image quality may be enhanced to obtain an image sample set, thereby improving the quality of image samples in the image sample set.

[0088] Based on the above embodiments, the embodiments of the present application adopt Figure 5 The flowchart details how to use the target image samples to train the network model. Figure 5 , Figure 5 The present application shows a flowchart of an exemplary embodiment of a network model training method. Specifically, the following steps are included:

[0089] S510: Obtain a target image sample set to be trained, where the target image samples are based on an acquired image sample set, and the image sample set includes sample objects; select target sample objects from each sample object in the image sample set according to the similarity between each sample object in the image sample set; and select target image samples from corresponding different image samples according to image attribute information of each target sample object in different image samples.

[0090] The target image samples are used for sample object recognition training. Exemplarily, after the target sample objects are selected, target image samples corresponding to the sample objects are selected from the image samples corresponding to the target sample objects according to the image attribute categories of the image samples corresponding to the target sample objects.

[0091] An image sample set refers to a set of image samples including sample objects. For example, the image samples can be collected by a video acquisition device, an image acquisition device, etc. The video acquisition device can be a camera installed in an area such as a road, and all images including sample objects taken by cameras on all roads in a certain geographical area in a certain period of time are used as image samples to form an image sample set.

[0092] Sample objects refer to objects that need to be identified. For example, sample objects can be vehicles, animals, etc. Vehicles can include license plates, car brands, etc. Sample objects and image samples can be one-to-one, one-to-many, or many-to-one, that is, one sample object may exist in multiple image samples, and one image sample may also contain multiple sample objects.

[0093] Similarity refers to the similarity between the image samples where each sample object is located.

[0094] The target sample object refers to the sample object selected as the training sample, and may also be referred to as a difficult target sample object. Exemplarily, the target sample object may be determined based on the similarity between the sample objects in the image sample set. As an example, the similarity between each sample object and other sample objects is obtained, and the first N sample objects of each sample object are selected in descending order according to the similarity to obtain the target sample object.

[0095] Image attribute information is used to describe the content and features of image samples. Exemplarily, image attribute information can be obtained by identifying and analyzing image samples. Exemplarily, image attribute information includes viewing angle, camera, and resolution. The viewing angle information of the image sample can include three categories: front, side, and back; according to the camera information of the image sample, the image samples of the same sample object belonging to the same camera can be divided into one category; according to the resolution information of the image sample, the image sample can be divided into three categories: high resolution, medium resolution, and low resolution.

[0096] Therefore, we first select target sample objects based on the similarity of each sample object to ensure the validity of inter-class training samples; then select target image samples based on the image attribute information of each target sample object in different image samples to ensure the validity of intra-class training samples; through the dual selection between and within classes, it is ensured that the information of the acquired target image samples is rich and valid.

[0097] S520: Input the target image sample into the network model to obtain the sample object output by the network model.

[0098] The network model may be a network model based on target object recognition, which is used to retrieve a specific target object in a cross-camera scenario, also known as target object re-identification.

[0099] The network model is used to identify the sample object in the target image sample based on the image information in the input target image sample.

[0100] S530: Calculate the loss value of the loss function between the sample object output by the network model and the target sample object.

[0101] The target sample object refers to the sample object actually included in the target image sample input into the network model.

[0102] The loss function is used to measure the difference between the prediction result of the network model and the target sample object. Exemplarily, the loss function can be a triplet loss or a classification loss, which is used to constrain the similarity of the positive sample pair to be higher than the similarity of the negative sample pair. The positive sample pair is different image samples of the same target object, and the negative sample pair is different target objects.

[0103] After obtaining the sample object output by the network model, the loss value of the loss function between the sample object output by the network model and the target sample object is calculated.

[0104] S540: Train the network model with the goal of reducing the loss value until the loss value meets the preset requirement.

[0105] The preset requirement may be a preset value. For example, the preset requirement may be preset manually, indicating that the prediction effect of the network model has satisfied the sample object recognition function and the error value generated is within an acceptable range.

[0106] After calculating the loss value, the network model training device adjusts the parameters of the network model with the goal of reducing the loss value, and continuously trains the network model until the loss value meets the preset requirements, that is, the prediction accuracy of the network model reaches the target.

[0107] Therefore, the network model obtained by training with target image samples has higher recognition and generalization capabilities.

[0108] It should be noted that, when the network model is trained with the loss value reduced as the goal, if the loss value does not meet the preset requirements, the image samples to be trained are reselected from the image sample set to obtain the image sample set to be trained, and the image samples in the image sample set to be trained are determined based on the image attribute information of the target sample object in the image sample set in different image samples, and the image samples in the target image sample set are different from the image samples in the image sample set to be trained; the image samples to be trained are input into the network model to obtain the sample objects output by the network model; the loss value of the loss function between the sample objects output by the network model and the target sample objects is calculated; the network model is trained with the loss value reduced as the goal until the loss value meets the preset requirements, and a network model that meets the requirements is obtained. Therefore, when the network model fails to converge based on the training of the target image sample set, inter-class and intra-class selection is performed again from the image sample set to improve the generalization ability of the network model.

[0109] Among them, the target image sample set and the image sample set to be trained are both selected from the image sample set, but the image samples in the target image sample set and the image samples in the image sample set to be trained are different due to the iterative selection process of the target sample object and the image attribute information. Specifically, in the iterative selection process of the target sample object, the initial sample object of each sample object, that is, the difficult sample object, is first determined; then a sample object is randomly selected from each sample object as the anchor sample object, and it is determined whether there is a sample object selected as the target sample object in the initial sample object of the anchor sample object. If there is, the sample objects of the number of included samples are randomly selected from the sample object set except the anchor sample object and the selected target sample object as the initial sample object of the anchor sample object. The number of included samples refers to the number of sample objects in the initial sample object of the anchor sample object that have been selected as the target sample object before this iteration. It can be seen from this that there is randomness in the iterative selection process of the target sample object, so each acquisition process of the training image sample may have different image samples. At the same time, each target sample object has different image attribute information in different image samples. For example, the target sample objects in the target image sample set can be selected according to the viewing angle attributes, and the target sample objects in the image sample set to be trained can be selected according to the camera attributes, thereby obtaining different image samples of the same target sample object.

[0110] In order to elaborate on the method for determining training samples in this application, Figure 6 The flowchart shown further illustrates it, and the details are as follows:

[0111] First, obtain the initial image sample set, which includes image samples and corresponding identity labels; select effective sample objects according to the image feature similarity between image samples of the same sample object, remove sample objects whose image samples are very similar and have little distinction within the same sample object, and obtain the image sample set; start a new round of epoch training for the image sample set (epoch means that the entire image sample set has completed a forward calculation + back propagation process), and end the training if the preset epoch is reached; if the preset epoch is not reached, perform inter-class difficult example mining on each sample object to obtain the difficult sample objects (initial sample objects) corresponding to each sample object, specifically including selecting each sample separately A representative image sample corresponding to the object; according to the feature similarity between the image features of the representative image sample of each sample object and the image features of the representative image samples of other sample objects, the first N other sample objects are selected from the largest to the smallest according to the feature similarity as the difficult sample objects (initial sample objects) corresponding to each sample object; the sample object set S is initialized to all sample objects in the image sample set, and iterative training begins; if the set S>P, P is the number of sample objects to be selected; then A anchor sample objects and their corresponding initial sample objects are selected in batches from the set S, and the A anchor sample objects are iteratively selected to obtain a total of A*(1+N)=P target sample objects (the target sample objects after each iteration are removed from the sample object set Delete and update the collection ); Sample difficult images (target image samples) for each target sample object, and obtain a total of P*K images as the current training Batch; input the current Batch into the network model and optimize it using triplet loss and classification loss.

[0112] See also Figure 7 , Figure 7 It is a structural diagram of an exemplary embodiment of the training sample determination device shown in the present application. The training sample determination device 700 includes an acquisition module 710, a first selection module 720 and a second selection module 730. The acquisition module 710 is used to acquire an image sample set, and the image sample set includes sample objects; the first selection module 720 is used to select a target sample object from each sample object in the image sample set according to the similarity between each sample object; the second selection module 730 is used to select a target image sample from the corresponding different image samples according to the image attribute information of each target sample object in different image samples, and the target image sample is used for sample object recognition training.

[0113] In the above scheme, the training sample determination device obtains an image sample set, which includes sample objects; selects a target sample object from each sample object according to the similarity between each sample object in the image sample set; selects a target image sample from the corresponding different image samples according to the image attribute information of each target sample object in different image samples, and the target image sample is used for sample object recognition training. Thus, the target sample object is first selected according to the similarity of each sample object to ensure the validity of the inter-class training sample; then the target image sample is selected according to the image attribute information of each target sample object in different image samples to ensure the validity of the intra-class training sample; through the dual selection between classes and within classes, it is ensured that the information of the training sample is rich and effective.

[0114] The functions of each module can be found in the embodiment of the training sample determination method, which will not be described in detail here.

[0115] In order to implement the training sample determination method and / or the network model training method based on target object recognition in the above-mentioned embodiment, the present application proposes another electronic device, which is specifically referred to as Figure 8 , Figure 8 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application.

[0116] The electronic device 800 includes a memory 810 and a processor 820 , wherein the memory 810 and the processor 820 are coupled.

[0117] The memory 810 is used to store program data, and the processor 820 is used to execute the program data to implement the training sample determination method and / or the network model training method based on target object recognition of the above-mentioned embodiment.

[0118] In this embodiment, the processor 820 may also be referred to as a CPU (Central Processing Unit). The processor 820 may be an integrated circuit chip having signal processing capabilities. The processor 820 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 820 may also be any conventional processor, etc.

[0119] The present application also provides a computer-readable storage medium, such as Fig. 9 As shown, the computer-readable storage medium 900 is used to store program data 910. When the program data 910 is executed by the processor, it is used to implement the training sample determination method and / or the network model training method based on target object recognition in the method embodiment of the present application.

[0120] The methods involved in the embodiments of the training sample determination method and / or the network model training method based on target object recognition of the present application, when implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a device, such as a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0121] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for determining a training sample, characterized in that: The training sample determination method comprises: Acquire an image sample set, wherein the image sample set includes sample objects; Selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set; Selecting target image samples from the corresponding different image samples according to the image attribute information of each target sample object in the different image samples, wherein the target image samples are used for sample object recognition training; The step of selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set comprises: Selecting an initial sample object corresponding to each sample object from each sample object according to the image feature similarity between the image sample where each sample object is located and the image samples where other sample objects are located; Selecting the target sample object from each sample object according to the initial sample object corresponding to each sample object; The step of selecting the target sample object from each sample object according to the initial sample object corresponding to each sample object comprises: constructing a sample object set using the sample objects in the image sample set; removing the sample objects included in the target sample object set from the sample object set to obtain a sample object set after removal, wherein the target sample object set is used to store the target sample objects; In response to the initial sample object corresponding to the sample object not existing in the target sample object set, the sample object and the initial sample object corresponding to the sample object are included in the target sample object set; In response to the presence of a sample object included in the target sample object set in the initial sample objects corresponding to the sample object, randomly selecting a number of sample objects to be included from the removed sample object set except for the sample object and the initial sample object corresponding to the sample object, the number of sample objects to be included being the number of sample objects included in the target sample object set in the initial sample objects corresponding to the sample object; The sample objects that are not included in the target sample object set, the included number of sample objects, and the sample object in the initial sample objects corresponding to the sample object are included in the target sample object set.

2. The method for determining training samples according to claim 1, characterized in that: The step of selecting the initial sample objects corresponding to each sample object from each sample object according to the image feature similarity between the image sample where each sample object is located and the image samples where other sample objects are located comprises: Selecting a first preset number of image samples from the image samples where each sample object is located as representative image samples of each sample object; Determine a similarity matrix according to the image feature similarity between the image features of the representative image samples of each sample object and the image features of the representative image samples of other sample objects; The initial sample object corresponding to each sample object is determined according to the similarity matrix.

3. The method for determining training samples according to claim 1, characterized in that: The image attribute information includes image attribute categories, and the step of selecting target image samples from corresponding different image samples according to the image attribute information of each target sample object in different image samples includes: Selecting a second preset number of image samples from image samples of different image attribute categories as initial image samples corresponding to the target sample objects according to the image attribute categories of the image samples where the target sample objects are located; The target image samples corresponding to the target sample objects are determined according to the size relationship between the initial number of the initial image samples of each target sample object and the preset number of image samples corresponding to the target sample objects.

4. The method for determining training samples according to claim 3, characterized in that: The step of determining the target image samples corresponding to the target sample objects according to the size relationship between the initial number of the initial image samples of each target sample object and the preset number of image samples corresponding to the target sample object comprises: In response to an initial number of initial image samples of the target sample object being greater than or equal to a preset number of image samples of the target sample object, randomly selecting image samples of the preset number of image samples from the initial image samples of the target sample object as target image samples of the target sample object; In response to an initial number of initial image samples of the target sample object being less than a preset number of image samples of the target sample object, obtaining a first difference between the preset number of image samples and the initial number and a second difference between a total number of image samples where the target sample object is located and the initial number; In response to the second difference being greater than or equal to the first difference, selecting an image sample of the first difference from image samples other than the initial image sample of the target sample object in the image samples where the target sample object is located, and determining the image sample of the first difference and the initial image sample of the target sample object as the target image sample of the target sample object; In response to the second difference being smaller than the first difference, an image sample of the first difference is selected from the image samples where the target sample object is located, and the image sample of the first difference and the initial image sample of the target sample object are determined as the target image sample of the target sample object.

5. The method for determining training samples according to claim 1, characterized in that: The step of acquiring an image sample set, wherein the image sample set includes sample objects, comprises: Acquire an initial image sample set, wherein the number of image samples in the initial image sample set is greater than the number of image samples in the image sample set; Classifying the initial image sample set according to sample objects to obtain image samples of each category; Obtain the image feature similarity and the minimum feature similarity between image samples in the same category; In response to the minimum feature similarity value among the image samples of each category being less than the preset feature similarity value, the image samples of the corresponding category are deleted from the initial image sample set to obtain the image sample set.

6. A network model training method based on target object recognition, characterized in that: The network model training method comprises: A target image sample set to be trained is obtained, wherein the target image sample is based on an image sample set, wherein the image sample set includes sample objects; a target sample object is selected from each sample object according to the similarity between each sample object in the image sample set; a target image sample is selected from corresponding different image samples according to image attribute information of each target sample object in different image samples; the step of selecting a target sample object from each sample object according to the similarity between each sample object in the image sample set comprises: selecting an initial sample object corresponding to each sample object from each sample object according to the image feature similarity between the image sample where each sample object is located and the image sample where other sample objects are located; selecting the target sample object from each sample object according to the initial sample object corresponding to each sample object; the step of selecting the target sample object from each sample object according to the initial sample object corresponding to each sample object comprises: constructing a sample object set with the sample objects in the image sample set; The sample objects that have been included in the target sample object set are removed from the sample object set to obtain a sample object set after removal, and the target sample object set is used to store the target sample object; in response to the initial sample object corresponding to the sample object not existing in the target sample object set, the sample object and the initial sample object corresponding to the sample object are included in the target sample object set; in response to the presence of a sample object included in the target sample object set in the initial sample object corresponding to the sample object, a number of sample objects to be included are randomly selected from the sample object set after removal except for the sample object and the initial sample object corresponding to the sample object, and the number of sample objects to be included is the number of sample objects included in the target sample object set in the initial sample object corresponding to the sample object; the sample objects that are not included in the target sample object set, the number of sample objects to be included, and the sample object are included in the target sample object set; Inputting the target image sample into the network model to obtain a sample object output by the network model; Calculating the loss value of the loss function between the sample object output by the network model and the target sample object; The network model is trained with the goal of reducing the loss value until the loss value meets the preset requirements, thereby obtaining a network model that meets the requirements.

7. The network model training method according to claim 6, characterized in that: The method further comprises: In the process of training the network model with the loss value being reduced as the goal, if the loss value does not meet the preset requirement, reselecting image samples to be trained from the image sample set to obtain an image sample set to be trained, wherein the image samples in the image sample set to be trained are determined based on image attribute information of target sample objects in different image samples in the image sample set, and there are image samples in the target image sample set that are different from the image samples in the image sample set to be trained; Inputting the image sample to be trained into the network model to obtain a sample object output by the network model; Calculating the loss value of the loss function between the sample object output by the network model and the target sample object; The network model is trained with the goal of reducing the loss value until the loss value meets the preset requirements, thereby obtaining a network model that meets the requirements.

8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the training sample determination method as described in any one of claims 1-5 and / or the network model training method based on target object recognition as described in any one of claims 6-7.

9. A computer-readable storage medium, characterized in that: include: Program data is stored, and when the program data is executed by a processor, it is used to implement the training sample determination method according to any one of claims 1 to 5 and / or the network model training method based on target object recognition according to any one of claims 6 to 7.

Citation Information

Patent Citations

  • Method for training signboard classification model and signboard classification

    CN113344121A

  • Neural network model training method and device, terminal and storage medium

    CN117892795A