CN113223021B - A UNet-based method for lung X-ray image segmentation - Google Patents

A UNet-based method for lung X-ray image segmentation Download PDF

Info

Publication number
CN113223021B
CN113223021B CN202110589697.0A CN202110589697A CN113223021B CN 113223021 B CN113223021 B CN 113223021B CN 202110589697 A CN202110589697 A CN 202110589697A CN 113223021 B CN113223021 B CN 113223021B
Authority
CN
China
Prior art keywords
lung
unet
image
convolution
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN202110589697.0A
Other languages
Chinese (zh)
Other versions
CN113223021A (en
Inventor
王英立
崔艺龄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Harbin University of Science and Technology
Original Assignee
Harbin University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Harbin University of Science and Technology filed Critical Harbin University of Science and Technology
Priority to CN202110589697.0A priority Critical patent/CN113223021B/en
Publication of CN113223021A publication Critical patent/CN113223021A/en
Application granted granted Critical
Publication of CN113223021B publication Critical patent/CN113223021B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10116X-ray image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30004Biomedical image processing
    • G06T2207/30061Lung

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a lung X-ray image segmentation method based on UNet, which comprises the following steps: preprocessing a lung X-ray image in a Kaggle data set to obtain a training set; constructing an improved UNet framework by using a method of transfer learning and adding residual blocks; taking the training sample obtained in the step 1 and the lung X-ray segmentation image in the Kaggle data set as input data of the improved UNet, and training an improved UNet segmentation model; introducing the lung X-ray image test data to be segmented into a trained improved UNet model to obtain a segmented result; and performing post-processing on the segmented result to obtain a final segmented result. Experimental results show that the method can effectively solve the segmentation problem of the lung X-ray image, obtains a segmentation method with higher accuracy than a UNet-based lung X-ray image segmentation method, and can be further applied to segmentation of other medical X-ray images.

Description

一种基于UNet的肺部X光图像分割方法A UNet-based method for lung X-ray image segmentation

技术领域technical field

本发明属于图像分割领域,涉及适用于肺部X光图像分割,可用于医学图像分割、肺部疾病识别等领域。The invention belongs to the field of image segmentation, relates to the segmentation of lung X-ray images, and can be used in the fields of medical image segmentation, lung disease identification and the like.

背景技术Background technique

近年来,随着人计算机性能不断完善,深度学习逐渐成为常见的图像处理手段。深度学习可以应用于医学图像分割和识别领域中,较医生经验判断而言,具有更高的识别准确度,成为当前研究的热点。肺炎是比较常见的肺部疾病,多发病于儿童当中,而肺部图像分割是肺炎识别技术中一个主要步骤,分割的效果直接影响后续识别的准确度。In recent years, with the continuous improvement of human and computer performance, deep learning has gradually become a common image processing method. Deep learning can be applied to the field of medical image segmentation and recognition. Compared with the experience judgment of doctors, it has higher recognition accuracy and has become a hotspot of current research. Pneumonia is a relatively common lung disease, frequently occurring in children, and lung image segmentation is a major step in pneumonia identification technology. The effect of segmentation directly affects the accuracy of subsequent identification.

在实际应用中,肺部X光图像中的肺实质与背景之间的对比度不高、仪器拍摄过程中会产生噪声都会对肺部X光图像分割和识别产生影响。虽然有很多深度学习网络可以解决图像分割、识别和分类等问题,且均获得了显著成效,但应用于肺部X光图像分割领域的方法很少,此外公开的肺部X光图像数据集较小,都加大了肺部分割和肺部疾病识别的难度。在医学图像分割领域,UNet分割模型是常用的分割方法,加入跳跃连接的连接方式提高了模型分割准确度,此外,UNet对输入图片尺寸的包容性很强,是很好的图像分割方法。In practical applications, the contrast between the lung parenchyma and the background in the lung X-ray image is not high, and the noise generated during the shooting process of the instrument will affect the segmentation and recognition of the lung X-ray image. Although there are many deep learning networks that can solve the problems of image segmentation, recognition and classification, and have achieved remarkable results, there are few methods applied to the field of lung X-ray image segmentation. Small, all increase the difficulty of lung segmentation and lung disease identification. In the field of medical image segmentation, the UNet segmentation model is a commonly used segmentation method. The connection method of adding skip connections improves the accuracy of model segmentation. In addition, UNet is very tolerant to the size of the input image and is a good image segmentation method.

发明内容SUMMARY OF THE INVENTION

本发明提供一种基于UNet的肺部X光图像分割方法,在保留UNetU型结构的基础上,通过使用迁移学习、改变卷积方式及添加并行残差块的方法,提高肺部X光图像的分割准确度。The invention provides a UNet-based lung X-ray image segmentation method. On the basis of retaining the UNet U-shaped structure, the method of using migration learning, changing the convolution method and adding parallel residual blocks can improve the lung X-ray image. Segmentation accuracy.

为解决上述技术问题,本发明的技术方案如下:For solving the above-mentioned technical problems, the technical scheme of the present invention is as follows:

一种基于UNet的肺部X光图像分割方法,包括以下步骤:A UNet-based lung X-ray image segmentation method, comprising the following steps:

S1,对Kaggle数据集中肺部X光图像进行预处理获得训练集;S1, preprocessing lung X-ray images in the Kaggle dataset to obtain a training set;

S2,利用迁移学习、改变卷积方式及添加残差块的方法构建改进UNet框架;S2, using transfer learning, changing the convolution method and adding residual blocks to build an improved UNet framework;

S3,将步骤S1得到训练样本和Kaggle数据集中肺部X光分割图像作为改进UNet的输入数据,训练改进UNet分割模型;S3, using the training sample obtained in step S1 and the lung X-ray segmentation image in the Kaggle dataset as the input data of the improved UNet, and training the improved UNet segmentation model;

S4,将待分割的肺部X光图像测试数据引入训练好的改进UNet模型,得到分割后的图像;S4, introducing the lung X-ray image test data to be segmented into the trained improved UNet model to obtain segmented images;

S5,将分割后的结果做后期处理,得到最终分割结果。S5, post-processing the segmented result to obtain a final segmented result.

优选地,步骤S1中利用图像边缘填充、高斯滤波、限制对比度的区域直方图均衡化(CLAHE)及数据增强的方法对原始的肺部X光图像进行预处理,预处理方法具体为:Preferably, in step S1, the original lung X-ray image is preprocessed by using image edge filling, Gaussian filtering, contrast-limiting regional histogram equalization (CLAHE) and data enhancement, and the preprocessing method is specifically:

A1,根据图像的长度和宽度,将原始肺部X光图像和对应标签图像扩充为正方形图像具体为:A1, according to the length and width of the image, expand the original lung X-ray image and the corresponding label image into a square image. Specifically:

当原始肺部X光图像的长度与宽度不同时,通过添加像素值为0的像素点,使得图像的宽度和长度相同,从而获得边缘填充后的肺部X光图像和与其对应的标签图像;When the length and width of the original lung X-ray image are different, the width and length of the image are made the same by adding pixels with a pixel value of 0, so as to obtain the edge-filled lung X-ray image and its corresponding label image;

A2,将A1中处理后的原始肺部图像做高斯滤波,获得去噪后的肺部X光图像,其中高斯核为标准差为1,大小为3×3的高斯模板矩阵;A2: Perform Gaussian filtering on the original lung image processed in A1 to obtain a denoised lung X-ray image, where the Gaussian kernel is a Gaussian template matrix with a standard deviation of 1 and a size of 3×3;

A3,将A2中处理后的图像做CLAHE,获得对比度较高的肺部X光图像,其中图像划分的小区域数为8×8,修剪限制度为图像所有像素点的像素值累加和的2%;A3, perform CLAHE on the image processed in A2 to obtain a high-contrast lung X-ray image, in which the number of small areas divided by the image is 8 × 8, and the trimming limit is 2 of the cumulative sum of the pixel values of all pixels in the image %;

A4,将A3中处理后的肺部X光图像与A1中处理后的标签图像做数据增强具体为:A4, the data enhancement of the lung X-ray image processed in A3 and the label image processed in A1 is as follows:

将A3中处理后的肺部X光图像与A1中处理后的标签图像一一对应,组成数据集N1,将N1中的图像和标签经上下翻转获得数据集N2、经角度值为angle1和angle2的两次旋转获得数据集N3和N4,其中

Figure BDA0003088907020000011
最后将N1、N2、N3和N4共同组成的数据集作为训练神经网络的数据集。The lung X-ray images processed in A3 are corresponding to the label images processed in A1 to form a dataset N1, and the images and labels in N1 are flipped up and down to obtain a dataset N2, and the angle values are angle1 and angle2. Two rotations of to obtain datasets N3 and N4, where
Figure BDA0003088907020000011
Finally, the dataset composed of N1, N2, N3 and N4 is used as the dataset for training the neural network.

优选地,步骤S2中利用迁移学习、改变卷积方式及添加残差块的方法构建改进UNet框架具体为:Preferably, in step S2, the method of using transfer learning, changing the convolution mode and adding residual blocks to construct the improved UNet framework is specifically:

B1,利用迁移学习的方法改进UNet具体为:B1, using the transfer learning method to improve UNet is as follows:

以UNet分割模型为基础,迁移MobileNet网络模型的编码部分,获得Mobile_UNet模型。该模型中编码部分为5层:第一层包括2个卷积块convblock1和convblock2,其中convblock1由32个步长为2、大小为3×3的标准卷积核组成,convblock2由64个步长为1、大小为3×3的深度可分离卷积核组成;第二层包括2个卷积块convblock3和convblock4,其中convblock3由128个步长为2、大小为3×3的深度可分离卷积核组成,convblock4由128个步长为1、大小为3×3的深度可分离卷积核组成;第三层包括2个卷积块convblock5和convblock6,其中convblock5由256个步长为2、大小为3×3的深度可分离卷积核组成,convblock6由256个步长为1、大小为3×3的深度可分离卷积核组成;第四层包括6个卷积块convblock7-convblock12,其中convblock7由512个步长为2、大小为3×3的深度可分离卷积核组成,其余5个卷积块均由512个步长为1、大小为3×3的深度可分离卷积核组成;第五层包括2个卷积块convblock13-convblock14,其中convblock13由1024个步长为2、大小为3×3的深度可分离卷积核组成,convblock14由1024个步长为1、大小为3×3的深度可分离卷积核组成。Mobile_UNet模型中解码部分为5层:前四层均由一个上采样模块、一个标准卷积模块和一个深度可分离卷积模块组成,各层各模块中核的个数分别为(512,512,512)、(256,256,256)、(128,128,128)、(64,64,64),且核大小均为3×3;第五层包括一个含有2个卷积块;Based on the UNet segmentation model, the encoding part of the MobileNet network model is transferred to obtain the Mobile_UNet model. The coding part in this model is 5 layers: the first layer includes 2 convolution blocks convblock1 and convblock2, where convblock1 consists of 32 standard convolution kernels with stride 2 and size 3×3, and convblock2 consists of 64 strides It consists of a depthwise separable convolution kernel of size 1 and size 3×3; the second layer includes 2 convolution blocks convblock3 and convblock4, of which convblock3 consists of 128 depthwise separable volumes with stride 2 and size 3×3 Convolution kernels, convblock4 consists of 128 depthwise separable convolution kernels with stride 1 and size 3×3; the third layer includes 2 convolution blocks convblock5 and convblock6, of which convblock5 consists of 256 strides 2, It consists of depthwise separable convolution kernels of size 3×3, convblock6 consists of 256 depthwise separable convolution kernels with stride 1 and size 3×3; the fourth layer includes 6 convolution blocks convblock7-convblock12, Among them, convblock7 consists of 512 depthwise separable convolution kernels with stride 2 and size 3×3, and the remaining 5 convolution blocks consist of 512 depthwise separable convolutions with stride 1 and size 3×3 Kernel composition; the fifth layer includes 2 convolution blocks convblock13-convblock14, of which convblock13 consists of 1024 depthwise separable convolution kernels with stride 2 and size 3×3, and convblock14 consists of 1024 stride 1 and size It consists of 3×3 depthwise separable convolution kernels. The decoding part in the Mobile_UNet model consists of 5 layers: the first four layers are composed of an upsampling module, a standard convolution module and a depthwise separable convolution module. The number of kernels in each module of each layer is (512, 512, 512 ), (256, 256, 256), (128, 128, 128), (64, 64, 64), and the kernel size is 3 × 3; the fifth layer includes a convolution block with 2;

B2,利用改变卷积方式的方法改进UNet具体为:B2, using the method of changing the convolution method to improve UNet is as follows:

将B1中获得的Mobile_UNet的解码部分中每层第二个卷积块换成深度可分离卷积块;Replace the second convolution block of each layer in the decoding part of Mobile_UNet obtained in B1 with a depthwise separable convolution block;

B3,通过添加残差块的方法改进UNet具体为:B3, improving UNet by adding residual blocks is as follows:

在B1中获得的Mobile_UNet中添加两个并行残差块,第一个残差块由一个3×3的深度可分离卷积块组成,第二个残差块由两个串行的膨胀率分别为2和3的空卷积块组成。Add two parallel residual blocks to Mobile_UNet obtained in B1, the first residual block consists of a 3×3 depthwise separable convolutional block, and the second residual block consists of two serial dilation rates respectively consists of 2 and 3 empty convolution blocks.

优选地,步骤S5将S4中分割后的结果做后期处理,得到最终分割结果具体为:Preferably, in step S5, post-processing is performed on the result of the segmentation in S4, and the final segmentation result obtained is specifically:

对于S4中分割后图片做后期处理,除去连通区域面积小于认定为肺实质区域面积1/5大小的部分,获得最终的肺部分割图像并计算肺部X光图像的分割准确度。For the post-processing of the segmented images in S4, remove the part of the connected area smaller than 1/5 of the area identified as the lung parenchyma area, obtain the final lung segmentation image and calculate the segmentation accuracy of the lung X-ray image.

与现有技术相比,本发明技术方案的有益效果是:Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

通过使用迁移学习、改变卷积方式及添加并行残差块的方法,提高了肺部X光图像的分割准确度。The segmentation accuracy of lung X-ray images was improved by using transfer learning, changing the convolution method, and adding parallel residual blocks.

附图说明Description of drawings

图1为实施例提供的基于UNet的肺部X光图像分割方法的流程图;1 is a flowchart of a UNet-based lung X-ray image segmentation method provided by an embodiment;

图2为实施例提供的肺部原始X光图像和标签图像;Fig. 2 is the lung original X-ray image and label image provided by the embodiment;

图3为实施例提供的经预处理后的肺部原始X光图像和标签图像;Fig. 3 is the preprocessed lung original X-ray image and label image provided by the embodiment;

图4为实施例提供的改进UNet分割模型;Fig. 4 is the improved UNet segmentation model that the embodiment provides;

图5为实施例提供的经改进UNet分割后的图像;Fig. 5 is the image after the improved UNet segmentation provided by the embodiment;

图6为实施例提供的后期处理后的分割图像。FIG. 6 is a segmented image after post-processing provided by the embodiment.

具体实施方式Detailed ways

为使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例对本发明进行进一步的详细说明。应当理解,此处所描述的具体实施方式仅仅用以解释本发明,并不限定本发明的保护范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, and do not limit the protection scope of the present invention.

下面结合附图,对本发明实施例作进一步阐述。The embodiments of the present invention will be further described below with reference to the accompanying drawings.

图1为实施例提供的基于UNet的肺部X光图像分割方法的流程图。图1所示,本实施例提供的基于UNet的肺部X光图像分割方法包括以下步骤:FIG. 1 is a flowchart of a UNet-based lung X-ray image segmentation method provided by an embodiment. As shown in FIG. 1 , the UNet-based lung X-ray image segmentation method provided in this embodiment includes the following steps:

S1,对Kaggle数据集中肺部X光图像进行预处理获得训练集;S1, preprocessing lung X-ray images in the Kaggle dataset to obtain a training set;

S2,利用迁移学习、改变卷积方式及添加残差块的方法构建改进UNet框架;S2, using transfer learning, changing the convolution method and adding residual blocks to build an improved UNet framework;

S3,将步骤S1得到训练样本和Kaggle数据集中肺部X光分割图像作为改进UNet的输入数据,训练改进UNet分割模型;S3, using the training sample obtained in step S1 and the lung X-ray segmentation image in the Kaggle dataset as the input data of the improved UNet, and training the improved UNet segmentation model;

S4,将待分割的肺部X光图像测试数据引入训练好的改进UNet模型,得到分割后图像;S4, introducing the lung X-ray image test data to be segmented into the trained improved UNet model to obtain a segmented image;

S5,将分割后的结果做后期处理,得到最终分割结果。S5, post-processing the segmented result to obtain a final segmented result.

图2为实施例提供的Kaggle数据集中肺部X光图像和标签图像,图3为实施例提供的经预处理后的肺部原始X光图像和标签图像。图3所示,本实施例提供的肺部X光图像的预处理方法包括图像边缘填充、高斯滤波、CLAHE及数据增强四部分具体为:FIG. 2 is a lung X-ray image and a label image in the Kaggle data set provided by the embodiment, and FIG. 3 is a preprocessed original lung X-ray image and label image provided by the embodiment. As shown in FIG. 3 , the preprocessing method of the lung X-ray image provided by this embodiment includes four parts: image edge filling, Gaussian filtering, CLAHE and data enhancement. Specifically:

A1,根据图像的长度和宽度,将原始肺部X光图像和对应标签图像扩充为正方形图像具体为:A1, according to the length and width of the image, expand the original lung X-ray image and the corresponding label image into a square image. Specifically:

当原始肺部X光图像的长度与宽度不同时,通过添加像素值为0的像素点,使得图像的宽度和长度相同,从而获得边缘填充后的肺部X光图像和与其对应的标签图像;When the length and width of the original lung X-ray image are different, the width and length of the image are made the same by adding pixels with a pixel value of 0, so as to obtain the edge-filled lung X-ray image and its corresponding label image;

A2,将A1中处理后的原始肺部图像做高斯滤波,获得去噪后的肺部X光图像,其中高斯核为标准差为1,大小为3×3的高斯模板矩阵;A2: Perform Gaussian filtering on the original lung image processed in A1 to obtain a denoised lung X-ray image, where the Gaussian kernel is a Gaussian template matrix with a standard deviation of 1 and a size of 3×3;

A3,将A2中处理后的图像做CLAHE,获得对比度较高的肺部X光图像,其中图像划分的小区域数为8×8,修剪限制度为图像所有像素点的像素值累加和的2%;A3, perform CLAHE on the image processed in A2 to obtain a high-contrast lung X-ray image, in which the number of small areas divided by the image is 8 × 8, and the trimming limit is 2 of the cumulative sum of the pixel values of all pixels in the image %;

A4,将A3中处理后的肺部X光图像与A1中处理后的标签图像做数据增强具体为:A4, the data enhancement of the lung X-ray image processed in A3 and the label image processed in A1 is as follows:

将A3中处理后的肺部X光图像与A1中处理后的标签图像一一对应,组成数据集N1,将N1中的图像和标签经上下翻转获得数据集N2、经角度值为angle1和angle2的两次旋转获得数据集N3和N4,其中

Figure BDA0003088907020000031
最后将N1、N2、N3和N4共同组成的数据集作为训练神经网络的数据集。The lung X-ray images processed in A3 are corresponding to the label images processed in A1 to form a dataset N1, and the images and labels in N1 are flipped up and down to obtain a dataset N2, and the angle values are angle1 and angle2. Two rotations of to obtain datasets N3 and N4, where
Figure BDA0003088907020000031
Finally, the dataset composed of N1, N2, N3 and N4 is used as the dataset for training the neural network.

图4为实施例提供的改进UNet分割模型。图4所示,利用迁移学习、改变卷积方式及添加残差块的方法构建改进UNet框架具体为:FIG. 4 is an improved UNet segmentation model provided by the embodiment. As shown in Figure 4, using transfer learning, changing the convolution method and adding residual blocks to construct an improved UNet framework is as follows:

B1,利用迁移学习的方法改进UNet具体为:B1, using the transfer learning method to improve UNet is as follows:

以UNet分割模型为基础,迁移MobileNet网络模型的编码部分,获得Mobile_UNet模型。该模型中编码部分为5层:第一层包括2个卷积块convblock1和convblock2,其中convblock1由32个步长为2、大小为3×3的标准卷积核组成,convblock2由64个步长为1、大小为3×3的深度可分离卷积核组成;第二层包括2个卷积块convblock3和convblock4,其中convblock3由128个步长为2、大小为3×3的深度可分离卷积核组成,convblock4由128个步长为1、大小为3×3的深度可分离卷积核组成;第三层包括2个卷积块convblock5和convblock6,其中convblock5由256个步长为2、大小为3×3的深度可分离卷积核组成,convblock6由256个步长为1、大小为3×3的深度可分离卷积核组成;第四层包括6个卷积块convblock7-convblock12,其中convblock7由512个步长为2、大小为3×3的深度可分离卷积核组成,其余5个卷积块均由512个步长为1、大小为3×3的深度可分离卷积核组成;第五层包括2个卷积块convblock13-convblock14,其中convblock13由1024个步长为2、大小为3×3的深度可分离卷积核组成,convblock14由1024个步长为1、大小为3×3的深度可分离卷积核组成。Mobile_UNet模型中解码部分为5层:前四层均由一个上采样模块、一个标准卷积模块和一个深度可分离卷积模块组成,各层各模块中核的个数分别为(512,512,512)、(256,256,256)、(128,128,128)、(64,64,64),且核大小均为3×3;第五层包括一个含有2个卷积块;Based on the UNet segmentation model, the encoding part of the MobileNet network model is transferred to obtain the Mobile_UNet model. The coding part in this model is 5 layers: the first layer includes 2 convolution blocks convblock1 and convblock2, where convblock1 consists of 32 standard convolution kernels with stride 2 and size 3×3, and convblock2 consists of 64 strides It consists of a depthwise separable convolution kernel of size 1 and size 3×3; the second layer includes 2 convolution blocks convblock3 and convblock4, of which convblock3 consists of 128 depthwise separable volumes with stride 2 and size 3×3 Convolution kernels, convblock4 consists of 128 depthwise separable convolution kernels with stride 1 and size 3×3; the third layer includes 2 convolution blocks convblock5 and convblock6, of which convblock5 consists of 256 strides 2, It consists of depthwise separable convolution kernels of size 3×3, convblock6 consists of 256 depthwise separable convolution kernels with stride 1 and size 3×3; the fourth layer includes 6 convolution blocks convblock7-convblock12, Among them, convblock7 consists of 512 depthwise separable convolution kernels with stride 2 and size 3×3, and the remaining 5 convolution blocks consist of 512 depthwise separable convolutions with stride 1 and size 3×3 Kernel composition; the fifth layer includes 2 convolution blocks convblock13-convblock14, of which convblock13 consists of 1024 depthwise separable convolution kernels with stride 2 and size 3×3, and convblock14 consists of 1024 stride 1 and size It consists of 3×3 depthwise separable convolution kernels. The decoding part in the Mobile_UNet model consists of 5 layers: the first four layers are composed of an upsampling module, a standard convolution module and a depthwise separable convolution module. The number of kernels in each module of each layer is (512, 512, 512 ), (256, 256, 256), (128, 128, 128), (64, 64, 64), and the kernel size is 3 × 3; the fifth layer includes a convolution block with 2;

B2,利用改变卷积方式的方法改进UNet,将B1中获得的Mobile_UNet的解码部分中每层第二个卷积块换成深度可分离卷积块;B2, use the method of changing the convolution method to improve UNet, and replace the second convolution block of each layer in the decoding part of Mobile_UNet obtained in B1 with a depthwise separable convolution block;

B3,通过添加残差块的方法改进UNet具体为:B3, improving UNet by adding residual blocks is as follows:

在B1中获得的Mobile_UNet中添加两个并行残差块,第一个残差块由一个3×3的深度可分离卷积块组成,第二个残差块由两个串行的膨胀率分别为2和3的空卷积块组成。Add two parallel residual blocks to Mobile_UNet obtained in B1, the first residual block consists of a 3×3 depthwise separable convolutional block, and the second residual block consists of two serial dilation rates respectively consists of 2 and 3 empty convolution blocks.

图5为实施例提供的经改进UNet分割后的图像。图5所示,输出图像大小与原图像相同,图像中只有黑白两色,白色为识别出的肺实质区域。图6为实施例提供的后期处理后的分割图像。图6所示,经改进UNet分割后的结果做后期处理,除去连通区域面积小于认定为肺实质区域面积1/5大小的部分,获得最终的肺部分割图像并计算肺部X光图像的分割准确度。FIG. 5 is an image segmented by the improved UNet provided by the embodiment. As shown in Figure 5, the output image has the same size as the original image, only black and white in the image, and white is the identified lung parenchyma area. FIG. 6 is a segmented image after post-processing provided by the embodiment. As shown in Figure 6, the result of the improved UNet segmentation is post-processed to remove the part of the connected area smaller than 1/5 of the area identified as the lung parenchyma area to obtain the final lung segmentation image and calculate the segmentation of the lung X-ray image Accuracy.

本发明的效果可以通过以下实验来进行验证:The effect of the present invention can be verified by the following experiments:

1.实验条件1. Experimental Conditions

在GPU为NVIDIA GeForce 930M,WINDOWS 10系统上配置实验环境,如表1所示。The GPU is NVIDIA GeForce 930M, and the experimental environment is configured on the WINDOWS 10 system, as shown in Table 1.

表1实验环境设置Table 1 Experimental environment settings

环境surroundings 版本Version AnacondaAnaconda 4.7.124.7.12 PyhtonPython 3.7.43.7.4 Tensorflow-GPUTensorflow-GPU 1.13.21.13.2 CudaCuda 10.010.0 CudnnCudnn 7.4.1.57.4.1.5 VSCodeVSCode 1.56.21.56.2

2.实验内容2. Experiment content

分别利用改进UNet和UNet对同一测试数据分割,将处理后的图像输入到训练好的分割模型中,图像尺寸为192*192*3。实验结果显示改进后的UNet分割精度有一定提升,由UNet97.98%的分割精度提升至98.06%。Segment the same test data with improved UNet and UNet respectively, and input the processed image into the trained segmentation model with an image size of 192*192*3. The experimental results show that the improved UNet segmentation accuracy has a certain improvement, from the UNet 97.98% segmentation accuracy to 98.06%.

本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明权利要求的保护范围之内。The above-mentioned embodiments of the present invention are only examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those of ordinary skill in the art, changes or modifications in other different forms can also be made on the basis of the above description. There is no need and cannot be exhaustive of all implementations here. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the claims of the present invention.

Claims (2)

1. A lung X-ray image segmentation method based on UNet is characterized by comprising the following steps:
s1, preprocessing the lung X-ray image in the Kaggle data set to obtain a training set;
s2, constructing an improved UNet frame by using a method of transfer learning, changing a convolution mode and adding a residual block;
s3, taking the training sample obtained in the step S1 and the lung X-ray segmentation image in the Kaggle data set as input data of the improved UNet, and training an improved UNet segmentation model;
s4, introducing the lung X-ray image test data to be segmented into a trained improved UNet model to obtain a segmented result;
s5, performing post-processing on the segmented result to obtain a final segmented result;
in step S1, the original X-ray lung image is preprocessed by using image edge filling, gaussian filtering, contrast-limited region histogram equalization CLAHE and data enhancement methods, where the preprocessing method specifically includes:
a1, expanding the original lung X-ray image and the corresponding tag image into a square image according to the length and width of the image, specifically:
when the length and the width of an original lung X-ray image are different, adding pixel points with the pixel value of 0 to ensure that the width and the length of the image are the same, thereby obtaining the lung X-ray image after edge filling and a label image corresponding to the lung X-ray image;
a2, performing Gaussian filtering on the original lung image processed in the A1 to obtain a denoised lung X-ray image, wherein a Gaussian kernel is a Gaussian template matrix with a standard deviation of 1 and a size of 3 multiplied by 3;
a3, making CLAHE on the processed image in A2 to obtain a lung X-ray image with high contrast, wherein the number of small areas divided by the image is 8 multiplied by 8, and the trimming limit system is 2% of the sum of pixel values of all pixel points of the image;
a4, performing data enhancement on the lung X-ray image processed in the A3 and the tag image processed in the a1 specifically:
the lung X-ray images processed in A3 and the label images processed in A1 are in one-to-one correspondence to form a data set N1, the images and labels in N1 are turned over up and down to obtain a data set N2, and the data sets N3 and N4 are obtained through two rotations with angle values of angle1 and angle2, wherein the data sets N3 and N4 are obtained
Figure FDA0003696763520000011
Finally, taking a data set composed of N1, N2, N3 and N4 as a data set for training the neural network;
in step S2, the method for constructing an improved UNet frame by using transfer learning, changing a convolution manner, and adding a residual block specifically includes:
b1, the concrete steps of improving UNet by using the transfer learning method are:
migrating a coding part of a MobileNet network model on the basis of a UNet segmentation model to obtain a Mobile _ UNet model; the coding part in the Mobile _ UNet model is 5 layers: the first layer comprises 2 convolution blocks convblock1 and convblock2, where convblock1 consists of 32 standard convolution cores of 2 steps and 3 × 3 size, and convblock2 consists of 64 depth separable convolution cores of 1 step and 3 × 3 size; the second layer comprises 2 convolution blocks convblock3 and convblock4, where convblock3 consists of 128 depth separable convolution kernels of size 3 x 3 with step size 2, convblock4 consists of 128 depth separable convolution kernels of size 3 x 3 with step size 1; the third layer comprises 2 convolution blocks convblock5 and convblock6, where convblock5 consists of 256 depth separable convolution cores of 2 steps and 3 × 3 size, and convblock6 consists of 256 depth separable convolution cores of 1 step and 3 × 3 size; the fourth layer comprises 6 convolution blocks convblock7-convblock12, wherein convblock7 is comprised of 512 depth-separable convolution kernels of step size 2 and size 3 × 3, and the remaining 5 convolution blocks are comprised of 512 depth-separable convolution kernels of step size 1 and size 3 × 3; the fifth layer comprises 2 convolution blocks convblock13-convblock14, where convblock13 consists of 1024 depth separable convolution kernels of step size 2 and size 3 × 3, and convblock14 consists of 1024 depth separable convolution kernels of step size 1 and size 3 × 3; the decoding part in the Mobile _ UNet model is 5 layers: the first four layers are all composed of an up-sampling module, a standard convolution module and a depth separable convolution module, the number of kernels in each module of each layer is (512, 512, 512), (256, 256, 256), (128, 128, 128), (64, 64, 64), and the kernel size is 3 x 3; the fifth layer comprises a block containing 2 volume blocks;
b2, the specific improvement of UNet by changing the convolution method is:
replacing the second convolution block of each layer in the decoded part of the Mobile _ UNet obtained in B1 with a depth separable convolution block;
b3, the method for improving UNet by adding residual block is specifically as follows:
two parallel residual blocks are added to the Mobile _ UNet obtained in B1, the first residual block consisting of a3 x 3 depth separable convolution block and the second residual block consisting of two consecutive empty convolution blocks with 2 and 3 expansion rates, respectively.
2. The UNet-based lung X-ray image segmentation method as claimed in claim 1, wherein the step S5 performs post-processing on the segmentation result obtained in S4, and the final segmentation result is specifically:
and performing post-processing on the segmented picture in the step S4, removing a part of the connected region with the area smaller than the size of the lung parenchymal region 1/5, obtaining a final lung segmentation image and calculating the segmentation accuracy of the lung X-ray image.
CN202110589697.0A 2021-05-28 2021-05-28 A UNet-based method for lung X-ray image segmentation Expired - Fee Related CN113223021B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110589697.0A CN113223021B (en) 2021-05-28 2021-05-28 A UNet-based method for lung X-ray image segmentation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110589697.0A CN113223021B (en) 2021-05-28 2021-05-28 A UNet-based method for lung X-ray image segmentation

Publications (2)

Publication Number Publication Date
CN113223021A CN113223021A (en) 2021-08-06
CN113223021B true CN113223021B (en) 2022-07-22

Family

ID=77099035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110589697.0A Expired - Fee Related CN113223021B (en) 2021-05-28 2021-05-28 A UNet-based method for lung X-ray image segmentation

Country Status (1)

Country Link
CN (1) CN113223021B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114088757B (en) * 2021-11-17 2024-10-01 北京市农林科学院 Heavy metal element content detection method based on elastic network regression

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840471A (en) * 2018-12-14 2019-06-04 天津大学 A kind of connecting way dividing method based on improvement Unet network model
CN110490858A (en) * 2019-08-21 2019-11-22 西安工程大学 A kind of fabric defect Pixel-level classification method based on deep learning
CN111739034A (en) * 2020-06-28 2020-10-02 北京小白世纪网络科技有限公司 Coronary artery region segmentation system and method based on improved 3D Unet
CN112258514A (en) * 2020-11-20 2021-01-22 福州大学 A segmentation method of pulmonary blood vessels in CT images
CN112651979A (en) * 2021-01-11 2021-04-13 华南农业大学 Lung X-ray image segmentation method, system, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10691978B2 (en) * 2018-06-18 2020-06-23 Drvision Technologies Llc Optimal and efficient machine learning method for deep semantic segmentation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840471A (en) * 2018-12-14 2019-06-04 天津大学 A kind of connecting way dividing method based on improvement Unet network model
CN110490858A (en) * 2019-08-21 2019-11-22 西安工程大学 A kind of fabric defect Pixel-level classification method based on deep learning
CN111739034A (en) * 2020-06-28 2020-10-02 北京小白世纪网络科技有限公司 Coronary artery region segmentation system and method based on improved 3D Unet
CN112258514A (en) * 2020-11-20 2021-01-22 福州大学 A segmentation method of pulmonary blood vessels in CT images
CN112651979A (en) * 2021-01-11 2021-04-13 华南农业大学 Lung X-ray image segmentation method, system, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Building segmentation with Inception-Unet and classical methods;İbrahim Delibaşoğlu 等;《2020 28th Signal Processing and Communications Applications Conference (SIU)》;20210107;第1-2页 *
基于深度学习的甲状腺超声图像自动分割方法研究;魏凤芹;《中国优秀博硕士学位论文全文数据库(硕士)医药卫生科技辑》;20210115(第1期);第E060-80页 *

Also Published As

Publication number Publication date
CN113223021A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN109389552B (en) Image super-resolution algorithm based on context-dependent multitask deep learning
WO2020192704A1 (en) Image processing model training method, image processing method and device, and storage medium
CN115661144B (en) Adaptive medical image segmentation method based on deformable U-Net
CN110580680B (en) Face super-resolution method and device based on combined learning
CN106228512A (en) Based on learning rate adaptive convolutional neural networks image super-resolution rebuilding method
CN111080591A (en) Medical image segmentation method based on combination of coding and decoding structure and residual error module
CN105654448A (en) Image fusion method and system based on bilateral filter and weight reconstruction
CN108734169A (en) One kind being based on the improved scene text extracting method of full convolutional network
CN113066025B (en) An Image Dehazing Method Based on Incremental Learning and Feature and Attention Transfer
CN112200724A (en) Single-image super-resolution reconstruction system and method based on feedback mechanism
WO2021136368A1 (en) Method and apparatus for automatically detecting pectoralis major region in molybdenum target image
CN111783494A (en) Recovery method of damaged two-dimensional code with convolutional autoencoder combined with binary segmentation
CN116563204A (en) A Medical Image Segmentation Method Fused with Multi-Scale Residual Attention
CN111724401A (en) An Image Segmentation Method and System Based on Boundary Constrained Cascade U-Net
CN113724136B (en) Video restoration method, device and medium
CN105590296B (en) A kind of single-frame images Super-Resolution method based on doubledictionary study
CN113223021B (en) A UNet-based method for lung X-ray image segmentation
Mehta et al. Evrnet: Efficient video restoration on edge devices
CN108960281A (en) A kind of melanoma classification method based on nonrandom obfuscated data enhancement method
CN115376022B (en) Application of small target detection algorithm based on neural network in UAV aerial photography
CN117315336A (en) Pollen particle identification method, device, electronic equipment and storage medium
CN111028236A (en) A cancer cell image segmentation method based on multi-scale convolutional U-Net
CN110458849A (en) A Method of Image Segmentation Based on Feature Correction
CN114092494B (en) Brain MR image segmentation method based on super-pixel and full convolution neural network
CN116611995A (en) A Super-resolution Reconstruction Method of Handwritten Text Image Based on Deep Expanded Network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20220722