CN-121982324-A - Training method and device for segmentation model, segmentation method and device, equipment and medium
Abstract
The application discloses a training method, a segmentation device, equipment and a medium of a segmentation model, wherein the training method comprises the steps of obtaining a battery pole piece data set; the method comprises the steps of carrying out feature extraction on data of an L-th battery pole piece to obtain image sharing features, utilizing an N-1-th segmentation model obtained after the completion of training of the N-1-th training round in the N-th training round, determining the N-th mask based on the image sharing features and the N-1-th mask, updating parameters of the N-1-th segmentation model based on a preset loss function to obtain the N-th segmentation model, and continuing to execute the N+1-th training round based on the image sharing features, the N-th mask and the N-th segmentation model, and carrying out iterative training to obtain the L-th segmentation model. Therefore, the cyclic repair mechanism is beneficial to enabling the mask of the area with complex structure and difficult recognition to gradually approach the real mask distribution, realizing monotonic decrease and steady state convergence of mask errors, and improving the boundary quality and stability.
Inventors
- HUANG YUNLONG
- JIANG JUNJIE
- ZHANG SONGHUA
- CAO CHUN
- LU SHIYU
- LI MIAN
- WANG TIANYU
Assignees
- 宁德时代新能源科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260409
Claims (15)
- 1. A method of training a segmentation model, the method comprising: Acquiring a battery pole piece data set, wherein the battery pole piece data set comprises X-ray two-dimensional plane images and/or X-ray three-dimensional data of a plurality of battery internal pole pieces; Extracting features of the battery pole piece data of the L batch to obtain image sharing features, wherein the image sharing features are features of multi-scale information of the battery pole piece data; In the N training round, the N-1 segmentation model obtained by finishing the training of the N-1 training round is utilized to fuse the image sharing characteristics with the N-1 mask to determine the N mask; And based on the image sharing characteristics, the Nth mask and the Nth segmentation model, continuing to execute the N+1 training round, and iterating the training until the absolute value of the difference value between the global loss of the Nth training round and the global loss of the N-1 training round is smaller than a preset global loss threshold and/or the training round reaches a preset training round threshold, thereby obtaining the L-th segmentation model.
- 2. The method of claim 1, wherein the fusing the image sharing feature and the N-1 th mask with the N-1 th segmentation model obtained by the N-1 th training round training completion, determining the N-th mask comprises: processing the N-1 mask by using the N-1 segmentation model to obtain N-1 mask characteristics; And processing the N-1 mask feature and the image sharing feature by using the N-1 segmentation model to obtain the N mask.
- 3. The method of claim 2, wherein the image sharing feature comprises a first resolution sharing feature and a second resolution sharing feature, the first resolution sharing feature retaining more detail information than the second resolution sharing feature retains; The processing the N-1 th mask feature and the image sharing feature by using the N-1 th segmentation model to obtain the N-th mask includes: Performing fusion processing on the N-1 mask feature and the first resolution sharing feature to obtain a first resolution fusion feature of an N-1 training round, and processing the first resolution fusion feature of the N-1 training round to obtain a first resolution mask of the N training round and a first resolution decoding feature of the N training round; Performing fusion processing on the N-1 mask feature and the second resolution sharing feature to obtain a second resolution fusion feature of the N-1 training round, and processing the second resolution fusion feature of the N-1 training round to obtain a second resolution mask of the N training round and a second resolution decoding feature of the N training round; And performing cross-scale fusion processing on the first resolution decoding characteristic of the Nth training round and the second resolution decoding characteristic of the Nth training round to obtain an Nth mask of the Nth training round.
- 4. A method according to any one of claims 1-3, wherein the L-th battery pole piece data comprises a first resolution raw image and a second resolution raw image, the first resolution raw image having a higher resolution than the second resolution raw image; the feature extraction is performed on the data of the battery pole pieces of the L batch to obtain image sharing features, and the feature extraction comprises the following steps: respectively carrying out normalization, denoising and size unification on the first resolution original image and the second resolution original image to obtain a first resolution input image and a second resolution input image; The shared encoder of the L-1 th segmentation model obtained by training the L-1 th batch of battery pole piece data is used for carrying out encoding processing on the first resolution input image, so as to obtain a first resolution shared characteristic; And carrying out coding processing on the second resolution input image by using a shared coder of an L-1 segmentation model obtained by training the L-1 battery pole piece data to obtain second resolution shared characteristics.
- 5. A method according to claim 3, wherein for a first training round, the method further comprises: taking the first resolution sharing feature as a first resolution fusion feature of a first training round; the second resolution shared feature is used as a second resolution fusion feature of the first training round.
- 6. A method according to claim 3, wherein updating the parameters of the N-1 th segmentation model based on a preset loss function to obtain an N-th segmentation model comprises: performing difference calculation on a marking mask corresponding to the data of the battery pole pieces of the L batch and a first resolution mask of the N training round based on the first loss function to obtain first loss; performing difference calculation on the marking mask corresponding to the data of the battery pole pieces of the L batch and the second resolution mask of the N training round based on the second loss function to obtain second loss; and determining a target loss based on the first loss, a first preset weight corresponding to the first loss, the second loss and a second preset weight corresponding to the second loss, and updating each parameter in the segmentation model based on the target loss to obtain the Nth segmentation model.
- 7. A method according to any of claims 1-3, wherein after the obtaining of the L-th segmentation model, the method further comprises: obtaining the L+1st batch of battery pole piece data in the battery pole piece data set; Training the L-th segmentation model for a plurality of training rounds based on the L+1-th battery pole piece data to obtain an L+1-th segmentation model; and iterating the training process of the L-th segmentation model for a plurality of training rounds based on the L+1-th batch of battery pole piece data until the training is completed on all battery pole piece data in the battery pole piece data set, and obtaining a target segmentation model.
- 8. A method of segmenting a pole piece image, the method comprising: Acquiring a pole piece image of a battery; Processing the pole piece image by utilizing a pre-trained target segmentation model to obtain an initial mask corresponding to the pole piece image; Acquiring user prompt information under the condition that the confidence coefficient of one or more areas in the initial mask is smaller than a preset confidence coefficient or accords with a consistency training loss rule, and processing the user prompt information and the initial mask by utilizing the target segmentation model to determine an updated mask; Iterating the determined process until reaching a preset iteration number to obtain a target mask, wherein the target mask is used for indicating a pole piece segmentation result of a pole piece image of the battery; the target segmentation model is obtained through training in the following mode: The target segmentation model is a final K-th segmentation model obtained by performing iterative training on the initial segmentation model based on K batches of battery pole piece data in the battery pole piece data set; The method for training the L-th segmentation model comprises the steps of obtaining a battery pole piece data set, wherein the battery pole piece data set comprises X-ray two-dimensional plane images and/or X-ray three-dimensional data of a plurality of battery internal pole pieces; Extracting features of the battery pole piece data of the L batch to obtain image sharing features, wherein the image sharing features are features of multi-scale information of the battery pole piece data; In the N training round, the N-1 segmentation model obtained by finishing the training of the N-1 training round is utilized to fuse the image sharing characteristics with the N-1 mask to determine the N mask; And based on the image sharing characteristics, the Nth mask and the Nth segmentation model, continuing to execute the N+1 training round, and iterating the training until the absolute value of the difference value between the global loss of the Nth training round and the global loss of the N-1 training round is smaller than a preset global loss threshold value and/or the training round reaches a preset training round threshold value, so as to obtain the L-th segmentation model, wherein L is a positive integer smaller than K.
- 9. The method according to claim 8, wherein the kth segmentation model is obtained by performing N-th iterative training on the kth segmentation model by using the K-1 mask and the image sharing feature corresponding to the kth battery pole piece data in the training process of the kth training round based on the kth battery pole piece data until an absolute value of a difference between a global loss of the nth training round and a global loss of the nth training round is smaller than a preset global loss threshold and/or the training round reaches a preset training round threshold.
- 10. The method of claim 8, wherein processing the pole piece image using a pre-trained object segmentation model to obtain an initial mask corresponding to the pole piece image comprises: Sampling is carried out on the pole piece image according to a preset step length to obtain a plurality of sampling points; Processing the plurality of sampling points by using the target segmentation model to obtain local masks corresponding to the sampling points; Screening the local masks corresponding to the sampling points to obtain a plurality of screened local masks; And fusing the screened multiple local masks to determine an initial mask corresponding to the pole piece image.
- 11. The method of claim 10, wherein the filtering the local mask corresponding to each sampling point to obtain a plurality of local masks after filtering comprises: Determining a reference mask in local masks corresponding to the sampling points, acquiring the intersection ratio of the reference mask and each local mask, and determining a first mask set based on the local masks with the intersection ratio larger than a first preset value; screening based on the stability of each local mask in the first mask set to determine a second mask set; And screening each local mask in the second mask set based on the geometric features of the connected domain to obtain a plurality of screened local masks.
- 12. A training device for a segmentation model, comprising: The data acquisition unit is configured to acquire a battery pole piece data set, wherein the battery pole piece data set comprises X-ray two-dimensional plane images and/or X-ray three-dimensional stereo data of a plurality of battery internal pole pieces; The device comprises a feature extraction unit, a feature extraction unit and a storage unit, wherein the feature extraction unit is configured to perform feature extraction on the battery pole piece data of the L batch to obtain image sharing features, and the image sharing features are features of multi-scale information of the battery pole piece data; The model training unit is configured to fuse the image sharing characteristics and the N-1 mask by using an N-1 segmentation model obtained after the training of the N-1 training round in the N training round to determine the N mask; And the model training unit is further configured to continuously execute the N+1 training round based on the image sharing characteristic, the Nth mask and the Nth segmentation model, iterate training until the absolute value of the difference value between the global loss of the Nth training round and the global loss of the N-1 training round is smaller than a preset global loss threshold value and/or the training round reaches a preset training round threshold value, and obtain the L-th segmentation model.
- 13. A segmentation apparatus for pole piece images, comprising: The data acquisition unit is configured to acquire a pole piece image of the battery; the model reasoning unit is configured to process the pole piece image by utilizing a pre-trained target segmentation model to obtain an initial mask corresponding to the pole piece image; The model reasoning unit is further configured to acquire user prompt information and process the user prompt information and the initial mask by using the target segmentation model under the condition that the confidence coefficient of one or more areas in the initial mask is smaller than a preset confidence coefficient or accords with a consistency training loss rule, and determine an update mask, wherein the target segmentation model is obtained by training the target segmentation model into a final K-th segmentation model obtained by performing iterative training on the initial segmentation model based on K-th battery pole piece data in a battery pole piece data set, the method for training the L-th segmentation model in the process of training to obtain the K-th segmentation model comprises acquiring a battery pole piece data set, wherein the battery pole piece data set comprises X-ray two-dimensional plane images and/or X-ray three-dimensional data of a plurality of battery pole pieces, performing feature extraction on the L-th battery pole piece data to obtain image sharing features, the image sharing features are the features of retaining the multi-scale information of the battery pole piece data, in an N-th training round training, performing N-1-th round training is performed on the N-1-th segmentation model based on the N-1 th segmentation model, the N-1-th segmentation model is further fused, the N-1-th segmentation model is subjected to obtain a fusion function, the N-1-th segmentation model is obtained based on the N-1 th segmentation model is further fused, iterative training is carried out until the absolute value of the difference value between the global loss of the Nth training round and the global loss of the N-1 th training round is smaller than a preset global loss threshold value and/or the training round reaches a preset training round threshold value, so as to obtain an L-th segmentation model, wherein L is a positive integer smaller than K; and the interaction interface unit is configured to iterate the determined process until the preset iteration times are reached to obtain a target mask, wherein the target mask is used for indicating a pole piece segmentation result of the pole piece image of the battery.
- 14. An electronic device comprising a memory and a processor, wherein: the memory is used for storing a computer program capable of running on the processor; The processor for executing the computer program in the memory to implement the steps of the training method of the segmentation model of any one of claims 1-7 or the segmentation method of the pole piece image of any one of claims 8-11.
- 15. A computer storage medium having stored thereon a computer program which, when executed by a processor, implements the method of training the segmentation model of any one of claims 1-7 or the method of segmentation of the pole piece image of any one of claims 8-11.
Description
Training method and device for segmentation model, segmentation method and device, equipment and medium Technical Field The present application relates to the field of image recognition technologies, and in particular, to a training method, a segmentation method, a device, equipment, and a medium for a segmentation model. Background In the field of industrial manufacturing, particularly in the production process of lithium batteries, in order to ensure the quality and safety of products, on-line quality inspection of key parameters such as electrode overhang, diaphragm alignment and the like of the lithium batteries is required before delivery. In the related art, the scheme for detecting the quality of the battery comprises a supervision method based on a U-shaped network (Convolutional Networks for Biomedical Image Segmentation, U-NET), unet++ and the like, which has limited capability of describing fine grain boundaries and lower segmentation precision, and a weak supervision or non-supervision method based on a segmentation all Model (SEGMENT ANYTHING Model, SAM) and the like, which has poor performance in an industrial domain. Disclosure of Invention The application mainly provides a training method, a segmentation device, equipment and a medium of a segmentation model, which are beneficial to enabling masks of areas with complex structures and difficult recognition to gradually approach to real mask distribution through the cyclic repair mechanism, realizing monotonic decrease and steady state convergence of mask errors and improving boundary quality and stability. The technical scheme of the application is realized in this way. In a first aspect, the embodiment of the application provides a training method of a segmentation model, which comprises the steps of obtaining a battery pole piece data set, wherein the battery pole piece data set comprises X-ray two-dimensional plane images and/or X-ray three-dimensional data of a plurality of battery internal pole pieces, extracting features of an L-th battery pole piece data set to obtain image sharing features, wherein the image sharing features are features which retain multi-scale information of the battery pole piece data, fusing the image sharing features and the N-1-th mask by using the N-1-th segmentation model obtained by completing training of the N-1-th training round in the N-th training round, determining the N-th mask, updating parameters of the N-1-th segmentation model based on a preset loss function to obtain the N-th segmentation model, wherein L, N is a positive integer larger than 1, continuing to execute the N+1 training round based on the image sharing features, the N mask and the N-th segmentation model, and iterating the training round until the absolute value of a difference between global loss of the N-1-th training round and global loss of the N-1-th training round is smaller than a preset global loss and/or the L-th training round preset round is reached to obtain the segmentation model. Through the technical means, in the training process, firstly, a battery pole piece data set acquired in an industrial scene is obtained, and feature extraction is carried out on the L-th batch of battery pole piece data in the battery pole piece data set, so that the image sharing features of multi-scale information of the battery pole piece data are obtained, and therefore, data with different scales and different types are mapped into the same feature space, and the image quality is comprehensively reflected. And then, carrying out multi-round training based on the data of the battery pole pieces of the L th batch, wherein in the N th training round, the N-1 th segmentation model trained by the N-1 th training round is utilized to fuse the image sharing characteristics with the N-1 th mask generated in the last round to generate the N-th mask of the N th training round, and updating the N-1 th segmentation model based on a preset loss function to realize continuous optimization of the model. And finally, repeating the process until the absolute value of the difference value between the global loss of the Nth training round and the global loss of the N-1 th training round is smaller than a preset global loss threshold value and/or the training round reaches a preset training round threshold value, and stopping the process of training based on the L-th battery pole piece data. In this way, for each batch of battery pole piece data, a cycle process of multi-cycle prediction, mask feedback and re-prediction is executed, the mask generated by the previous cycle of training is used as the input characteristic of the next cycle, the mask of the area with complex structure and difficult recognition is gradually approximated to the real mask distribution by the cycle repairing mechanism, the cycle repairing mode has the inhibiting effect on noise and pseudo texture, the monotonous decrease and steady state convergence of mask errors are reduced, the bo