Image segmentation method based on multi-scale feature extraction and image capturing device
Through multi-scale feature extraction and deep learning technology, the problems of resolution and scale limitations, contrast issues and insufficient robustness in medical image segmentation are solved, and high-precision and flexible image segmentation effects are achieved.
Patent Information
- Application Number
- CN202410746444.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN118608534A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image analysis, and in particular to an image segmentation method and an image capturing device based on multi-scale feature extraction. Background Art
[0002] In the field of medical imaging, image segmentation is a crucial technology that helps medical experts accurately analyze pathological images to evaluate and diagnose the health of various body parts. Current background technology usually involves collecting images of specific body parts and distinguishing the target area (i.e. the body part of interest) from the background (i.e. the irrelevant parts of the image) through image processing technology. This segmentation allows doctors to more clearly observe the structural details of the body part, including the edges, shape, size and its relationship with surrounding tissues.
[0003] Although existing medical image segmentation technology has made progress in many aspects, it still has some limitations:
[0004] Resolution and scale limitations: Traditional image segmentation methods may not be able to effectively process medical images captured at different resolutions and scales. Especially when dealing with small or structurally complex body parts, image processing at a single scale may not be able to accurately capture all relevant details.
[0005] Contrast and visibility issues: In some cases, the contrast between the target body part and the surrounding tissues on the image may not be obvious, making the segmentation process complicated and difficult to accurately distinguish the boundaries.
[0006] Insufficient robustness: Existing techniques may be sensitive to image quality, shooting angle, and lighting conditions, and fluctuations in these factors may lead to unstable segmentation accuracy.
[0007] To this end, those skilled in the art provide an image segmentation method and an image capture device based on multi-scale feature extraction to solve the problems raised in the above background technology. Summary of the invention
[0008] In view of the shortcomings of the prior art, the present invention provides an image segmentation method and an image capture device based on multi-scale feature extraction, which solve the problems of the prior art in terms of poor resolution and scale limitations, contrast and visibility problems, and insufficient robustness.
[0009] To achieve the above objectives, the present invention is implemented by the following technical scheme: an image segmentation method based on multi-scale feature extraction comprises the following steps:
[0010] S1. Image preprocessing: normalize the input image to keep its pixel value between 0 and 1, and perform irregular rotation, scaling, and translation on the input image during data enhancement;
[0011] S2, multi-scale feature extraction: construct an image pyramid for the processed input image, process the input image simultaneously at multiple scales, and extract image features at each scale by applying a convolutional neural network;
[0012] S3, attention mechanism design: add self-attention mechanism and channel attention mechanism in each scale processing of step S2;
[0013] The self-attention mechanism is used to calculate the similarity between features at different scales and generate an attention map. The attention map is used to weight the feature map to enhance significant features and suppress irrelevant features.
[0014] The channel attention mechanism is used to calculate the importance weight of each channel on the feature map of each scale, and adjust the channel value of each feature map according to the channel weight to enhance important features;
[0015] S4, Feature Fusion: Feature maps of different scales are upsampled or downsampled to make them of the same size. The aligned feature maps are fused by weighted averaging, and the attention mechanism optimizes the fusion process to ensure that important features are effectively used;
[0016] S5. Image segmentation: First, the segmentation head is designed. Multiple fully convolutional network (FCN) segmentation heads are designed to process the fused feature map and generate the final segmentation result. During the segmentation process, each pixel needs to be classified to generate a segmentation mask. In addition, supervision signals are introduced in the middle layer and the final output layer of the model to improve the segmentation accuracy.
[0017] S6, post-processing: morphological operations including opening and closing operations are performed on the segmentation mask to remove noise and refine the boundaries, and finally CRF is used to further optimize the segmentation results;
[0018] S7. Evaluation and optimization: Combine cross entropy loss and Dice loss to balance the category imbalance problem and improve the segmentation effect. After the model is used, cross validation and test sets are applied to evaluate the model performance and adjust the hyperparameters to obtain the best results.
[0019] Preferably, a Gaussian pyramid is used in step S2, and the Gaussian pyramid calculation steps are:
[0020] S21, performing Gaussian smoothing on the original image to obtain a smoothed image;
[0021] S22, downsampling the smoothed image;
[0022] S23. Repeat the above steps until the desired scale is reached.
[0023] Preferably, the function expression of the S21 Gaussian smoothing is:
[0024] I′ k =I k *G
[0025] The downsampling function expression in step S22 is:
[0026] I k+1 (x,y)=I k ′(2x,2y)
[0027] Among them, the original image is I0, and the k-th layer image is I k , the Gaussian kernel is G, and * is the convolution operation.
[0028] Preferably, the convolutional neural network in step S2 uses one or more of ResNet or VGG.
[0029] Preferably, in the step S4, a fused feature map is automatically generated after the feature maps are fused by weighted averaging.
[0030] Preferably, in step S5, the fully convolutional network FCN segmentation head includes a convolutional encoder, a feature extractor, a convolutional decoder and an output layer, and multiple segmentation heads are designed to obtain segmentation results by constructing multiple independent decoders and output layers.
[0031] Preferably, designing a fully convolutional network (FCN) segmentation head comprises the following steps:
[0032] S51, use backbone network to extract multi-scale features;
[0033] S52, creating an independent decoder and output layer for each segmentation head;
[0034] S53, merging the outputs of multiple segmentation heads according to requirements;
[0035] S54. Design an independent loss function for each segmentation head.
[0036] Preferably, in step S54, the loss function is specifically a focal loss function.
[0037] An image capture device based on multi-scale feature extraction, according to an image segmentation method based on multi-scale feature extraction, comprises an image sensor module, an image processing module, a computing processing unit, a storage module, a communication module, a display module, a control interface module, and a power supply module;
[0038] The image sensor module is used to convert the optical signal into a digital image signal to generate raw image data;
[0039] The image processing module is used to perform preprocessing operations including normalization, denoising and enhancement on the captured image, extract multi-scale features from the preprocessed image, run the multi-segmentation head FCN image segmentation algorithm, perform segmentation processing on the extracted features, and then perform morphological operations and conditional random field optimization post-processing on the segmentation results;
[0040] The computing processing unit is used to run the multi-segmentation head FCN image segmentation algorithm, handle complex computing tasks, and use the CPU to accelerate the computing process of the convolutional neural network;
[0041] The storage module is used to save the captured original image and pre-processed image data, store the image segmentation results after segmentation processing and post-processing, and the pre-trained model parameters and configuration files of the image segmentation algorithm;
[0042] The communication module is used to transmit image data and segmentation results via wireless communication;
[0043] The display module is used to display the captured original image and the image results after segmentation processing;
[0044] The control interface module is used to allow the user to adjust the parameters of the image capture, processing and segmentation algorithms of the device through a touch screen;
[0045] The power supply module is used to provide a stable power supply for the entire image capturing device to ensure the normal operation of each module.
[0046] Preferably, the image sensor module transmits the captured raw image data to the image processing module through the MIPI interface, the image processing module and the computing processing unit transmit data through PCIe, the image processing module is connected to the storage module through the DDR storage interface, the image processing module is connected to the communication module through the UART communication interface, the image processing module is connected to the display module through the HDMI video output interface, the control interface module is connected to the image processing module and the computing processing unit through the GPIO control bus, and the power supply module provides power to each module through the PMIC power supply interface.
[0047] The present invention provides an image segmentation method and an image capture device based on multi-scale feature extraction, which have the following beneficial effects:
[0048] 1. This invention significantly improves the accuracy of image segmentation through multi-scale feature extraction technology and refined image processing flow. It uses Gaussian pyramid to construct multi-level images and adopts advanced convolutional neural network for feature extraction. Combined with self-attention and channel attention mechanism, this technology can accurately identify and strengthen key features while suppressing irrelevant information. This method not only optimizes feature expression, but also deepens the understanding of image content through multi-scale perspective, greatly improving segmentation accuracy.
[0049] 2. The present invention greatly enhances the robustness and processing efficiency of the model through image preprocessing and feature fusion strategies. The normalization and data enhancement steps enable the model to adapt to changing shooting conditions and image quality, while feature fusion effectively retains information of different scales through precise alignment and weighted averaging, reducing the consumption of computing resources. The flexible design of multiple segmentation heads further provides the possibility of customizing segmentation strategies according to different application requirements, improving the flexibility and scalability of practical applications.
[0050] 3. The present invention ensures the refinement of segmentation results and the high generalization ability of the model through the application of post-processing and comprehensive evaluation strategies. Through morphological operations and conditional random field technology, the quality and boundaries of the segmentation mask are significantly optimized. At the same time, the evaluation method combining cross entropy loss and D ice loss helps to deal with the problem of class imbalance and improves the sensitivity and accuracy of the model when dealing with minority categories. These combined effects make the present invention more reliable in actual deployment and meet the needs of high-precision image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a schematic diagram of the process of the present invention;
[0052] Figure 2 is a detailed flow chart of step S2 of the present invention;
[0053] Figure 3 is a detailed flow chart of step S5 of the present invention;
[0054] Figure 4 It is a schematic diagram of the system framework structure of the present invention. DETAILED DESCRIPTION
[0055] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Example:
[0057] Please see attached Figure 1The embodiment of the present invention provides an image segmentation method based on multi-scale feature extraction, comprising the following steps:
[0058] S1. Image preprocessing: normalize the input image to keep its pixel value between 0 and 1, and perform irregular rotation, scaling, and translation on the input image during data enhancement;
[0059] Through normalization, the pixel values of the input image are kept between 0 and 1, in order to eliminate the impact of different brightness between different images. Irregular rotation, scaling, and translation are performed to increase the model's adaptability to different deformations, which helps to improve the model's generalization ability when processing real-world images. S2. Multi-scale feature extraction: The processed input image is subjected to image pyramid construction, and the input image is processed simultaneously at multiple scales, and image features are extracted at each scale by applying a convolutional neural network;
[0060] The convolutional neural network in step S2 uses one or more of ResNet or VGG.
[0061] Uses the Gaussian pyramid technique, which processes images at multiple scales by recursively applying Gaussian smoothing and downsampling steps. A convolutional neural network such as ResNet or VGG is used at each pyramid level to extract deep features that are important for identifying different objects in the image.
[0062] Please see attached Figure 2 , Gaussian pyramid is used in step S2, and the calculation steps of Gaussian pyramid are:
[0063] S21, performing Gaussian smoothing on the original image to obtain a smoothed image;
[0064] The function expression of S21 Gaussian smoothing is:
[0065] I′ k =I k *G
[0066] The downsampling function expression in step S22 is:
[0067] I k+1 (x,y)=I k ′(2x,2y)
[0068] Among them, the original image is I0, and the k-th layer image is I k , the Gaussian kernel is G, and * is the convolution operation.
[0069] S22, downsampling the smoothed image;
[0070] S23. Repeat the above steps until the desired scale is reached.
[0071] S3, attention mechanism design: add self-attention mechanism and channel attention mechanism in each scale processing of step S2;
[0072] The self-attention mechanism is used to calculate the similarity between features at different scales and generate an attention map. The attention map is used to weight the feature map to enhance significant features and suppress irrelevant features.
[0073] The channel attention mechanism is used to calculate the importance weight of each channel on the feature map of each scale, and adjust the channel value of each feature map according to the channel weight to enhance important features;
[0074] The self-attention mechanism is used to calculate the similarity between features of different scales and generate an attention map. This helps the model focus on the key parts of the image and improve the accuracy of segmentation.
[0075] The channel attention mechanism calculates the importance of each channel in the feature map of each scale, and adjusts the feature response of the channel accordingly, strengthening important features and suppressing unimportant features. The attention mechanism ensures that the model focuses on the features that are most helpful for the task, improving the accuracy and efficiency of segmentation. By optimizing the processing of important features rather than the entire image, the consumption of computing resources is reduced.
[0076] S4, Feature Fusion: Feature maps of different scales are upsampled or downsampled to make them of the same size. The aligned feature maps are fused by weighted averaging, and the attention mechanism optimizes the fusion process to ensure that important features are effectively used;
[0077] In the fusion process, the most important information of each scale is retained through weighted processing, avoiding information loss, and ensuring the consistency and continuity of features extracted from different scales in the final output.
[0078] In step S4, the feature maps are fused by weighted averaging to automatically generate a fused feature map.
[0079] S5. Image segmentation: First, the segmentation head is designed. Multiple fully convolutional network (FCN) segmentation heads are designed to process the fused feature map and generate the final segmentation result. During the segmentation process, each pixel needs to be classified to generate a segmentation mask. In addition, supervision signals are introduced in the middle layer and the final output layer of the model to improve the segmentation accuracy.
[0080] In step S5, the fully convolutional network FCN segmentation head includes a convolutional encoder, a feature extractor, a convolutional decoder and an output layer, and multiple segmentation heads are designed to obtain segmentation results by constructing multiple independent decoders and output layers.
[0081] Please see attached Figure 3 , designing the fully convolutional network FCN segmentation head includes the following steps:
[0082] S51, use backbone network to extract multi-scale features;
[0083] S52, creating an independent decoder and output layer for each segmentation head;
[0084] S53, merging the outputs of multiple segmentation heads according to requirements;
[0085] S54. Design an independent loss function for each segmentation head.
[0086] In step S54, the loss function is specifically a focal loss function.
[0087] FCN can perform effective segmentation across the entire image, provide accurate pixel-level classification, and design multiple segmentation heads that can be adjusted and optimized according to different application requirements.
[0088] S6. Post-processing: Morphological operations including opening and closing operations are performed on the segmentation mask to remove noise and refine the boundaries, and CRF is used to further optimize the segmentation results in the end; removing noise and refining boundaries make the segmentation results more accurate and beautiful, and further optimization using conditional random fields ensures the consistency and accuracy of the segmentation.
[0089] S7. Evaluation and optimization: Combine cross entropy loss and Dice loss to balance the category imbalance problem and improve the segmentation effect. After the model is used, cross validation and test sets are applied to evaluate the model performance and adjust the hyperparameters to obtain the best results.
[0090] The application of this mixed loss function helps the model show better balance and accuracy when facing categories of different sizes and frequencies. Through the application of cross-validation and test sets, the hyperparameters are continuously adjusted to ensure that the model achieves optimal performance.
[0091] The image segmentation method based on multi-scale feature extraction improves segmentation accuracy and efficiency through multi-step comprehensive processing. First, through the preprocessing steps of normalization and data enhancement, the model can adapt to various shooting conditions and reduce the impact of different devices or lighting conditions. Next, a Gaussian pyramid is used to construct image hierarchies of different scales, and important features are extracted through a deep learning network, allowing the model to capture local details and global structures at the same time, enhancing the understanding of image content.
[0092] Through self-attention and channel attention mechanisms, the model strengthens key features and suppresses irrelevant information, thereby processing important areas more effectively. The feature fusion stage ensures that information extracted from different scales is maximized and consistently expressed through size alignment and weighted averaging strategies.
[0093] Image segmentation uses a fully convolutional network structure to perform accurate classification at the pixel level, and the multi-segmentation head design allows the model to be adjusted according to different needs. Morphological operations and conditional random fields in the post-processing stage further refine and optimize the segmentation boundaries, improving the aesthetics and accuracy of the results. Finally, by combining cross entropy loss and Dice loss for optimization, and using cross validation and test set evaluation, the model is adjusted to achieve the best performance. Overall, this method improves the accuracy of segmentation, enhances the generalization ability of the model, and optimizes computational efficiency.
[0094] Embodiment 2:
[0095] Please see attached Figure 4 , an embodiment of the present invention provides an image capture device based on multi-scale feature extraction, including an image sensor module, an image processing module, a computing processing unit, a storage module, a communication module, a display module, a control interface module, and a power supply module;
[0096] The image sensor module is used to convert the optical signal into a digital image signal to generate raw image data;
[0097] The image processing module is used to perform preprocessing operations including normalization, denoising and enhancement on the captured images, extract multi-scale features from the preprocessed images, run the multi-segmentation head FCN image segmentation algorithm, perform segmentation processing on the extracted features, and then perform morphological operations and conditional random field optimization post-processing on the segmentation results;
[0098] The computing processing unit is used to run the multi-segmentation head FCN image segmentation algorithm, handle complex computing tasks, and use the CPU to accelerate the calculation process of the convolutional neural network;
[0099] The storage module is used to save the captured original image and pre-processed image data, store the image segmentation results after segmentation processing and post-processing, and the pre-trained model parameters and configuration files of the image segmentation algorithm;
[0100] The communication module is used to transmit image data and segmentation results via wireless communication;
[0101] The display module is used to display the captured original image and the image results after segmentation processing;
[0102] The control interface module is used to allow the user to adjust the parameters of the image capture, processing and segmentation algorithms of the device through a touch screen;
[0103] The power module is used to provide a stable power supply for the entire image capture device to ensure the normal operation of each module.
[0104] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An image segmentation method based on multi-scale feature extraction, characterized in that: The following steps are involved: S1. Image preprocessing: normalize the input image to keep its pixel value between 0 and 1, and perform irregular rotation, scaling, and translation on the input image during data enhancement; S2, multi-scale feature extraction: construct an image pyramid for the processed input image, process the input image simultaneously at multiple scales, and extract image features at each scale by applying a convolutional neural network; S3, attention mechanism design: add self-attention mechanism and channel attention mechanism in each scale processing of step S2; The self-attention mechanism is used to calculate the similarity between features at different scales and generate an attention map. The attention map is used to weight the feature map to enhance significant features and suppress irrelevant features. The channel attention mechanism is used to calculate the importance weight of each channel on the feature map of each scale, and adjust the channel value of each feature map according to the channel weight to enhance important features; S4, Feature Fusion: Feature maps of different scales are upsampled or downsampled to make them of the same size. The aligned feature maps are fused by weighted averaging, and the attention mechanism optimizes the fusion process to ensure that important features are effectively used; S5. Image segmentation: First, the segmentation head is designed. Multiple fully convolutional network (FCN) segmentation heads are designed to process the fused feature map and generate the final segmentation result. During the segmentation process, each pixel needs to be classified to generate a segmentation mask. In addition, supervision signals are introduced in the middle layer and the final output layer of the model to improve the segmentation accuracy. S6, post-processing: morphological operations including opening and closing operations are performed on the segmentation mask to remove noise and refine the boundaries, and finally CRF is used to further optimize the segmentation results; S7. Evaluation and optimization: Combine cross entropy loss and Dice loss to balance the category imbalance problem and improve the segmentation effect. After the model is used, cross validation and test sets are applied to evaluate the model performance and adjust the hyperparameters to obtain the best results.
2. The image segmentation method based on multi-scale feature extraction according to claim 1, characterized in that: The Gaussian pyramid is used in the S2 step, and the Gaussian pyramid calculation steps are: S21, performing Gaussian smoothing on the original image to obtain a smoothed image; S22, downsampling the smoothed image; S23. Repeat the above steps until the desired scale is reached.
3. The image segmentation method based on multi-scale feature extraction according to claim 2, characterized in that: The function expression of the S21 Gaussian smoothing is: I′ k =I k *G The downsampling function expression in step S22 is: I k+1 (x,y)=I k ′(2x,2y) Among them, the original image is I0, and the k-th layer image is I k , the Gaussian kernel is G, and * is the convolution operation.
4. The image segmentation method based on multi-scale feature extraction according to claim 1, characterized in that: The convolutional neural network in step S2 uses one or more of ResNet or VGG.
5. The image segmentation method based on multi-scale feature extraction according to claim 1, characterized in that: In the step S4, the feature maps are fused by weighted averaging to automatically generate a fused feature map.
6. The image segmentation method based on multi-scale feature extraction according to claim 1, characterized in that: In the step S5, the fully convolutional network FCN segmentation head includes a convolutional encoder, a feature extractor, a convolutional decoder and an output layer, and multiple segmentation heads are designed to obtain segmentation results by constructing multiple independent decoders and output layers.
7. The image segmentation method based on multi-scale feature extraction according to claim 6, characterized in that: Designing the fully convolutional network FCN segmentation head includes the following steps: S51, use backbone network to extract multi-scale features; S52, creating an independent decoder and output layer for each segmentation head; S53, merging the outputs of multiple segmentation heads according to requirements; S54. Design an independent loss function for each segmentation head.
8. The image segmentation method based on multi-scale feature extraction according to claim 7, characterized in that: In the step S54, the loss function is specifically a focal loss function.
9. An image capturing device based on multi-scale feature extraction, according to the image segmentation method based on multi-scale feature extraction according to claims 1-8, characterized in that: It includes an image sensor module, an image processing module, a computing processing unit, a storage module, a communication module, a display module, a control interface module, and a power supply module; The image sensor module is used to convert the optical signal into a digital image signal to generate raw image data; The image processing module is used to perform preprocessing operations including normalization, denoising and enhancement on the captured image, extract multi-scale features from the preprocessed image, run the multi-segmentation head FCN image segmentation algorithm, perform segmentation processing on the extracted features, and then perform morphological operations and conditional random field optimization post-processing on the segmentation results; The computing processing unit is used to run the multi-segmentation head FCN image segmentation algorithm, handle complex computing tasks, and use the CPU to accelerate the computing process of the convolutional neural network; The storage module is used to save the captured original image and pre-processed image data, store the image segmentation results after segmentation processing and post-processing, and the pre-trained model parameters and configuration files of the image segmentation algorithm; The communication module is used to transmit image data and segmentation results via wireless communication; The display module is used to display the captured original image and the image results after segmentation processing; The control interface module is used to allow the user to adjust the parameters of the image capture, processing and segmentation algorithms of the device through a touch screen; The power supply module is used to provide a stable power supply for the entire image capturing device to ensure the normal operation of each module.
10. The image capturing device based on multi-scale feature extraction according to claim 9, characterized in that: The image sensor module transmits the captured raw image data to the image processing module through the MIPI interface, the image processing module and the computing processing unit transmit data through PCIe, the image processing module is connected to the storage module through the DDR storage interface, the image processing module is connected to the communication module through the UART communication interface, the image processing module is connected to the display module through the HDMI video output interface, the control interface module is connected to the image processing module and the computing processing unit through the GPIO control bus, and the power module provides power to each module through the PMIC power interface.
Citation Information
Cited By
Focusing method and device of projector, equipment and storage medium
CN118972533A
Coal gangue detection method based on multi-angle perception and mixed scale Transform feature aggregation
CN119399493A
Image processing method, device and system and computer readable storage medium
CN120689870A
Ultrasonic image enhancement method based on segmentation feedback and multi-scale feature fusion
CN121707836A
