CN-118053056-B - Training method and device for image segmentation model, electronic equipment and medium
Abstract
The method comprises the steps of obtaining an image set and an initial image segmentation model, wherein the image set comprises an original image and a true image of the original image, the true image indicates object types of all pixel points in the original image, conducting blurring processing on a target area in the original image to obtain a blurred image corresponding to the original image, constructing training data according to all the blurred images and the true image of the original image corresponding to the blurred image, conducting training processing on the initial image segmentation model by adopting the training data, obtaining the blurred image through blurring processing on the target area in the original image, further constructing the training data, avoiding determining the training data based on continuous multi-frame images and corresponding marking data, accordingly reducing training cost of the image segmentation model, and improving training efficiency of the image segmentation model.
Inventors
- HAN BINGNAN
- HUANG YUAN
- CHU FUCHEN
- Yin xuanwu
Assignees
- 上海玄戒技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20240329
Claims (13)
- 1. A method of training an image segmentation model, the method comprising: Acquiring an image set and an initial image segmentation model, wherein the image set comprises an original image and a true image of the original image, and the true image indicates object types of all pixel points in the original image; performing blurring processing on a target area in the original image to obtain a blurred image corresponding to the original image; Constructing training data according to each blurred image and a truth image of an original image corresponding to the blurred image; training the initial image segmentation model by adopting the training data; the training data is adopted to train the initial image segmentation model, the training data comprises the steps of inputting the blurred image into the image segmentation model to obtain a predicted value image output by the image segmentation model, indicating the predicted object category of each pixel point in the blurred image, determining the numerical value of the loss function according to the predicted value image, the true value image of the original image corresponding to the blurred image and the loss function of the image segmentation model, and carrying out parameter adjustment processing on the image segmentation model according to the numerical value of the loss function to realize training.
- 2. The method of claim 1, wherein the target region is a region corresponding to at least one target object class in the original image, the method further comprising: determining the object category of each pixel point in the original image according to the truth image of the original image; selecting at least one target object class from a plurality of object classes; and determining an area formed by the pixel points with the target object category in the original image as the target area aiming at each target object category.
- 3. The method of claim 2, wherein selecting at least one target object class from a plurality of object classes comprises: acquiring at least one candidate object category from a plurality of object categories, wherein an object corresponding to the candidate object category is a movable object; The target object class is selected from at least one candidate object class.
- 4. The method according to claim 2, wherein after determining, for each target object class, an area composed of pixels having the target object class in the original image as the target area, the method further comprises: Acquiring a pixel point displacement quantity threshold; according to the pixel displacement quantity threshold, performing pixel diffusion processing on the boundary of the target area in the original image to obtain a processed area in the original image; And updating the target area according to the processed area.
- 5. The method according to claim 1, wherein the blurring processing is performed on the target area in the original image to obtain a blurred image corresponding to the original image, including: Determining a blur kernel of the target area; Performing fuzzy processing on the target area based on the fuzzy check to obtain a fuzzy area corresponding to the target area; And replacing the target area in the original image by adopting a blurred area corresponding to the target area to obtain the blurred image.
- 6. The method of claim 5, wherein the determining the blur kernel for the target region comprises: determining the size and the rotation angle of a fuzzy core; Acquiring an identity matrix with the fuzzy kernel size; and determining a fuzzy core of the target area according to the identity matrix, the rotation angle, the radiation transformation matrix provided with a first variable and the size information of the target area, wherein the first variable is a rotation center point coordinate, and the rotation center point coordinate is determined according to the identity matrix.
- 7. The method of claim 6, wherein the determining the blur kernel size and the rotation angle comprises: acquiring a preset size range and an angle range; randomly selecting a size from the preset size range as the size of the fuzzy core; and randomly selecting an angle from the angle range as the rotation angle.
- 8. An image segmentation method, the method comprising: acquiring an image to be processed; The method comprises the steps of inputting an image to be processed into a preset image segmentation model to obtain a predicted value image output by the image segmentation model, wherein the predicted value image indicates the predicted object category of each pixel point in the image to be processed, and the image segmentation model is obtained by combining a sample original image, a true value image of the sample original image and a sample fuzzy image corresponding to the sample original image for training; Determining an image segmentation result of the image to be processed according to the image to be processed and the predicted value image; The training mode of the image segmentation model comprises the steps of inputting the sample blurred image into the image segmentation model, obtaining a sample predicted value image output by the image segmentation model, indicating the predicted object category of each pixel point in the sample blurred image by the sample predicted value image, determining the numerical value of a loss function of the loss function according to the sample predicted value image, a true value image of the sample original image and the loss function of the image segmentation model, and carrying out parameter adjustment processing on the image segmentation model according to the numerical value of the loss function to realize training.
- 9. An apparatus for training an image segmentation model, the apparatus comprising: The image acquisition module is used for acquiring an image set and an initial image segmentation model, wherein the image set comprises an original image and a true image of the original image, and the true image indicates object types of all pixel points in the original image; The blurring processing module is used for blurring processing the target area in the original image to obtain a blurred image corresponding to the original image; The construction module is used for constructing training data according to each blurred image and the truth image of the original image corresponding to the blurred image; The training processing module is used for training the initial image segmentation model by adopting the training data; The training processing module is specifically configured to input the blurred image into the image segmentation model to obtain a predicted value image output by the image segmentation model, the predicted value image indicates a predicted object category of each pixel point in the blurred image, determine a numerical value of a loss function of the image segmentation model according to the predicted value image, a true value image of an original image corresponding to the blurred image and the loss function of the image segmentation model, and perform parameter adjustment processing on the image segmentation model according to the numerical value of the loss function to realize training.
- 10. An image segmentation apparatus, the apparatus comprising: The acquisition module is used for acquiring the image to be processed; The input module is used for inputting the image to be processed into a preset image segmentation model and obtaining a predicted value image output by the image segmentation model; the image segmentation model is obtained by combining a sample original image, a true value image of the sample original image and a sample blurred image corresponding to the sample original image in a training way, wherein the sample blurred image is obtained by carrying out regional blurring processing on the sample original image; the determining module is used for determining an image segmentation result of the image to be processed according to the image to be processed and the predicted value image; The training mode of the image segmentation model comprises the steps of inputting the sample blurred image into the image segmentation model, obtaining a sample predicted value image output by the image segmentation model, indicating the predicted object category of each pixel point in the sample blurred image by the sample predicted value image, determining the numerical value of a loss function of the loss function according to the sample predicted value image, a true value image of the sample original image and the loss function of the image segmentation model, and carrying out parameter adjustment processing on the image segmentation model according to the numerical value of the loss function to realize training.
- 11. An electronic device, comprising: A processor; a memory for storing the processor-executable instructions; Wherein the processor is configured to: A step of implementing a training method of an image segmentation model according to any one of claims 1 to 7, or an image segmentation method according to claim 8.
- 12. A non-transitory computer readable storage medium, which when executed by a processor, causes the processor to perform the training method of the image segmentation model of any one of claims 1 to 7, or to perform the image segmentation method of claim 8.
- 13. A chip comprising one or more interface circuits and one or more processors, the interface circuits being configured to receive signals from a memory of an electronic device and to send the signals to the processor, the signals comprising computer instructions stored in the memory, which when executed by the processor, cause the electronic device to perform the training method of the image segmentation model of any one of claims 1 to 7, or to perform the image segmentation method of claim 8.
Description
Training method and device for image segmentation model, electronic equipment and medium Technical Field The disclosure relates to the technical field of image processing, and in particular relates to a training method and device for an image segmentation model, electronic equipment and a medium. Background At present, in the training method of the image segmentation model, a continuous multi-frame image is obtained, an initial frame image and other frame images are fused to obtain a fuzzy image, and training data is built by combining the fuzzy image and the labeling data of the continuous multi-frame image and used for training the image segmentation model. The continuous multi-frame images and the corresponding marking data are difficult to acquire, the acquisition cost is high, the acquisition time is long, the training cost of the image segmentation model is high, and the training efficiency is poor. Disclosure of Invention The disclosure provides a training method and device for an image segmentation model, electronic equipment and a medium. According to a first aspect of an embodiment of the present disclosure, a training method for an image segmentation model is provided, where the method includes obtaining an image set and an initial image segmentation model, where the image set includes an original image and a true image of the original image, the true image indicates object types of each pixel point in the original image, performing blur processing on a target area in the original image to obtain a blurred image corresponding to the original image, constructing training data according to each blurred image and the true image of the original image corresponding to the blurred image, and performing training processing on the initial image segmentation model by using the training data. In one embodiment of the disclosure, the target area is an area corresponding to at least one target object category in the original image, the method further comprises determining object categories of pixel points in the original image according to a truth image of the original image, selecting at least one target object category from a plurality of object categories, and determining an area composed of the pixel points with the target object category in the original image as the target area according to each target object category. In one embodiment of the disclosure, the selecting at least one target object class from a plurality of object classes includes obtaining at least one candidate object class from the plurality of object classes, wherein the object corresponding to the candidate object class is a movable object, and selecting the target object class from the at least one candidate object class. In one embodiment of the disclosure, after determining, for each target object type, an area formed by pixels having the target object type in the original image as the target area, the method further includes obtaining a pixel displacement number threshold, performing pixel diffusion processing on a boundary of the target area in the original image according to the pixel displacement number threshold to obtain a processed area in the original image, and performing update processing on the target area according to the processed area. In one embodiment of the disclosure, the blurring processing is performed on a target area in the original image to obtain a blurred image corresponding to the original image, and the blurring processing includes determining a blurring kernel of the target area, performing blurring processing on the target area based on the blurring kernel to obtain a blurred area corresponding to the target area, and performing replacement processing on the target area in the original image by using the blurred area corresponding to the target area to obtain the blurred image. In one embodiment of the disclosure, the determining the blur kernel of the target area comprises determining a blur kernel size and a rotation angle, obtaining an identity matrix with the blur kernel size, determining the blur kernel of the target area according to the identity matrix, the rotation angle, a radiation transformation matrix provided with a first variable and size information of the target area, wherein the first variable is rotation center point coordinates, and the rotation center point coordinates are determined according to the identity matrix. In one embodiment of the disclosure, the determining the size and the rotation angle of the blur kernel includes obtaining a preset size range and an angle range, randomly selecting one size from the preset size range as the size of the blur kernel, and randomly selecting one angle from the angle range as the rotation angle. In one embodiment of the disclosure, the training of the initial image segmentation model by using the training data includes inputting the blurred image into the image segmentation model, obtaining a predicted value image output by the image segment