A method for dividing mulberry silkworms
By introducing deep residual jump connection and KAN module into the U-Net architecture, combined with the inverted convolutional attention module, the problem of insufficient fusion of low-level and high-level features in mulberry segmentation is solved, and segmentation accuracy and model stability are improved.
Patent Information
- Application Number
- CN202510085952.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-01-20
AI Technical Summary
The existing U-Net architecture cannot effectively promote the fusion between low-level and high-level features in mulberry segmentation, resulting in reduced segmentation accuracy.
The depth residual jump connection module is used to replace the skip connection of U-Net, combining the depth separation convolution layer and KAN module, enhance feature fusion and gradient support, and extract multi-scale features through the inverted convolution attention module.
It improves the accuracy of mulberry silkworm segmentation and the stability of the model, enhances the ability to identify mulberry silkworm location and morphological characteristics, and reduces the risk of parameter quantity and gradient disappearance.
Smart Images

Figure CN120014268B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mulberry silkworm breeding, and specifically, to a method for segmenting mulberry silkworms. Background Art
[0002] U-Net is an architecture based on convolutional neural network (CNN) for biomedical image segmentation tasks. The design of U-Net is inspired by the classic fully convolutional network (FCN). By introducing skip connections and a symmetric encoder-decoder structure, it can significantly improve the performance of the model on small-sample data sets. Currently, U-Net has become one of the preferred methods for image segmentation in many computer vision tasks.
[0003] In the field of mulberry silkworm breeding, the premise of realizing intelligence lies in the precise positioning and recognition technology of mulberry silkworms. Based on the precise positioning and recognition of mulberry silkworms, information such as the position and morphology of mulberry silkworms can be obtained, and then the growth status of mulberry silkworms can be better monitored. Therefore, in-depth research on the mulberry silkworm positioning and recognition technology is of great significance for promoting the intelligent process of mulberry silkworm breeding. Currently, U-Net is usually used to segment mulberry silkworms to obtain relevant information. Although the skip connections in it can effectively fuse features, its simple feature splicing method cannot effectively promote the fusion between low-level features and high-level features, thus reducing the performance of the model and affecting the accuracy of mulberry silkworm segmentation. Summary of the Invention
[0004] In order to solve the problem that the skip connections of the existing U-Net architecture cannot effectively promote the fusion between low-level features and high-level features, thus reducing the performance of the mulberry silkworm segmentation model and the accuracy of mulberry silkworm segmentation, the present invention provides a method for segmenting mulberry silkworms, and the method includes:
[0005] Obtain an original mulberry silkworm image, obtain a training set based on the original mulberry silkworm image, and obtain a mulberry silkworm segmentation model based on the training set. The mulberry silkworm segmentation model includes an encoder, a deep residual skip connection module, and a decoder, and the deep residual skip connection module is connected to both the encoder and the decoder;
[0006] Segment the image to be segmented based on the mulberry silkworm segmentation model to obtain a segmentation result. The way to obtain the segmentation result is: the encoder downsamples the image to be segmented to obtain a first feature map, the decoder upsamples the first feature map to obtain a second feature map, the deep residual skip connection module fuses the first feature map and the second feature map to obtain an output map, and the segmentation result is obtained based on the output map;
[0007] The deep residual skip connection module includes a depthwise separable convolutional layer, a first normalization layer, a pointwise convolutional layer, and a second normalization layer. Both the first normalization layer and the second normalization layer include a first activation function. The depthwise separable convolutional layer is used to extract the features of the first feature map. Both the first normalization layer and the second normalization layer are used to normalize the input data. The pointwise convolutional layer is used to change the number of channels. The first activation function is used to process non-linear information.
[0008] MultiResUNet is a deep learning-based medical image segmentation method, mainly using the Python programming language, with TensorFlow as the backend framework and implemented through Keras. This segmentation method aims to improve the traditional U-Net architecture to address the segmentation requirements of multi-modal biomedical images that the traditional U-Net architecture cannot meet.
[0009] In the present invention, the skip connection of the U-Net architecture is changed to a deep residual skip connection. Compared with the simple feature addition method, the depthwise separable convolutional layer can extract the information of the shallower layers in the decoder, such as the position information of the silkworm. The deep residual skip connection processes the low-level features, aligns them with the high-level features, and directly participates in the reconstruction process of the high-level features, promoting the interaction between the position features and semantic features of the silkworm in the image, effectively promoting and strengthening the fusion between local features and global features, as well as between low-level features and high-level features, enhancing the network's ability to locate the silkworm and recognize its morphological features, improving the performance of the model, increasing the accuracy of silkworm segmentation, and at the same time reducing the number of parameters. In addition, the deep residual skip connection provides additional gradient support during the model training process, reducing the risk of gradient vanishing or exploding and improving the stability of the model.
[0010] The deep residual skip connection of the present invention is improved from the skip connection in MultiResUNet. By constructing a direct path in the network architecture and replacing the 1×1 convolution in MultiResUNet with an identity mapping, it realizes the direct association between the output of the encoder layer and the corresponding layer in the decoder while reducing the number of parameters, bypassing some intermediate layers, and promoting the effective fusion of the silkworm semantic information extracted in the encoder and the shallower information (silkworm position information) in the decoder. This fusion strategy not only enriches the feature representation but also enhances the model's ability to capture local details and global context information. Through the deep residual skip connection, the silkworm position information directly participates in the reconstruction process of the high-level features, effectively reducing the loss of information transmission in the deep network and also facilitating the backpropagation of gradients, thereby improving the training efficiency and stability of the model. This direct information flow optimizes the feature transmission path, enabling the model to more effectively and fully utilize the information in the input data.
[0011] Furthermore, the mulberry silkworm segmentation model further includes a KAN module. The KAN module integrates and transforms the first feature map to obtain a third feature map, and the decoder upsamples the third feature map to obtain the second feature map;
[0012] The KAN module includes several KAN Layer layers. Adjacent KAN Layer layers are connected by a second activation function. Each KAN layer includes several KAN Linear layers; the KAN Layer layer is used to transform the dimension of the input data, the second activation function is used to reduce the number of parameters, and the KAN Linear layer is used to integrate and transform features of different levels.
[0013] The KAN module places a learnable activation function on the edge (weight) instead of using a fixed activation function on the node (neuron). Therefore, introducing the KAN module can reduce redundant connections in the model, enabling the model to better resist small changes in the input data, improving its robustness in the face of noisy or incomplete data, enhancing the stability of the mulberry silkworm segmentation model, and further enhancing the model's ability to locate mulberry silkworms and identify morphological features.
[0014] Furthermore, the KAN module is located at the bottleneck layer of the path from the encoder to the decoder. Integrating the extracted features between the encoder and the decoder enhances the model's ability to capture complex data structures, thereby enhancing the representational ability of the features extracted by the encoder.
[0015] Furthermore, both the encoder and the decoder include several inverted convolutional attention modules of different levels. The inverted convolutional attention module of the encoder extracts first features of different scales of the image to be segmented to obtain the first feature map, and the inverted convolutional attention module of the encoder increases the spatial resolution of the third feature map based on the first feature to obtain the second feature map;
[0016] The inverted convolutional attention module includes a depthwise separable convolutional layer, a channel attention layer, a spatial attention layer, and an inverted block; the depthwise separable convolutional layer is used to extract features, the channel attention layer is used to identify key features, the spatial attention layer is used to identify key regions, and the inverted block is used to enhance features.
[0017] In order to improve the representation ability of the features extracted by the model and extract richer mulberry silkworm morphological information during the encoding stage, and to address the similarity problem between the morphological contour of the mulberry silkworm and the vein texture of the mulberry leaf, the present invention uses multiple consecutive levels to form the encoder part, and each level is equipped with an inverted convolutional attention module. This modular design allows the model to capture features at different scales at different levels, obtain richer underlying information, achieve precise extraction of the morphological features and position information of the mulberry silkworm in a complex mulberry leaf environment, more precisely distinguish the morphological contour of the mulberry silkworm from the vein texture of the mulberry leaf, improve the representation ability of the features extracted by the model, and thus provide rich information for the subsequent decoding process. The decoder part contains the same levels as the encoder, echoing the hierarchical structure of the encoder to ensure the gradual and fine reconstruction of the feature information.
[0018] The depthwise separable convolutional layer is used to extract the morphological information and position information of the mulberry silkworm in the mulberry silkworm image, while reducing the number of model parameters and the computational amount; the spatial attention layer focuses on identifying the information-rich positions in the features, that is, determining the specific area of the mulberry silkworm on the feature map and enhancing the features in these areas; the channel attention layer focuses on screening out the key elements in the features, that is, identifying the features that need to be concerned or highlighted; the inverted block first extracts local features through depthwise separable convolution, then integrates the features of each channel through pointwise convolution, further enhances the features through normalization and activation functions, and finally adjusts the number of channels back to the same as the input channels through pointwise convolution for further enhancement and refinement of the features.
[0019] Further, the spatial attention layer includes a max pooling layer, an average pooling layer, a first convolutional layer, and a third activation function, and the first convolutional layer is connected to the max pooling layer, the average pooling layer, and the third activation function; the max pooling layer is used to perform max pooling on the feature map, the average pooling layer is used to perform average pooling on the feature map, the first convolutional layer is used to extract features, and the third activation function is used to enhance the features.
[0020] Further, the channel attention layer includes an adaptive max pooling layer, an adaptive average pooling layer, a first module, a second module, and the third activation function, the first module is connected to the adaptive max pooling layer and the third activation function, and the second module is connected to the adaptive average pooling layer and the third activation function;
[0021] Both the first module and the second module include a first pointwise convolutional layer, a fourth activation function layer, and a second pointwise convolutional layer, and the fourth activation function is connected to the first pointwise convolutional layer and the second pointwise convolutional layer;
[0022] The adaptive max pooling layer is used to perform max pooling on the feature map, the adaptive average pooling layer performs average pooling on the feature map, the first point convolution layer is used to extract features, the third activation function and the fourth activation function layer are both used to enhance features, and the second point convolution layer is used to integrate features.
[0023] Further, according to the execution order of the inverted block, the inverted block sequentially includes the depthwise separable convolution layer, the layer normalization layer, the third point convolution layer, the fifth activation function, and the fourth point convolution layer;
[0024] The depthwise separable convolution layer is used to extract local features, the layer normalization layer is used to enhance features, the third point convolution layer is used to integrate features, the fifth activation function is used to enhance features, and the fourth point convolution layer is used to enhance features.
[0025] Further, the inverted convolutional attention modules at the same levels of the encoder and the decoder correspond one by one, and the depth residual skip connection module is provided between the inverted convolutional attention modules at the same levels of the encoder and the decoder.
[0026] Further, the KAN module is located at the first position, and the obtaining method of the first position is: obtaining the inverted convolutional attention module at the last level of the encoder to obtain the third module, obtaining the inverted convolutional attention module at the last level of the decoder to obtain the fourth module, and obtaining the bottleneck layer of the path from the third module to the fourth module to obtain the first position.
[0027] Further, the specific steps for obtaining the training set based on the original silkworm image include: enhancing the original silkworm image to obtain the training set.
[0028] In order to improve the generalization ability and adaptability of the model, the present invention implements a data augmentation strategy to enrich the data set and improve its diversity. These augmentation means not only increase the number of samples during model training, but also simulate various situations that may occur in the actual breeding environment, so that the model can better handle different image changes. Through the enhancement technology, this data set can effectively simulate the diversity of silkworms in the natural environment and provide more comprehensive learning materials for the model.
[0029] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:
[0030] 1. The skip connections in the U-Net architecture are replaced with deep residual skip connections. Compared to simple feature addition methods, the depthwise separable convolutional layers can extract information from shallower layers in the decoder. Deep residual skip connections process low-level features, aligning them with high-level features and directly participating in the reconstruction of high-level features. This promotes the interaction between the positional and semantic features of silkworms in the image, effectively promoting and strengthening the fusion of local and global features, as well as low-level and high-level features. This enhances the network's ability to locate silkworms and recognize their morphological features, improving model performance and increasing silkworm segmentation accuracy while reducing the number of parameters. Furthermore, deep residual skip connections provide additional gradient support during model training, reducing the risk of vanishing or exploding gradients and improving model stability.
[0031] 2. The introduction of the KAN module can reduce redundant connections in the model, enabling the model to better resist small changes in the input data, improve its robustness in the face of noisy or incomplete data, enhance the stability of the silkworm segmentation model, and further enhance the model's ability to locate silkworms and recognize their morphological characteristics.
[0032] 3. The KAN module is located at the bottleneck layer of the encoder-decoder path. It integrates the extracted features between the encoder and decoder, enhancing the model's ability to capture complex data structures and further enhancing the representation capabilities of the features extracted by the encoder.
[0033] 4. The encoder is constructed using multiple consecutive layers, each equipped with an inverted convolutional attention module. This modular design allows the model to capture features of different scales at different levels, obtaining richer underlying information. This allows for accurate extraction of silkworm morphological features and positional information in a complex mulberry leaf environment, more accurately distinguishing between the silkworm's morphological outline and the mulberry leaf's vein texture, and improving the model's ability to represent extracted features, thereby providing rich information for the subsequent decoding process. The decoder contains the same layers as the encoder, mirroring the encoder's hierarchical structure, ensuring detailed layer-by-layer reconstruction of feature information. This allows for the extraction of richer silkworm morphological information during the encoding phase, as well as resolving the similarity between the silkworm's morphological outline and the mulberry leaf's vein texture. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of the present invention, and do not constitute a limitation of the embodiments of the present invention;
[0035] Figure 1It is a schematic structural diagram of the mulberry silkworm segmentation model in the present invention; among them, C1, C2, C3, and C4 all represent the number of channels, H1 and W1 respectively represent the height and width, A, B, and C represent the inverted convolutional attention modules of three levels of the encoder, A1, B1, and C1 represent the inverted convolutional attention modules of three levels of the decoder, A corresponds to A1, B corresponds to B1, and C corresponds to C1;
[0036] Figure 2 It is a schematic structural diagram of the inverted convolutional attention module in the present invention; among them, C represents the number of channels, and p represents the padding size;
[0037] Figure 3 It is a schematic structural diagram of the deep residual skip connection module in the present invention;
[0038] Figure 4 It is a schematic principle diagram of the KAN module in the present invention, where X represents the input feature and KAN(X) represents the output feature. Detailed implementation manners
[0039] In order to be able to more clearly understand the above-mentioned objects, features, and advantages of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners. It should be noted that, without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
[0040] In the following description, many specific details are set forth in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described within the scope here. Therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.
[0041] Embodiment 1
[0042] Reference Figure 1 and Figure 3 , this embodiment provides a mulberry silkworm segmentation method, and the method includes:
[0043] Obtain the original silkworm image, obtain a training set based on the original silkworm image, obtain a silkworm segmentation model based on the training set. The specific steps for obtaining the training set based on the original silkworm image include: enhancing the original silkworm image to obtain the training set. In this embodiment, the original silkworm image can be obtained by a camera. The selected camera can be a Hikvision industrial camera, model MV-CU060-10UC, equipped with a 6mm short-focus lens. The camera is vertically downward and aligned with the silkworm, and the distance is set to 25 cm. The resolution of the collected image is 3072×2048. After cropping, the image size is adjusted to 1280×72,0 to ensure that the details of the silkworm are clearly visible. During the image acquisition process, stable lighting conditions are used to reduce environmental interference. The image is taken between 10:00 and 11:00 in the morning and saved in JPG file format. The enhancement means include color jitter, random rotation, random flipping, and random cropping, etc. Random rotation and flipping can change the spatial layout of the image, enabling the model to learn to recognize silkworms in different directions; while cropping can simulate different windows and distances, enhancing the model's recognition ability for different parts of the silkworm.
[0044] In this embodiment, the silkworm segmentation model can be the CanSeg model. This model follows the encoder-decoder architecture widely adopted in the field of deep learning. Through a hierarchical feature extraction and reconstruction process, it can achieve an in-depth understanding and accurate restoration of the input data. Compared with other comparison models, the CanSeg model has a lower number of model parameters and computational complexity, and is more suitable for deployment and operation in environments with limited computing resources and model size.
[0045] The silkworm segmentation model includes an encoder, a depth residual skip connection module, and a decoder. The depth residual skip connection module is connected to both the encoder and the decoder;
[0046] Segment the image to be segmented based on the silkworm segmentation model to obtain a segmentation result;
[0047] The way to obtain the segmentation result is:
[0048] The encoder downsamples the image to be segmented to obtain a first feature map. The decoder upsamples the first feature map to obtain a second feature map. The depth residual skip connection module fuses the first feature map and the second feature map to obtain an output map, and the segmentation result is obtained based on the output map;
[0049] The depth residual skip connection module includes a depthwise separable convolutional layer, a first normalization layer, a point convolutional layer, and a second normalization layer. Both the first normalization layer and the second normalization layer include a first activation function;
[0050] The depthwise separable convolution layer is used to extract the features of the first feature map. The first normalization layer and the second normalization layer are both used to normalize the input data. The point convolution layer is used to change the number of channels. The first activation function is used to process non-linear information.
[0051] The CanSeg model is an improved Chan-Vese model (C-V model), mainly used to solve the Mura defect segmentation problem of liquid crystal displays.
[0052] The Depthwise Residual Skip Connections Module is commonly used in image recognition and processing tasks in deep learning. This module combines the concepts of depthwise convolution and residual learning.
[0053] Batch Normalization (BN for short) is a commonly used technique in deep learning, used to improve the training speed and stability of neural networks. It normalizes the input of each layer, making the distribution of the input data more stable, thereby accelerating the training process and reducing the risk of overfitting.
[0054] Leaky ReLu (Leaky Rectified Linear Unit) is a commonly used activation function, mainly used to solve the non-linear problems in neural networks, especially in deep learning. It is a variant of the ReLU (Rectified Linear Unit) function, which improves the performance of ReLU in the negative value interval to solve some shortcomings of the ReLU function.
[0055] Each inverted convolutional attention module of the encoder performs max pooling and average pooling on the image to be segmented, obtains the channel maximum value and the channel average value, adds the channel maximum value and the channel average value and then performs convolution to obtain the first data, and multiplies the first data after inputting it into the third activation function to obtain the second data;
[0056] Pointwise Convolution refers to a special convolution with a convolution kernel size of 1x1. Pointwise Convolution reduces or increases the dimension of the input features by controlling the number of convolution kernels. Specifically, it uses a 1×1 convolution kernel to traverse all channels of the input, and the number of output channels depends on the number of convolution kernels, thus changing the number of channels. By designing the pointwise convolution module, the amount of convolution calculation can be optimized, and the computational efficiency of the model can be improved. The pointwise convolution layer can extract the features of an image. Since its convolution kernel has only one pixel, it can capture more subtle features, improving the accuracy and efficiency of the model. Pointwise Convolution can also be used for information compensation after depth convolution to ensure that the effect of the network is maintained as much as possible while reducing the number of parameters.
[0057] As part of the depthwise separable convolution, the depthwise separable convolution consists of depthwise convolution (Depthwise Conv) and pointwise convolution (Pointwise Conv). After depthwise convolution, pointwise convolution is used to change the number of channels and further process the feature map.
[0058] Embodiment 2
[0059] Reference Figure 1 , based on Embodiment 1, in this embodiment, the mulberry silkworm segmentation model further includes a KAN module. The KAN module integrates and transforms the first feature map to obtain a third feature map, and the decoder upsamples the third feature map to obtain the second feature map;
[0060] The KAN module includes several KAN Layer layers, and adjacent KAN Layer layers are connected by a second activation function. Each KAN layer includes several KAN Linear layers;
[0061] The KAN Layer layer is used to transform the dimension of the input data, the second activation function is used to reduce the number of parameters, and the KAN Linear layer is used to integrate and transform features at different levels.
[0062] Among them, the KAN module is located at the bottleneck layer of the path from the encoder to the decoder.
[0063] KAN (Kolmogorov - Arnold Networks) is a new type of neural network architecture, a feature integration technology based on the Kolmogorov - Arnold representation theorem, which provides a network design different from traditional multi - layer perceptrons (MLP). The core idea of KAN is to use learnable activation functions at the edges of the network instead of fixed activation functions at nodes as in MLP. Specifically, each weight parameter in KAN is parameterized as a univariate function of a spline, which may make KAN superior to MLP in terms of accuracy and interpretability. The Kolmogorov - Arnold representation theorem states that any multivariate continuous function can be represented as a two - layer nested superposition of univariate continuous functions, which shows significant advantages in capturing complex data structures.
[0064] The shape of the KAN module can be represented in the form of an integer array, such as [n0, n1, n2, …, n l , where n l is the number of nodes in the l - th layer of the feature map. The M - layer KAN module can be described as a nesting of multiple KAN Layers:
[0065]
[0066] where, Φ l represents the l - th layer of the KAN module, l ∈ {1, 2, …, M}, M represents the number of layers of the KAN module, X represents the input feature, and KAN(X) represents the output feature, represents multiplication;
[0067] A KAN Layer is a one - dimensional function matrix with n - dimensional input and m - dimensional output:
[0068]
[0069] where, Φ represents the one - dimensional function matrix, represents the node at the i - th row and j - th column in the one - dimensional function matrix. Both i and j represent integers greater than or equal to 1, and both n and m represent dimensions;
[0070] where, the one - dimensional function matrix has multiple trainable activation functions. The activation function connecting (l, i) and (l + 1, i) can be expressed as:
[0071]
[0072] where, represents the activation function, L represents the number of layers of the KAN module, (l, i) represents the i - th neuron in the l - th layer, i represents that the l - th layer has n l neurons, and j represents that the (l + 1) - th layer has n l+1There are n neurons between layer l and layer l+1. l n l+1 activation functions, n l Indicates the number of nodes in the lth layer, n l+1 Indicates the number of nodes in the l+1th layer.
[0073] Therefore, the calculation results of the KAN module from layer k to layer k+1 can be expressed in the matrix:
[0074]
[0075] Among them, X k represents the calculation result of the kth layer of the KAN module, X k+1 represents the calculation result of the k+1th layer of the KAN module, represents the activation function, n k+1 Indicates that there are n k+1 neurons, n k Indicates that there are n k neurons, and k represents the kth layer of the KAN module.
[0076] Therefore, the output of the KAN module can be expressed as:
[0077] X out =LN(X in +DwConv(KAN(X in )));
[0078] Among them, X in ∈R C×H×W represents the input feature map, X out ∈R C×H×W Represents the output feature map, LN() represents the layer normalization operation, DwConv() represents the depth-wise separable convolution operation, and KAN() represents the KAN module.
[0079] The KAN Linear layer is a special type of linear layer that combines certain properties of Kolmogorov-Arnold Networks (KANs), such as nonlinear processing and complex function approximation, while retaining the simplicity of linear transformations. Through its unique mechanism, the KAN Linear layer may better integrate and transform features from different layers, helping the model make a more precise trade-off between global and local information.
[0080] The bottleneck layer is located between the encoder and the decoder. It is a hidden layer in the encoder. Its dimension is lower than that of the input data and can be regarded as a compressed representation of the input data. Its main function is to compress the input data into a compact representation, which usually has a lower dimension. In this way, the bottleneck layer can effectively reduce the dimension of the data, thereby reducing the complexity and computational requirements of the data.
[0081] Embodiment III
[0082] Reference Figure 1 and Figure 2 Based on the above embodiments, in this embodiment, both the encoder and the decoder include a number of inverted convolution attention modules (Inverted Convolution Attention Module, ICAM) at different levels. The inverted convolution attention module of the encoder extracts first features of different scales of the image to be segmented to obtain the first feature map. The inverted convolution attention module of the encoder, based on the first feature, increases the spatial resolution of the third feature map to obtain the second feature map. In this embodiment, both the encoder and the decoder may include 3 inverted convolution attention modules at different levels, aiming to reduce the complexity and computational requirements of the model.
[0083] The inverted convolution attention module includes the depthwise separable convolution layer, the channel attention layer, the spatial attention layer, and the inverted block, as shown in (a) of Figure 2 ;
[0084] The depthwise separable convolution layer is used to extract features, the channel attention layer is used to identify key features, the spatial attention layer is used to identify key regions, and the inverted block is used to enhance features.
[0085] In this embodiment, depthwise separable convolution layers at different levels process low-level features through different numbers of residual blocks to align them with high-level features and participate in the reconstruction process of high-level features.
[0086] Among them, the channel attention layer includes an adaptive max pooling layer, an adaptive average pooling layer, a first module, a second module, and a third activation function. The first module is connected to both the adaptive max pooling layer and the third activation function. The second module is connected to both the adaptive average pooling layer and the third activation function, as shown in (b) of Figure 2 ;
[0087] Both the first module and the second module include a first point convolution layer, a fourth activation function layer, and a second point convolution layer. The fourth activation function is connected to both the first point convolution layer and the second point convolution layer;
[0088] The adaptive max pooling layer is used to perform max pooling on the feature map, the adaptive average pooling layer performs average pooling on the feature map, the first point convolution layer is used to extract features, both the third activation function and the fourth activation function layer are used to enhance features, and the second point convolution layer is used to integrate features.
[0089] In this embodiment, the channel attention module respectively passes the input feature map through the adaptive max pooling layer and the adaptive average pooling layer to obtain the significant feature and the average feature, then refines the features and introduces non-linearity through the point convolution layer and the activation function layer, then fuses the activated significant feature and the average feature to obtain the channel attention weight, and finally multiplies it with the input feature, so as to emphasize more relevant features and suppress less useful features at the same time.
[0090] Among them, the spatial attention layer includes a max pooling layer, an average pooling layer, a first convolution layer and a third activation function. The first convolution layer is connected to the max pooling layer, the average pooling layer and the third activation function, as Figure 2 shown in (c) of
[0091] The max pooling layer is used to perform max pooling on the feature map, the average pooling layer is used to perform average pooling on the feature map, the first convolution layer is used to extract features, and the third activation function is used to enhance features.
[0092] In this embodiment, the spatial attention module respectively performs the channel max pooling operation and the channel average pooling operation on the input feature, fuses them to obtain the attention weight in the channel dimension, and finally multiplies it with the input feature, so as to determine which features should be focused on in the feature map, and then enhance these features.
[0093] Among them, according to the execution order of the inverted block, the inverted block sequentially includes the depthwise separable convolution layer, the layer normalization layer, the third point convolution layer, the fifth activation function and the fourth point convolution layer, as Figure 2 shown in (d) of ; the depthwise separable convolution layer is used to extract local features, the layer normalization layer is used to enhance features, the third point convolution layer is used to integrate features, the fifth activation function is used to enhance features, and the fourth point convolution layer is used to enhance features.
[0094] In this embodiment, the inverted block can first extract the local features of the silkworm through the 7×7 large kernel depthwise separable convolution, then integrate the features of each channel through the point convolution with four times the hidden dimension, further enhance the features through normalization and activation functions, and finally adjust the number of channels back to the same as the input channel number through the point convolution for further enhancement and refinement of the features.
[0095] Among them, the inverted convolutional attention modules of the same level of the encoder and the decoder correspond one by one, and a depth residual skip connection module is provided between the inverted convolutional attention modules of the same level of the encoder and the decoder.
[0096] Among them, the KAN module is located at a first position, and the first position is obtained by: obtaining the inverted convolutional attention module of the last level of the encoder to obtain a third module, obtaining the inverted convolutional attention module of the last level of the decoder to obtain a fourth module, and obtaining the bottleneck layer of the path from the third module to the fourth module to obtain the first position.
[0097] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they know the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0098] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A method for dividing mulberry silkworms, characterized in that, The method includes: Obtaining an original mulberry silkworm image, obtaining a training set based on the original mulberry silkworm image, and obtaining a mulberry silkworm segmentation model based on the training set. The mulberry silkworm segmentation model includes an encoder, a depth residual skip connection module, and a decoder. The depth residual skip connection module is connected to both the encoder and the decoder. Segmenting the image to be segmented based on the mulberry silkworm segmentation model to obtain a segmentation result. The way to obtain the segmentation result is as follows: The encoder downsamples the image to be segmented to obtain a first feature map. The decoder upsamples the first feature map to obtain a second feature map. The depth residual skip connection module fuses the first feature map and the second feature map to obtain an output map, and the segmentation result is obtained based on the output map. The depth residual skip connection module includes a depthwise separable convolutional layer, a first normalization layer, a point convolutional layer, and a second normalization layer. Both the first normalization layer and the second normalization layer include a first activation function. The depthwise separable convolutional layer is used to extract features of the first feature map. Both the first normalization layer and the second normalization layer are used for normalizing the input data. The point convolutional layer is used to change the number of channels. The first activation function is used to process non-linear information. The mulberry silkworm segmentation model further includes a KAN module. The KAN module integrates and transforms the first feature map to obtain a third feature map. The decoder upsamples the third feature map to obtain the second feature map. The KAN module includes several KAN Layer layers. Adjacent KAN Layer layers are connected by a second activation function. Each KAN Layer layer includes several KAN Linear layers. The KAN Layer layer is used to transform the dimension of the input data. The second activation function is used to reduce the number of parameters. The KAN Linear layer is used to integrate and transform features of different levels.
2. The mulberry silkworm segmentation method according to claim 1, characterized in that The KAN module is located at the bottleneck layer of the path from the encoder to the decoder.
3. The mulberry silkworm segmentation method according to claim 2, characterized in that, Both the encoder and the decoder include several inverted convolutional attention modules at different levels. The inverted convolutional attention module of the encoder extracts first features of different scales of the image to be segmented to obtain the first feature map. The inverted convolutional attention module of the encoder increases the spatial resolution of the third feature map based on the first feature to obtain the second feature map. The inverted convolutional attention module includes the depthwise separable convolutional layer, a channel attention layer, a spatial attention layer, and an inverted block. The depthwise separable convolutional layer is used to extract features. The channel attention layer is used to identify key features. The spatial attention layer is used to identify key regions. The inverted block is used to enhance features.
4. The mulberry silkworm segmentation method according to claim 3, wherein, The spatial attention layer includes a max pooling layer, an average pooling layer, a first convolutional layer, and a third activation function. The first convolutional layer is connected to the max pooling layer, the average pooling layer, and the third activation function. The max pooling layer is used to perform max pooling on the feature map, the average pooling layer is used to perform average pooling on the feature map, the first convolutional layer is used to extract features, and the third activation function is used to enhance features.
5. The mulberry silkworm segmentation method according to claim 3, characterized in that, The channel attention layer includes an adaptive max pooling layer, an adaptive average pooling layer, a first module, a second module, and a third activation function. The first module is connected to both the adaptive max pooling layer and the third activation function, and the second module is connected to both the adaptive average pooling layer and the third activation function; Both the first module and the second module include a first point convolutional layer, a fourth activation function layer, and a second point convolutional layer. The fourth activation function is connected to both the first point convolutional layer and the second point convolutional layer; The adaptive max pooling layer is used to perform max pooling on the feature map, the adaptive average pooling layer performs average pooling on the feature map, the first point convolutional layer is used to extract features, both the third activation function and the fourth activation function layer are used to enhance features, and the second point convolutional layer is used to integrate features.
6. The mulberry silkworm segmentation method according to claim 3, characterized in that, According to the execution order of the inverted block, the inverted block sequentially includes the depthwise separable convolutional layer, the layer normalization layer, the third point convolutional layer, the fifth activation function, and the fourth point convolutional layer; The depthwise separable convolutional layer is used to extract local features, the layer normalization layer is used to enhance features, the third point convolutional layer is used to integrate features, the fifth activation function is used to enhance features, and the fourth point convolutional layer is used to enhance features.
7. A method for dividing mulberry silkworms according to claim 3, characterized in that, The inverted convolutional attention modules at the same levels of the encoder and the decoder correspond one by one, and the depth residual skip connection module is provided between the inverted convolutional attention modules at the same levels of the encoder and the decoder.
8. A method for dividing mulberry silkworms according to claim 3, characterized in that The KAN module is located at the first position. The way to obtain the first position is as follows: Obtain the inverted convolutional attention module at the last level of the encoder to obtain the third module, obtain the inverted convolutional attention module at the last level of the decoder to obtain the fourth module, and obtain the bottleneck layer of the path from the third module to the fourth module to obtain the first position.
9. A method for dividing mulberry silkworms according to claim 1, characterized in that, The specific steps for obtaining the training set based on the original silkworm image include: Enhance the original silkworm image to obtain the training set.
Citation Information
Patent Citations
RGB-D semantic segmentation method and system based on adaptive context sensing network
CN116580192A
Image segmentation method based on hybrid convolution and multi-scale attention gate
CN118212415A