CN-117152428-B - Model training method, device, computer equipment and computer readable storage medium
Abstract
The application relates to a model training method, a model training device, computer equipment and a computer readable storage medium. The method comprises the steps of obtaining a plurality of training images and a plurality of candidate images, inputting the training images into an initial semantic segmentation model to obtain a first prediction matrix, inputting the candidate images into the initial semantic segmentation model to obtain a second prediction matrix, determining the prediction difference degree of the candidate images based on the second prediction matrix corresponding to the candidate images, determining the feature similarity between the candidate images and the plurality of training images based on the second prediction matrix corresponding to the candidate images and the first prediction matrix corresponding to the training images, determining a target image based on the prediction difference degree and the feature similarity of each candidate image, and training the initial semantic segmentation model based on the target image to obtain the target semantic segmentation model. By adopting the method, the model training efficiency can be improved.
Inventors
- YAN ZEXIN
- LIU SHU
- LV JIANGBO
- SHEN XIAOYONG
- Tian Zhuotao
Assignees
- 北京思谋智能科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20230704
Claims (10)
- 1. A method of model training, comprising: Acquiring a plurality of training images and a plurality of candidate images; inputting the training image into an initial semantic segmentation model to obtain a first prediction matrix; inputting the candidate images into the initial semantic segmentation model to obtain a second prediction matrix; Determining the average probability corresponding to each image category based on a second prediction matrix corresponding to the candidate image, wherein the second prediction matrix is a three-dimensional matrix, and element values in the second prediction matrix represent the probability of the image category corresponding to the pixel point in the candidate image; determining feature similarity between the candidate image and a plurality of training images based on a second prediction matrix corresponding to the candidate image and a first prediction matrix corresponding to the training image; The method comprises the steps of obtaining a candidate image, carrying out a number changing process on the feature similarity of the candidate image to obtain a target feature similarity, wherein the number changing process refers to adding a negative sign to the feature similarity, adding the target feature similarity to the prediction difference degree of the candidate image to obtain a candidate evaluation value of the candidate image, and determining a candidate image corresponding to the largest candidate evaluation value in the candidate evaluation values of the candidate images as the target image; And training the initial semantic segmentation model based on the target image to obtain a target semantic segmentation model.
- 2. The method of claim 1, wherein the screening the first average probability and the second average probability from the average probabilities corresponding to the respective image categories comprises: Comparing the average probability corresponding to each image category in the second prediction matrix; determining the maximum average probability as a first average probability; the average probability that is the second largest is determined as the second average probability.
- 3. The method of claim 1, wherein the determining feature similarity of the candidate image and the plurality of training images based on the second prediction matrix corresponding to the candidate image and the first prediction matrix corresponding to the training image comprises: Based on the prediction matrix, extracting the characteristics of the image to obtain a characteristic matrix corresponding to the image; the prediction matrix comprises a first prediction matrix corresponding to the training image and a second prediction matrix corresponding to the candidate image, wherein when the prediction matrix is the first prediction matrix, a first feature matrix corresponding to the training image is obtained; determining a similarity between the candidate image and the training image based on the second feature matrix and the first feature matrix; And determining the smallest similarity in the multiple similarities as the characteristic similarity between the candidate image and the multiple training images, wherein the multiple similarities are in one-to-one correspondence with the multiple training images.
- 4. A method according to claim 3, wherein the feature extraction of the image based on the prediction matrix to obtain the feature matrix corresponding to the image comprises: determining a label matrix corresponding to the image based on the prediction matrix; performing dimension reduction conversion on the prediction matrix to obtain a prediction dimension reduction matrix; performing transposition treatment on the label dimension-reducing matrix to obtain a label transposition matrix; and carrying out fusion processing on the prediction dimension-reducing matrix and the label transpose matrix to obtain a feature matrix corresponding to the image.
- 5. The method of claim 4, wherein determining a label matrix for the image based on the prediction matrix comprises: For each pixel point in an image, determining an image category corresponding to the maximum probability as a target category corresponding to the pixel point, wherein the maximum probability is the maximum probability of the image categories corresponding to the pixel point; and setting the probability of the target category corresponding to the pixel point in the prediction matrix as a first identifier, and setting the probabilities of the rest image categories as a second identifier to obtain a label matrix corresponding to the image.
- 6. The method of claim 1, wherein determining a difference between the first average probability and the second average probability as a predictive difference degree of the candidate image comprises: subtracting the second average probability from the first average probability to obtain a probability difference value; And determining the probability difference value as the prediction difference degree of the candidate image.
- 7. The method according to claim 1, wherein the method further comprises: updating the statistical quantity of the target images to obtain the statistical quantity of the current target images; under the condition that the statistical quantity of the current target images is smaller than the preset quantity, taking the target images as training images to obtain a plurality of updated training images and a plurality of candidate images; repeatedly executing the step of obtaining a target image based on the updated plurality of training images and the plurality of candidate images; obtaining target images with the preset number until the statistical number of the current target images is equal to the preset number; Training the initial semantic segmentation model based on the target image to obtain a target semantic segmentation model, wherein the training comprises the following steps: training the initial semantic segmentation model based on the preset number of target images to obtain a target semantic segmentation model.
- 8. A model training device, comprising: The acquisition module is used for acquiring a plurality of training images and a plurality of candidate images; The input module is used for inputting the training image into an initial semantic segmentation model to obtain a first prediction matrix; The device comprises a first determination module, a first prediction matrix, a second prediction matrix, a first average probability, a second average probability, a third average probability, a prediction difference degree and a prediction difference degree, wherein the first determination module is used for determining the average probability corresponding to each image category based on a second prediction matrix corresponding to the candidate image; the second determining module is used for determining the feature similarity between the candidate image and a plurality of training images based on a second prediction matrix corresponding to the candidate image and a first prediction matrix corresponding to the training image; The image segmentation method comprises a selection module, a training module and a training module, wherein the selection module is used for carrying out a number changing process on the feature similarity of candidate images to obtain target feature similarity, the number changing process is used for adding a negative sign to the feature similarity, the prediction difference of the candidate images is added with the target feature similarity to obtain candidate evaluation values of the candidate images, the candidate image corresponding to the largest candidate evaluation value in the candidate evaluation values of the candidate images is determined to be the target image, and the training module is used for training the initial semantic segmentation model based on the target image to obtain a target semantic segmentation model.
- 9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
Description
Model training method, device, computer equipment and computer readable storage medium Technical Field The present application relates to the field of artificial intelligence, and in particular, to a model training method, apparatus, computer device, and computer readable storage medium. Background With the development of computer technology, a neural network model is widely applied to semantic segmentation of images, wherein the semantic segmentation refers to classification of pixel points in the images on image categories, and training of the neural network model is required before use in order to enable the output result of the neural network model to be more accurate. In the traditional technology, a large number of images are manually marked to obtain training images, and then the training images are used for training the neural network model to obtain the neural network model with higher accuracy. Disclosure of Invention In view of the foregoing, it is desirable to provide a model training method, apparatus, computer device, computer readable storage medium, and computer program product that can achieve an improvement in model training efficiency. In a first aspect, the present application provides a model training method, including: Acquiring a plurality of training images and a plurality of candidate images; Inputting the candidate images into the initial semantic segmentation model to obtain a second prediction matrix; determining the prediction difference degree of the candidate image based on a second prediction matrix corresponding to the candidate image; determining the feature similarity of the candidate image and a plurality of training images based on the second prediction matrix corresponding to the candidate image and the first prediction matrix corresponding to the training image; determining a target image based on the prediction difference degree and the feature similarity of each candidate image; training the initial semantic segmentation model based on the target image to obtain a target semantic segmentation model. In a second aspect, the present application further provides a model training apparatus, including: The acquisition module is used for acquiring a plurality of training images and a plurality of candidate images; The input module is used for inputting the training image into the initial semantic segmentation model to obtain a first prediction matrix; The first determining module is used for determining the prediction difference degree of the candidate image based on the second prediction matrix corresponding to the candidate image; the second determining module is used for determining the feature similarity between the candidate image and the plurality of training images based on the second prediction matrix corresponding to the candidate image and the first prediction matrix corresponding to the training image; The selection module is used for determining a target image based on the prediction difference degree and the feature similarity of each candidate image; The training module is used for training the initial semantic segmentation model based on the target image to obtain a target semantic segmentation model. In a third aspect, the present application also provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the model training method described above when executing the computer program. In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the model training method described above. In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the model training method described above. According to the model training method, the device, the computer equipment and the computer readable storage medium, a plurality of training images and a plurality of candidate images are obtained, the marked training images are input into an initial semantic segmentation model to obtain a first prediction matrix, the unmarked candidate images are input into the initial semantic segmentation model to obtain a second prediction matrix, the prediction difference degree of the initial semantic segmentation model on the candidate images is determined according to the second prediction matrix corresponding to the candidate images, namely, the accuracy degree of the initial semantic segmentation model on the prediction of the candidate images is determined, the greater the prediction difference degree is, the lower the accuracy degree of the initial semantic segmentation model on the candidate images is represented, the uncertainty of the candidate images on the initial semantic segmentation model is higher, the feature similarity of the cand