Image segmentation method and related equipment
By embedding self-attention mechanism and multi-layer perceptron in the image segmentation model, the position offset and error prediction problems of image segmentation model in the prior art in the noise and artifact environment are solved, and the accuracy of segmentation results is significantly improved. and robustness.
Patent Information
- Application Number
- CN202411395126.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-14
Smart Images

Figure CN119313903A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and big data technology, and in particular to an image segmentation method and related equipment. Background Art
[0002] With the development of computer technology, artificial intelligence has been widely used in the field of image processing. Among them, image segmentation is a technology that divides the image to be segmented into several different types of image regions according to certain segmentation conditions. The use of machine learning techniques has greatly improved the effect and efficiency of segmentation. UNet is an image segmentation model based on convolutional neural networks. Its main feature is that it adopts a U-shaped structure, which enables the model to have good spatial resolution while having contextual information. UNet can better capture contextual information and more accurately locate information such as details and boundaries of the image; it has better image recognition capabilities. Although the UNet model performs well in the field of image segmentation, it still has some limitations.
[0003] At present, the existing image segmentation models have the problem of position offset in the segmentation results, that is, there is a certain offset between the segmentation results and the actual annotations; in quality inspection business, some images have serious noise such as moiré, which results in many erroneous predictions in the process of segmenting such data. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose an image segmentation method and related equipment to solve the problem that the existing image segmentation model has position offset in the segmentation results. In the quality inspection business, some pictures have serious noise such as moiré, and many erroneous predictions are generated in the process of segmenting such data. Its main purpose is to embed a self-attention mechanism and add a multi-layer perceptron in the image segmentation model. Combining the ideas of the self-attention mechanism and the multi-layer perceptron can make more full use of visual information and global features, improve the generalization performance and robustness of the model, and show better segmentation effects in the case of more noise and artifacts, further alleviating some limitations of the image segmentation model.
[0005] In order to solve the above technical problems, the present application embodiment provides an image segmentation method, which adopts the following technical solution:
[0006] Obtain the image to be segmented;
[0007] Performing segmentation processing on the image to be segmented by using a trained image segmentation model to obtain a plurality of images to be processed;
[0008] Performing feature extraction processing on the image to be processed by using a self-attention mechanism to obtain features of the image to be processed;
[0009] The features of the image to be processed are subjected to feature classification processing by a multi-layer perceptron to determine the segmentation result of the image to be segmented.
[0010] Furthermore, before the image to be segmented is segmented by the trained image segmentation model to obtain a plurality of segmented images to be processed, the method further includes:
[0011] Obtain sample segmentation images, corresponding sample segmentation results, and pre-trained image segmentation models;
[0012] The pre-trained image segmentation model is trained using the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model.
[0013] Furthermore, the pre-trained image segmentation model includes a jump mechanism. After obtaining the pre-trained image segmentation model, the method further includes:
[0014] Adding a self-attention mechanism in the form of residual connections to the skip connection mechanism of the pre-trained image segmentation model; and
[0015] A multi-layer perceptron is added to the jump mechanism of the pre-trained image segmentation model.
[0016] Furthermore, the pre-trained image segmentation model is trained by using the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model, including:
[0017] Inputting the sample segmentation image and the corresponding sample segmentation result into a pre-trained image segmentation model;
[0018] Adjusting the parameters of the pre-trained model according to the corresponding sample segmentation results through the self-attention mechanism;
[0019] The pre-trained image segmentation model after parameter adjustment is trained by the multi-layer perceptron, and after the training is completed, a trained image segmentation model is obtained.
[0020] Furthermore, during the training process of the pre-trained image segmentation model, a loss function is used to constrain the pre-trained image segmentation model. The formula of the loss function is as follows:
[0021] Loss = -[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))]
[0022] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image.
[0023] Furthermore, the self-attention mechanism is used to perform feature extraction processing on the image to be processed to obtain features of the image to be processed, including:
[0024] Performing a first feature extraction process on the image to be processed by using a self-attention mechanism to obtain global features and local features of the image to be processed;
[0025] A second feature extraction process is performed on the global feature and the local feature to obtain image features to be processed.
[0026] Furthermore, the step of performing feature classification processing on the features of the image to be processed by a multi-layer perceptron to determine the segmentation result of the image to be segmented includes:
[0027] Inputting the image features to be processed into the multi-layer perceptron, and performing nonlinear transformation on neurons in the multi-layer perceptron through an activation function;
[0028] The transformed results are classified to obtain a classification processing result of the image to be processed, and the classification processing result of the image to be processed is the segmentation result of the image to be segmented.
[0029] In order to solve the above technical problems, the present application also provides an image segmentation device, which adopts the following technical solution:
[0030] A first acquisition module, used for acquiring an image to be segmented;
[0031] A segmentation processing module, used to perform segmentation processing on the image to be segmented by using a trained image segmentation model to obtain a plurality of images to be processed;
[0032] A feature extraction module is used to perform feature extraction processing on the image to be processed by using a self-attention mechanism to obtain features of the image to be processed;
[0033] The classification processing module is used to perform feature classification processing on the features of the image to be processed through a multi-layer perceptron to determine the segmentation result of the image to be segmented.
[0034] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0035] The computer device includes a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of the image segmentation method described in any one of the embodiments of the present application when executing the computer-readable instructions.
[0036] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0037] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the image segmentation method described in any one of the embodiments of the present invention are implemented.
[0038] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects: obtaining an image to be segmented; performing segmentation processing on the image to be segmented by a trained image segmentation model to obtain multiple images to be processed; performing feature extraction processing on the image to be processed by a self-attention mechanism to obtain features of the image to be processed; performing feature classification processing on the features of the image to be processed by a multi-layer perceptron to determine the segmentation result of the image to be segmented. By combining the ideas of the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized to improve the generalization performance and robustness of the model. In the case of more noise and artifacts, better segmentation effect is also shown, which solves the problem that the existing image segmentation model has position offset in the segmentation result. In quality inspection business, some pictures have severe noise such as moiré, which produces more erroneous predictions in the process of segmenting such data. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0041] Figure 2 is a flow chart of an embodiment of an image segmentation method according to the present application;
[0042] Figure 3 yes Figure 2 A flowchart of a specific implementation method before step S202;
[0043] Figure 4 yes Figure 3 A flowchart of a specific implementation method after step S301;
[0044] Figure 5 yes Figure 3 A flowchart of a specific implementation method of step S302;
[0045] Figure 6 yes Figure 2 A flowchart of a specific implementation method of step S203;
[0046] Figure 7 yes Figure 2 A flowchart of a specific implementation method of step S204;
[0047] Figure 8 is a structural framework diagram of the image segmentation method according to the present application;
[0048] Fig. 9 is a structural schematic diagram of a specific implementation of an image segmentation device 900 according to the present application;
[0049] Fig.10 yes Fig. 9 A structural schematic diagram of another specific implementation of the image segmentation device 900;
[0050] Fig.11 yes Fig.10 A schematic structural diagram of another specific implementation of the image segmentation device 900;
[0051] Fig.12 yes Fig.10 A structural diagram of a specific implementation of the training module 906;
[0052] Fig.13 yes Fig. 9 A structural diagram of a specific implementation of the feature extraction module 903;
[0053] Fig.14 yes Fig. 9 A structural diagram of a specific implementation of the classification processing module 904;
[0054] Fig.15 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0056] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0057] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0058] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0059] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0060] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0061] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0062] It should be noted that the image segmentation method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the image segmentation device is generally arranged in the server / terminal device.
[0063] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0064] Continue to refer Figure 2 , shows a flow chart of an embodiment of an image segmentation method according to the present application. The image segmentation method comprises the following steps:
[0065] Step S201: Obtain an image to be segmented.
[0066] In this embodiment, the electronic device (eg, Figure 1 The server / terminal device shown in the figure can receive the image segmentation request of the terminal device through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0067] The above-mentioned terminal devices may be terminal devices equipped with remote interaction functions such as personal assistants and intelligent customer service.
[0068] The above image segmentation method can be applied to online file image segmentation, online file management and other businesses.
[0069] Specifically, the above electronic device can be used for different industry types such as medical image segmentation, property insurance image segmentation, financial image segmentation, store image segmentation, etc.
[0070] The above-mentioned image to be segmented can be understood as an image that needs to be segmented, and can be a camera image, an album image, etc.
[0071] Step S202: Segment the image to be segmented using the trained image segmentation model to obtain a plurality of images to be processed.
[0072] In this embodiment, after obtaining the image to be segmented, the electronic device may use the trained image segmentation model to perform segmentation processing on the image to be segmented, thereby obtaining a plurality of images to be processed.
[0073] The trained image segmentation model is a tool for image processing. The image segmentation model is a machine learning model used for image processing. The image segmentation model can divide the image into multiple non-intersecting regions based on various features in the image, including grayscale, color, spatial texture, and geometric shape. In the image segmentation process, the features within each region should show consistency or similarity, while there are obvious differences between different regions. The image segmentation model identifies and extracts targets or specific areas in an image by dividing the image into multiple regions.
[0074] The trained image segmentation model is a model obtained by learning training data of sample segmentation images and corresponding sample segmentation results, and is an image segmentation model that can accurately segment new segmented images.
[0075] The above segmentation process can be understood as a process of dividing an image into multiple regions or parts.
[0076] The above-mentioned image to be processed is regarded as an independent image to be processed, which is a scene containing only one region or part, rather than the entire original image. For example, if a group photo containing multiple people is segmented, multiple images to be processed may be obtained, each image containing only one face region. Or, if a photo containing multiple different objects is segmented, multiple images to be processed may be obtained, each image containing only one object region.
[0077] Step S203: Use the self-attention mechanism to perform feature extraction on the image to be processed to obtain features of the image to be processed.
[0078] In this embodiment, the self-attention mechanism is a neural network structure that can capture long-distance dependencies in the input sequence. It generates a weight vector by calculating the relationship between each element in the input sequence and other elements, thereby weighted summarizing the information at different positions. The self-attention mechanism is mainly an attention mechanism that associates different positions of a single sequence to calculate the representation of the same sequence. The self-attention mechanism allows the model to pay attention to each element in the sequence when processing sequence data, making the model more efficient in dealing with long-distance dependency problems.
[0079] It can be the self-attention mechanism of a tool that processes image classification tasks. The self-attention mechanism of a tool that processes image classification tasks has stronger denoising and detail awareness capabilities, which can effectively alleviate the noise and image problems in the model structure.
[0080] The feature extraction process can be understood as a process of converting the image to be processed into a set of representative feature vectors. Feature extraction can help eliminate noise and redundant information, enhance the main features of the image, and improve the accuracy of classification and recognition.
[0081] The above-mentioned image features to be processed are representative feature vectors, which are used to describe the data features of the image to be segmented. The feature vectors of the image features to be processed have lower dimensions and smaller data scale, and can better reflect the main information and essential features of the image.
[0082] Step S204: performing feature classification processing on the features of the image to be processed by a multi-layer perceptron to determine a segmentation result of the image to be segmented.
[0083] In this embodiment, the multi-layer perceptron (MLP) is a neural network composed of multiple neuron layers, including an input layer, a hidden layer, and an output layer. The input layer is responsible for receiving the original data, the hidden layer is used for nonlinear transformation of the data, and the output layer generates the prediction results of the model. The multi-layer perceptron can learn the potential complex patterns of the data through the nonlinear transformation ability of the neural network, thereby improving the accuracy of the prediction.
[0084] The above-mentioned feature classification process can be understood as a process of classifying the image to be processed.
[0085] The segmentation result of the image to be segmented can be understood as the target segmentation result of the image to be segmented. For example, in a medical image, the image to be segmented is an image of internal organs of the human body, and the target segmentation result is the area where internal organs of the human body need to be detected. The target segmentation result is used to detect the position of organs inside the human body, and each organ can be marked as a different area, so as to avoid problems such as misdiagnosis and missed diagnosis.
[0086] In this embodiment, the present application adds a self-attention mechanism, and with the help of the adaptive characteristics of the self-attention mechanism, the weight and importance of the features in the model can be further adjusted, thereby improving the accuracy and robustness of the segmentation results. Compared with the traditional image segmentation model, the self-attention mechanism of the present invention has stronger denoising and detail awareness capabilities, which can effectively alleviate the noise and image problems in the model structure. The present application adds a multi-layer perceptron to enable the model to better learn to model low-level and high-level features, thereby improving the expressiveness and generalization capabilities of the model.
[0087] The present application obtains an image to be segmented; performs segmentation processing on the image to be segmented by a trained image segmentation model to obtain multiple images to be processed; performs feature extraction processing on the image to be processed by a self-attention mechanism to obtain features of the image to be processed; performs feature classification processing on the features of the image to be processed by a multi-layer perceptron to determine the segmentation result of the image to be segmented. By combining the ideas of the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized to improve the generalization performance and robustness of the model. In the case of more noise and artifacts, better segmentation effect is also shown, which solves the problem that the existing image segmentation model has position offset in the segmentation result. In quality inspection business, some pictures have serious noise such as moiré, which produces many erroneous predictions in the process of segmenting such data.
[0088] Continue to refer Figure 3 , shown in Figure 2 The above image segmentation method further includes the following steps:
[0089] Step S301, obtaining a sample segmentation image, a corresponding sample segmentation result, and a pre-trained image segmentation model.
[0090] In this embodiment, the sample segmented image may be a camera image, an album image, or the like.
[0091] The above corresponding sample segmentation results are segmentation results generated by performing image segmentation on the sample segmentation image.
[0092] The above pre-trained image segmentation model is a tool with image processing. The image segmentation model is a machine learning model used for image processing. The image segmentation model can divide the image into multiple non-overlapping regions based on various features in the image, including grayscale, color, spatial texture, and geometric shape.
[0093] Step S302: train the pre-trained image segmentation model using the sample segmentation images and the corresponding sample segmentation results to obtain a trained image segmentation model.
[0094] In this embodiment, after obtaining the sample segmentation image, the corresponding sample segmentation result and the pre-trained image segmentation model, the electronic device can train the pre-trained image segmentation model through the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model.
[0095] The above-mentioned trained image segmentation model is a model obtained by learning the training data of the sample segmentation image and the corresponding sample segmentation results. The image segmentation model can accurately segment the new segmented image, has powerful image analysis and understanding capabilities, and can effectively realize automatic image segmentation.
[0096] The above training can be supervised training, which can be understood as guiding the learning process of the model through labeled training data.
[0097] The present application obtains a sample segmentation image, a corresponding sample segmentation result and a pre-trained image segmentation model, and trains the pre-trained image segmentation model with the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model. The trained image segmentation model can be used to process similar image segmentation tasks with high performance and accuracy.
[0098] Continue to refer Figure 4 , showing that in Figure 3 The above image segmentation method further includes the following steps:
[0099] Step S401: adding a self-attention mechanism in the form of a residual connection to the skip connection mechanism of the pre-trained image segmentation model.
[0100] In this embodiment, the skip connection mechanism can be understood as directly connecting neurons between certain layers, thereby skipping some intermediate calculation processes. The skip connection mechanism helps to alleviate the problem of gradient disappearance or gradient explosion, and improves the stability and efficiency of model training.
[0101] The above residual connection can be understood as directly adding the output of one or more layers to the input of the layer or layers, thereby constructing a "skip connection" structure. This connection method can prevent the model from losing some subtle information when transmitting information, thereby improving the performance of the model.
[0102] The above self-attention mechanism can adaptively learn high-level representations of image features, which helps the pre-trained image segmentation model to model the global context in the image and improve the semantic understanding ability of the model.
[0103] It should be noted that the self-attention mechanism is added in the form of residual connection in the skip connection of the pre-trained image segmentation model, so that the model can better fuse global and local features, obtain more accurate contextual relevance and semantic information in the decoder, and help the pre-trained image segmentation model to better extract high-level semantic information from low-level features, so that the pre-trained image segmentation model has better perception of images of different sizes and shapes. The skip connection mechanism can extract feature images of different levels from the encoder for upsampling and information fusion in the decoder, thereby gradually restoring the original image resolution and improving segmentation accuracy.
[0104] Step S402: adding a multi-layer perceptron to the jump mechanism of the pre-trained image segmentation model.
[0105] In this embodiment, the multi-layer perceptron can learn the underlying complex patterns of the data through the nonlinear transformation capability of the neural network, thereby improving the accuracy of the prediction. Adding a multi-layer perceptron to each layer of the jump mechanism of the pre-trained image segmentation model enables the model to better learn to model low-level and high-level features, thereby improving the model's expressiveness and generalization capabilities.
[0106] Furthermore, in the pre-trained image segmentation model, due to the scale differences and distribution of different modules, some useful high-level features may be lost or severely damaged in the encoder, which will lead to rougher segmentation results. By adding a multi-layer perceptron, the nonlinearity of the model can be increased, the information bottleneck problem can be solved, and the model's ability to extract and integrate features between low-level and high-level features can be improved.
[0107] Furthermore, in the task of medical image segmentation, the data scale is relatively small, and overfitting problems often occur. By adding a multi-layer perceptron, important information can be concentrated and selected, unnecessary noise and information can be suppressed, and the model can be given stronger stability and generalization ability, thereby improving the performance of the model on the test set. By adding a multi-layer perceptron to the encoder of the pre-trained image segmentation model, the representation ability and segmentation accuracy of the model can be improved, and it can better adapt to the diversity and noise interference in the data. Moreover, due to the learnable nature of the multi-layer perceptron, it can be configured according to actual needs to adapt to the characteristics and needs of different tasks. In summary, adding a multi-layer perceptron can alleviate the information loss and overfitting problems in the structure of the pre-trained image segmentation model, improve the expression ability and generalization ability of the model, and further improve the accuracy and robustness of the segmentation results.
[0108] It should be noted that the addition of a multi-layer perceptron enables the model to make fuller use of features of different sizes, thereby performing image segmentation more accurately. Specifically, the multi-layer perceptron can perform multi-layer abstraction and transformation on feature vectors, so that features of different scales can be better integrated together, thereby enhancing the model's perception of multi-scale features.
[0109] The present application adds a self-attention mechanism in the form of residual connection to the skip connection mechanism of the pre-trained image segmentation model, and adds a multi-layer perceptron to the skip connection mechanism of the pre-trained image segmentation model. By combining the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized, thereby improving the generalization performance and robustness of the model.
[0110] Continue to refer Figure 5 , showing that Figure 3 Flow chart of a specific implementation of step S302 in FIG. Step S302 specifically includes the following steps:
[0111] Step S3021: input the sample segmentation image and the corresponding sample segmentation result into the pre-trained image segmentation model.
[0112] In this embodiment, after obtaining the sample segmentation image, the corresponding sample segmentation result and the pre-trained image segmentation model, the electronic device may input the sample segmentation image and the corresponding sample segmentation result into the pre-trained image segmentation model.
[0113] Furthermore, the sample segmentation image and the corresponding sample segmentation result are taken as input and submitted to the pre-trained image segmentation model for training, so as to guide the image segmentation model to perform image segmentation.
[0114] The above pre-trained image segmentation model is a tool with image processing. The image segmentation model is a machine learning model.
[0115] Step S3022: adjust the parameters of the pre-trained model according to the corresponding sample segmentation results through the self-attention mechanism.
[0116] In this embodiment, the self-attention mechanism is mainly an attention mechanism that associates different positions of a single sequence to calculate the representation of the same sequence.
[0117] It should be noted that the parameters of the self-attention mechanism of the pre-trained model are adjusted so as to optimize it according to the given sample segmentation results.
[0118] Step S3023: train the pre-trained image segmentation model after parameter adjustment through a multi-layer perceptron, and after the training is completed, obtain a trained image segmentation model.
[0119] In this embodiment, the multi-layer perceptron (MLP) is a neural network composed of multiple neuron layers, which can learn the potential complex patterns of data through the nonlinear transformation ability of the neural network, thereby improving the accuracy of prediction.
[0120] The present application inputs a sample segmentation image and a corresponding sample segmentation result into a pre-trained image segmentation model, adjusts the parameters of the pre-trained model according to the corresponding sample segmentation result through a self-attention mechanism, and trains the pre-trained image segmentation model after the parameter adjustment through a multi-layer perceptron. After the training is completed, a trained image segmentation model is obtained. By adding a self-attention mechanism and a multi-layer perceptron, visual information and global features can be more fully utilized to improve the generalization performance and robustness of the model.
[0121] Optionally, during the training process of the pre-trained image segmentation model, a loss function is used to constrain the pre-trained image segmentation model. The formula of the loss function is as follows:
[0122] Loss = -[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))]
[0123] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image.
[0124] In this embodiment, the above loss function is used to measure the quantitative index of the difference between the model prediction value and the true value. By optimizing the loss function, the model can be made more accurate and reliable. The above loss function can be a cross entropy loss function, etc. The cross entropy loss function measures the closeness of the model's prediction to the actual answer. If the model's prediction is very accurate, then the loss value is small; if the prediction is far from the answer, the loss value is large. Through continuous learning and adjustment, the goal of the model is to make this loss value smaller and smaller.
[0125] The above sigmoid function is used to map the input x to the interval (0,1), which can make the output smoother and more interpretable.
[0126] This application uses a loss function to constrain the pre-trained image segmentation model during the training process of the pre-trained image segmentation model. The formula of the loss function is as follows:
[0127] Loss = -[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))]
[0128] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image. During the training process, the value of the loss function is minimized, and the model can better fit the data and improve the accuracy of authentication.
[0129] Continue to refer Figure 6 , showing that Figure 2 Flow chart of a specific implementation of step S203 in FIG. Step S203 specifically includes the following steps:
[0130] Step S2031: Perform a first feature extraction process on the image to be processed using a self-attention mechanism to obtain global features and local features of the image to be processed.
[0131] In this embodiment, the self-attention mechanism is mainly an attention mechanism that associates different positions of a single sequence to calculate the representation of the same sequence.
[0132] The first feature extraction process can be understood as a process of extracting features from an input image to be processed using a convolutional layer in a self-attention mechanism. Specifically, the convolutional layer slides on the image to be processed in a sliding window manner and extracts pixel information of a local area, thereby generating global features and local features of the image to be processed.
[0133] The above global features can be understood as the feature vector of the entire image, and the above local features can be understood as the feature vector of each region in the image.
[0134] It should be noted that the self-attention mechanism has strong denoising and detail awareness capabilities, which can effectively alleviate the noise and image problems in the model structure.
[0135] Step S2032: Perform a second feature extraction process on the global features and the local features to obtain features of the image to be processed.
[0136] In this embodiment, the second feature extraction process can be understood as fusion feature processing, and fusion feature processing can be understood as a process of generating a more distinguishing feature vector by integrating global features and local features. The global features and local features can be fused by a feature coupling unit method, or by a parallel structure method. The feature coupling unit method can fuse local feature representations and global feature representations at different resolutions in an interactive manner, which can effectively combine local and global information and improve the performance of the model; the parallel structure adopted by the parallel structure method can retain local features and global representations to the maximum extent.
[0137] The above-mentioned image features to be processed are representative feature vectors, which are used to describe the data features of the image to be segmented. The feature vectors of the image features to be processed have lower dimensions and smaller data scale, and can better reflect the main information and essential features of the image.
[0138] The present application performs a first feature extraction process on the image to be processed by utilizing a self-attention mechanism to obtain global features and local features of the image to be processed, and performs a second feature extraction process on the global features and local features to obtain features of the image to be processed. The use of the self-attention mechanism can help the model better extract high-level semantic information from low-level features, so that the segmentation model has better perception capabilities for images of different sizes and shapes, and can effectively alleviate noise and imaging problems.
[0139] Continue to refer Figure 7 , showing Figure 2 Flow chart of a specific implementation manner of step S204 in FIG. Step S204 specifically includes the following steps:
[0140] Step S2041: input the image features to be processed into a multi-layer perceptron, and perform nonlinear transformation on neurons in the multi-layer perceptron through an activation function.
[0141] In this embodiment, the multi-layer perceptron (MLP) is a neural network composed of multiple neuron layers, which can learn the potential complex patterns of data through the nonlinear transformation ability of the neural network, thereby improving the accuracy of prediction.
[0142] The above activation function can make the neural network fit the data better, thereby improving the performance of the model.
[0143] The above nonlinear transformation can be understood as a process of converting an input signal or data into an output signal or data.
[0144] It should be noted that the activation function can be a ReLU function, a Sigmoid function, etc. The ReLU function enhances the network's expressiveness by introducing nonlinear characteristics while maintaining high computational efficiency; the Sigmoid function maps a real value to the interval (0,1) so that the output can be interpreted as a probability value. The Sigmoid function can map a real number to the interval (0,1). When the input value is relatively large, the function value is close to 1; when the input value is relatively small, the function value is close to 0.
[0145] Step S2042: classify the transformed result to obtain the classification processing result of the image to be processed.
[0146] In this embodiment, the classification processing result of the image to be processed is the segmentation result of the image to be segmented.
[0147] The segmentation result of the image to be segmented can be understood as the target segmentation result of the image to be segmented. For example, in a medical image, the image to be segmented is an image of internal organs of the human body, and the target segmentation result is the area where internal organs of the human body need to be detected. The target segmentation result is used to detect the position of organs inside the human body, and each organ can be marked as a different area, so as to avoid problems such as misdiagnosis and missed diagnosis.
[0148] The present application obtains the classification processing result of the image to be processed by inputting the features of the image to be processed into a multi-layer perceptron, performing nonlinear transformation on the neurons in the multi-layer perceptron through an activation function, and classifying the transformed results. The multi-layer perceptron can enhance the model's perception of multi-scale features, improve the model's expression and generalization capabilities, and thus improve the performance of the model in various image segmentation tasks.
[0149] like Figure 8 As shown, a structural framework diagram of the image segmentation method according to the present application is shown. Specifically, an image to be segmented is obtained, and the image to be segmented is segmented by a trained image segmentation model to obtain multiple images to be processed, and a self-attention mechanism is used to extract features of the image to be processed to obtain features of the image to be processed, and a multi-layer perceptron is used to perform feature classification processing on the features of the image to be processed to determine the segmentation result of the image to be segmented.
[0150] In this embodiment, the trained image segmentation model is a tool for image processing. The trained image segmentation model is a model learned by learning training data of sample segmented images and corresponding sample segmentation results, and is an image segmentation model that can accurately segment new segmented images.
[0151] The above segmentation process can be understood as a process of dividing an image into multiple regions or parts.
[0152] The self-attention mechanism is a neural network structure that can capture long-distance dependencies in the input sequence. It generates a weight vector by calculating the relationship between each element in the input sequence and other elements, thereby weighted summarizing the information at different positions. The self-attention mechanism is mainly an attention mechanism that associates different positions of a single sequence to calculate the representation of the same sequence. The self-attention mechanism allows the model to pay attention to each element in the sequence when processing sequence data, making the model more efficient in dealing with long-distance dependency problems.
[0153] The feature extraction process is a process of converting the image to be processed into a set of representative feature vectors. Feature extraction can help eliminate noise and redundant information, enhance the main features of the image, and improve the accuracy of classification and recognition.
[0154] The above-mentioned image features to be processed are representative feature vectors, which are used to describe the data features of the image to be segmented. The feature vectors of the image features to be processed have lower dimensions and smaller data scale, and can better reflect the main information and essential features of the image.
[0155] The above multi-layer perceptron is a neural network composed of multiple neuron layers, including input layer, hidden layer and output layer. The input layer is responsible for receiving raw data, the hidden layer is used for nonlinear transformation of data, and the output layer generates the prediction results of the model. The multi-layer perceptron can learn the potential complex patterns of data through the nonlinear transformation ability of the neural network, thereby improving the accuracy of the prediction.
[0156] The above-mentioned feature classification process can be understood as a process of classifying the image to be processed.
[0157] The segmentation result of the image to be segmented can be understood as the target segmentation result of the image to be segmented.
[0158] In this embodiment, the present application embeds a self-attention mechanism in the model to improve the performance of the model in terms of image boundaries and details; by adding a multi-layer perceptron (MLP), the model fully fuses features of different sizes together to improve the processing efficiency and generalization performance of the model. Combining the ideas of the self-attention mechanism and the multi-layer perceptron can make more full use of visual information and global features, improve the generalization performance and robustness of the model, and also show better segmentation effects in the case of more noise and artifacts.
[0159] In this embodiment, the non-Company software tools or components that appear in the embodiments of this application are merely examples and do not represent actual use.
[0160] This embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0161] The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning. This application can be applied to the fields of artificial intelligence and big data, thereby promoting the construction of smart cities.
[0162] This application belongs to the field of smart cities, and this solution can promote the construction of smart cities.
[0163] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0164] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0165] Further references Fig. 9 , as a response to the above Figure 2 The present application provides an embodiment of an image segmentation device, and the image segmentation device embodiment is Figure 2 Corresponding to the embodiment of the image segmentation method shown, the image segmentation device can be specifically applied to various electronic devices.
[0166] like Fig. 9 As shown, the image segmentation device 900 described in this embodiment includes: a first acquisition module 901, a segmentation processing module 902, a feature extraction module 903 and a classification processing module 904. Among them:
[0167] A first acquisition module 901 is used to acquire an image to be segmented;
[0168] The segmentation processing module 902 is used to perform segmentation processing on the image to be segmented by using a trained image segmentation model to obtain a plurality of images to be processed;
[0169] The feature extraction module 903 is used to perform feature extraction processing on the image to be processed by using the self-attention mechanism to obtain features of the image to be processed.
[0170] The classification processing module 904 is used to perform feature classification processing on the features of the image to be processed through a multi-layer perceptron to determine the segmentation result of the image to be segmented.
[0171] In this embodiment, an image to be segmented is acquired; the image to be segmented is segmented by a trained image segmentation model to obtain a plurality of images to be processed; a feature extraction process is performed on the image to be processed by a self-attention mechanism to obtain features of the image to be processed; a feature classification process is performed on the features of the image to be processed by a multi-layer perceptron to determine the segmentation result of the image to be segmented. By combining the ideas of the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized to improve the generalization performance and robustness of the model. In the case of more noise and artifacts, better segmentation effect is also shown, which solves the problem that the existing image segmentation model has position offset in the segmentation result. In quality inspection business, some pictures have serious noise such as moiré, which generates many erroneous predictions in the process of segmenting such data.
[0172] See also Fig.10 ,for Fig. 9 The image segmentation device 900 is a schematic structural diagram of another specific implementation manner, wherein the image segmentation device 900 further includes a second acquisition module 905 and a training module 906.
[0173] The second acquisition module 905 is used to acquire the sample segmentation image, the corresponding sample segmentation result and the pre-trained image segmentation model;
[0174] The training module 906 is used to train the pre-trained image segmentation model through the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model.
[0175] In this embodiment, by obtaining a sample segmentation image, a corresponding sample segmentation result and a pre-trained image segmentation model, and training the pre-trained image segmentation model with the sample segmentation image and the corresponding sample segmentation result, a trained image segmentation model is obtained. The trained image segmentation model can be used to process similar image segmentation tasks with high performance and accuracy.
[0176] See also Fig.11 ,for Fig.10 The image segmentation device 900 is a structural diagram of another specific implementation mode, wherein the image segmentation device 900 further includes a first adding module 907 and a second adding module 908.
[0177] A first adding module 907 is used to add a self-attention mechanism in the form of a residual connection in the skip connection mechanism of the pre-trained image segmentation model; and
[0178] The second adding module 908 is used to add a multi-layer perceptron to the jump connection mechanism of the pre-trained image segmentation model.
[0179] In this embodiment, by adding a self-attention mechanism in the form of a residual connection to the skip connection mechanism of the pre-trained image segmentation model, and adding a multi-layer perceptron to the skip connection mechanism of the pre-trained image segmentation model, by combining the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized, thereby improving the generalization performance and robustness of the model.
[0180] See also Fig.12 ,for Fig.10 The structural diagram of a specific implementation of the training module 906 is shown in FIG. 9 , wherein the training module 906 includes an input submodule 9061, a parameter adjustment submodule 9062, and a training submodule 9063.
[0181] An input submodule 9061 is used to input the sample segmentation image and the corresponding sample segmentation result into a pre-trained image segmentation model;
[0182] A parameter adjustment submodule 9062 is used to adjust the parameters of the pre-trained model according to the corresponding sample segmentation result through the self-attention mechanism;
[0183] The training submodule 9063 is used to train the pre-trained image segmentation model after the parameter adjustment through the multi-layer perceptron. After the training is completed, a trained image segmentation model is obtained.
[0184] In this embodiment, the sample segmentation image and the corresponding sample segmentation results are input into the pre-trained image segmentation model, the parameters of the pre-trained model are adjusted according to the corresponding sample segmentation results through the self-attention mechanism, and the pre-trained image segmentation model after the parameter adjustment is trained through a multi-layer perceptron. After the training is completed, a trained image segmentation model is obtained. By adding the self-attention mechanism and the multi-layer perceptron, visual information and global features can be more fully utilized to improve the generalization performance and robustness of the model.
[0185] Optionally, during the training process of the pre-trained image segmentation model, a loss function is used to constrain the pre-trained image segmentation model. The formula of the loss function is as follows:
[0186] Loss = -[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))]
[0187] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image.
[0188] In this embodiment, the pre-trained image segmentation model is constrained by using a loss function during the training process of the pre-trained image segmentation model. The formula of the loss function is as follows:
[0189] Loss = -[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))]
[0190] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image. During the training process, the value of the loss function is minimized, and the model can better fit the data and improve the accuracy of authentication.
[0191] See also Fig.13 ,for Fig. 9 The structural diagram of a specific implementation of the feature extraction module 903 in FIG. 9 , the feature extraction module 903 includes a first feature extraction submodule 9031 and a second feature extraction submodule 9032. Wherein:
[0192] A first feature extraction submodule 9031 is used to perform a first feature extraction process on the image to be processed by using a self-attention mechanism to obtain global features and local features of the image to be processed;
[0193] The second feature extraction submodule 9032 is used to perform second feature extraction processing on the global features and the local features to obtain image features to be processed.
[0194] In this embodiment, the self-attention mechanism is used to perform a first feature extraction process on the image to be processed to obtain global features and local features of the image to be processed, and a second feature extraction process is performed on the global features and local features to obtain features of the image to be processed. The self-attention mechanism can help the model better extract high-level semantic information from low-level features, so that the segmentation model has better perception capabilities for images of different sizes and shapes, and can effectively alleviate noise and imaging problems.
[0195] See also Fig.14 ,for Fig. 9 The structural diagram of a specific implementation of the classification processing module 904 is shown in FIG. 9 , wherein the classification processing module 904 includes a nonlinear transformation submodule 9041 and a determination submodule 9042.
[0196] A nonlinear transformation submodule 9041 is used to input the image features to be processed into the multi-layer perceptron, and perform nonlinear transformation on neurons in the multi-layer perceptron through an activation function;
[0197] The determination submodule 9042 is used to classify the transformed result to obtain the classification processing result of the image to be processed, and the classification processing result of the image to be processed is the segmentation result of the image to be segmented.
[0198] In this embodiment, by inputting the features of the image to be processed into a multilayer perceptron, performing nonlinear transformation on the neurons in the multilayer perceptron through an activation function, and classifying the transformed results, the classification processing results of the image to be processed are obtained. The multilayer perceptron can enhance the model's perception of multi-scale features, improve the model's expression and generalization capabilities, and thus improve the performance of the model in various image segmentation tasks.
[0199] To solve the above technical problems, the present application also provides a computer device. Fig.15 , Fig.15 This is a basic structural block diagram of the computer device in this embodiment.
[0200] The computer device 15 includes a memory 151, a processor 152, and a network interface 153 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 15 with components 151-153, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0201] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0202] The memory 151 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc.
[0203] In some embodiments, the memory 151 may be an internal storage unit of the computer device 15, such as a hard disk or memory of the computer device 15. In other embodiments, the memory 151 may also be an external storage device of the computer device 15, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 15. Of course, the memory 151 may also include both the internal storage unit of the computer device 15 and its external storage device. In this embodiment, the memory 151 is generally used to store the operating system and various application software installed on the computer device 15, such as computer-readable instructions of the image segmentation method, etc. In addition, the memory 151 may also be used to temporarily store various types of data that have been output or are to be output. The processor 152 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 152 is generally used to control the overall operation of the computer device 15. In this embodiment, the processor 152 is used to execute computer-readable instructions or process data stored in the memory 151, such as computer-readable instructions for executing the image segmentation method.
[0204] The network interface 153 may include a wireless network interface or a wired network interface. The network interface 153 is generally used to establish a communication connection between the computer device 15 and other electronic devices.
[0205] In this embodiment, the impact data of the system in the knowledge base can be used to generate image segmentation affected by the target system to be tested for the user, so that the user can intuitively obtain the impact range of the target system to be tested. According to the impact range of the target system to be tested, the impact of the change can be evaluated more accurately and quickly, irrelevant interference points can be eliminated, and regression use cases can be streamlined to avoid omissions of impact points in the early stage of the evaluation, resulting in the subsequent development of various systems. When they are jointly debugged, it is found that some associations have not been processed. In the mildest case, it will take up development time to supplement the logic. In the most serious case, the solution design may need to be overturned and redone, thereby improving the efficiency of project development.
[0206] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the image segmentation method as described above.
[0207] In this embodiment, the impact data of the system in the knowledge base can be used to generate image segmentation affected by the target system to be tested for the user, so that the user can intuitively obtain the impact range of the target system to be tested. According to the impact range of the target system to be tested, the impact of the change can be evaluated more accurately and quickly, irrelevant interference points can be eliminated, and regression use cases can be streamlined to avoid omissions of impact points in the early stage of the evaluation, resulting in the subsequent development of various systems. When they are jointly debugged, it is found that some associations have not been processed. In the mildest case, it will take up development time to supplement the logic. In the most serious case, the solution design may need to be overturned and redone, thereby improving the efficiency of project development.
[0208] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0209] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. An image segmentation method, characterized in that: The steps include: Obtain the image to be segmented; Performing segmentation processing on the image to be segmented by using a trained image segmentation model to obtain a plurality of images to be processed; Performing feature extraction processing on the image to be processed by using a self-attention mechanism to obtain features of the image to be processed; The features of the image to be processed are subjected to feature classification processing by a multi-layer perceptron to determine the segmentation result of the image to be segmented.
2. The image segmentation method according to claim 1, characterized in that: Before the image to be segmented is segmented by the trained image segmentation model to obtain a plurality of segmented images to be processed, the method further includes: Obtain sample segmentation images, corresponding sample segmentation results, and pre-trained image segmentation models; The pre-trained image segmentation model is trained using the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model.
3. The image segmentation method according to claim 2, characterized in that: The pre-trained image segmentation model includes a jump mechanism. After obtaining the pre-trained image segmentation model, the method further includes: Adding a self-attention mechanism in the form of residual connections to the skip connection mechanism of the pre-trained image segmentation model; and A multi-layer perceptron is added to the jump mechanism of the pre-trained image segmentation model.
4. The image segmentation method according to claim 3, characterized in that: The pre-trained image segmentation model is trained by using the sample segmentation image and the corresponding sample segmentation result to obtain a trained image segmentation model, including: Inputting the sample segmentation image and the corresponding sample segmentation result into a pre-trained image segmentation model; Adjusting the parameters of the pre-trained model according to the corresponding sample segmentation results through the self-attention mechanism; The pre-trained image segmentation model after parameter adjustment is trained by the multi-layer perceptron, and after the training is completed, a trained image segmentation model is obtained.
5. The image segmentation method according to claim 4, characterized in that: During the training process of the pre-trained image segmentation model, a loss function is used to constrain the pre-trained image segmentation model. The formula of the loss function is as follows: Loss=-[ylog(σ(x n ))+(1-y n )log(1-σ(x n ))] Among them, y is the true value of the image, σ(x n ) is the sigmoid function, which maps x to the (0,1) interval: y n is the predicted value of the image.
6. The image segmentation method according to claim 1, characterized in that: The self-attention mechanism is used to perform feature extraction processing on the image to be processed to obtain features of the image to be processed, including: Performing a first feature extraction process on the image to be processed by using a self-attention mechanism to obtain global features and local features of the image to be processed; A second feature extraction process is performed on the global feature and the local feature to obtain image features to be processed.
7. The image segmentation method according to claim 1, characterized in that: The step of performing feature classification processing on the features of the image to be processed by a multi-layer perceptron to determine the segmentation result of the image to be segmented includes: Inputting the image features to be processed into the multi-layer perceptron, and performing nonlinear transformation on neurons in the multi-layer perceptron through an activation function; The transformed results are classified to obtain a classification processing result of the image to be processed, and the classification processing result of the image to be processed is the segmentation result of the image to be segmented.
8. An image segmentation device, characterized in that: include: A first acquisition module, used for acquiring an image to be segmented; A segmentation processing module, used to perform segmentation processing on the image to be segmented by using a trained image segmentation model to obtain a plurality of images to be processed; A feature extraction module is used to perform feature extraction processing on the image to be processed by using a self-attention mechanism to obtain features of the image to be processed; The classification processing module is used to perform feature classification processing on the features of the image to be processed through a multi-layer perceptron to determine the segmentation result of the image to be segmented.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the image segmentation method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the image segmentation method according to any one of claims 1 to 7 are implemented.