基于Mask R-CNN的遥感影像疏林地智能识别方法
Mask R-CNN-based intelligent identification of sparse woods from remote sensing images
责任编辑: 陈理
收稿日期: 2022-04-22 修回日期: 2022-05-16
基金资助: |
|
Received: 2022-04-22 Revised: 2022-05-16
作者简介 About authors
刁明光(1970-),男,博士,副教授,主要从事地学信息工程、软件工程研究。Email:
针对遥感影像疏林地提取方法少且精度不高,缺乏智能识别的数据集情况,提出了一套遥感影像疏林地智能识别方法。分别使用QGIS插件和Python语言对该方法进行实现,完成了数据集制作的环节,为模型训练提供了数据支撑; 通过特征提取生成特征图,在特征图中提取感兴趣区域(region of interest,ROI),通过池化操作(ROI align)对这些感兴趣区域进行过滤操作,减少因疏林地图像感兴趣区域过多而造成的内存消耗。实验表明,该方法可快速进行数据集制作,有效辅助遥感影像中疏林地的识别,使用基于Mask R-CNN的遥感影像疏林地智能识别方法对疏林地目标检测的均值平均准确率可以达到0.92。
关键词:
There are only a few low-accuracy methods available for the feature extraction of sparse woods from remote sensing images. Moreover, there is a lack of datasets for intelligent identification. This study proposed a method for intelligent information identification of sparse woods from remote sensing images. First, a dataset was created using QGIS and Python separately to provide data support for model training. Then, feature maps were generated through feature extraction, and then regions of interest (ROIs) were extracted from the feature maps. Subsequently, these ROIs were filtered through pooling operations (ROI align) to reduce the memory consumption caused by too many ROIs in the images. Experiments show that the method proposed in this study can create datasets quickly and facilitate the identification of sparse woods from remote sensing images. Moreover, the Mask R-CNN-based intelligent identification has a target detection mean average precision (MAP) of up to 0.92.
Keywords:
本文引用格式
刁明光, 刘勇, 郭宁博, 李文吉, 江继康, 王云霄.
DIAO Mingguang, LIU Yong, GUO Ningbo, LI Wenji, JIANG Jikang, WANG Yunxiao.
0 引言
在遥感影像中,疏林地是一种分布不均匀且背景复杂的地物,同时也是自然资源调查中的重点识别对象[1]。疏林地具有分布连续、面积大小不一,分布形状不规则等特点,其周围可能是耕地、水体或建筑用地。疏林地的这些特征,增加了在遥感影像中对其识别的难度。同时,用于自动识别的遥感影像疏林地数据集十分缺乏,其标注质量也难以得到保证。目前对遥感影像中疏林地进行识别存在的问题主要包括:
1 遥感影像疏林地数据集自动生成方法
数据是深度学习的基础,本文提出遥感影像疏林地数据集自动生成方法并以此制作后续实验需要的数据。遥感影像疏林地数据集的制作参照LabelMe来进行。数据集的制作流程分为数据加载、影像裁剪、标注文件生成和数据集组织结构调整4个过程,最终生成规范的遥感影像疏林地数据集,如图1所示。数据加载主要利用遥感影像疏林地数据集自动生成工具,添加遥感影像数据和相应的矢量数据,读取矢量信息。影像裁剪主要是通过遥感影像疏林地数据及自动制作工具进行栅格数据的裁剪工作。标注文件生成主要包括JSON数据生成和JSON文件解析2个步骤。
图1
图1
遥感影像疏林地数据集生成流程
Fig.1
Remote sensing image sparse woods dataset generation process
1.1 遥感影像疏林地数据集的自动生成工具
遥感影像疏林地数据集制作工具基于QGIS插件[13],采用Python语言实现。遥感影像疏林地数据集制作工具主要功能在于读取已有的影像和矢量文件、读取影像和矢量中的信息、完成影像裁剪和标注文件生成部分。在数据集工具的开发过程中,需要对输入数据的正确性和参数的完整性进行严格检查。根据建立的数据映射模型可以保证矢量信息与JSON数据转化的准确性。
1.2 遥感影像疏林地数据集原始图像的自动分割
遥感影像裁剪的流程主要包括数据加载、图斑信息读取、矩形绘制和图像裁剪4步。图斑信息读取是获取图斑的属性和地理坐标信息。从加载的矢量数据中读取图斑的属性表,之后根据图斑的编号进行遍历,在遍历的过程中,获取并保存图斑的几何重心坐标。由于疏林地类型的图斑都是不规则形状,因此采用求多边形中心的思路来计算图斑的几何重心: 首先把多边形划分成多个三角形,求每个三角形的重心和面积; 然后将二维多边形的面积作为权值,分别乘以对应重心坐标的X和Y值; 最后将求出的X和Y值的加权平均数除以总面积,就可以得到多边形的重心坐标。
由于本文采用的遥感影像在尺寸上超出了深度学习模型能接收的图像大小,需要对原图进行裁剪。根据模型的需要,以图斑的几何重心坐标为中心点,绘制边长为1 024像素的正方形,以绘制的正方形为掩模边界,在像素上对正方形范围内的遥感影像文件进行裁剪。经过以上步骤,即可实现遥感影像疏林地数据集中原始图像的生成。
1.3 遥感影像疏林地数据集标注文件的自动生成
标注文件的生成是制作遥感影像疏林地数据集的重要阶段。生成遥感影像疏林地标注文件的关键是建立矢量数据和JSON数据之间的映射关系,如表1所示。
表1 JSON数据与矢量数据映射关系
Tab.1
键名 | 值 | 说明 |
---|---|---|
version | LabelMe的版本号 | 可自动获取 |
flags | 标志 | 可为空 |
shape_label | 标签名,通常为类别名+编号 | 获取矢量信息中的类别,同一类别累加计数 |
shape_line_color | 线条颜色 | 可为空 |
shape_fill_color | 填充颜色 | 可为空 |
shape_points | 掩模各个顶点的相对坐标 | 计算图斑上各点与矩形框左上角的坐标差 |
shape_type | 掩模形状类型 | point(点)、line(线)、polygon(多边形) |
lineColor | 线条颜色 | 可为空 |
fillColor | 填充颜色 | 可为空 |
imagePath | 原图路径 | 裁剪后影像的路径 |
imageData | 64位值 | 图像转换 |
imageHeight | 原始图像的高度 | 图像信息中获取 |
imageWidth | 原始图像的宽度 | 图像信息中获取 |
本文分析LabelMe的标注方式,提取了生成JSON文件中标准的几何和类别信息,在编程中通常将其理解为对象,JSON对象是一个无序的“key-value”对集合: {"key1": obj,"key2": obj,"key3": obj,…}其中,key值必须为字符串类型(string),而value则可以为多种类型,且可以嵌套。
由于采用对象结构,只要建立矢量数据的属性信息和LabelMe生成的JSON文件中对应键值之间的映射模型,就可以完成根据矢量数据生成JSON文件的任务。
1.4 数据集自动生成结果
数据集生成结果自动存放在cv2_mask,JSON,labelme_JSON和pic等4个文件夹中。其中,cv2_mask文件夹存放掩模文件; JSON文件夹存放JSON文件; labelme_JSON文件夹存放解析JSON文件后生成的文件,其中每个子文件夹内包含5个文件: 原始影像文件img.png、标签类别信息文件info.yaml、掩模文件label.png、当前影像内的对应掩模类别文件label_names.txt、原图与掩模文件的可视化关系图文件label_viz.png; pic文件夹用来存放裁剪后的原始图像。数据集的自动生成结果验证了遥感影像疏林地数据集生成方法的可行性。
表2 不同数据集生成方法性能对比
Tab.2
数据集生成方法 | 数据源 | 数据量/ 个 | 耗时/ h |
---|---|---|---|
人工制作方法 | 自然资源林地遥感影像 | 9 156 | 1 008 |
矿山遥感监测实例分割数据集自动生成方法 | 自然资源林地遥感影像 | 9 156 | 96 |
遥感影像疏林地数据集自动生成方法 | 自然资源林地遥感影像 | 9 156 | 7.5 |
2 遥感影像疏林地智能识别模型
图2
图2
遥感影像疏林地智能识别模型框架
Fig.2
Framework for intelligent recognition model of remote sensing image sparse woods
首先通过特征提取生成特征图,然后在特征图中提取感兴趣区域(region of interest,ROI),再采用分类和回归的方法对这些候选ROI进行过滤操作,随后对这些ROI进行池化操作,最后进行分类、回归和分割掩模生成。其基本流程分为以下5个步骤进行: ①特征提取,首先将预处理后的图像输入到特征金字塔模型提取网络中,并将得到的特征图作为本模块的输出; ②池化操作,对上一步获得的特征图进行池化操作(ROI align); ③分类回归,在全连接层上对ROI进行分类和边界框回归操作,完成定位和分类任务; ④模型预测,使用另外一支全卷积神经网络(fully convolutional network,FCN)[16]进行像素级分割,最终在每一个目标上生成对应的二值蒙版数据; ⑤结果转换,将识别的目标类别转换为矢量属性,分析并设计栅格数据转矢量数据的方法,为二值蒙版图转换为矢量图斑提供方法依据。
2.1 特征提取
遥感影像疏林地智能识别方法采用特征金字塔网络,将图像输入后,通过特征提取网络即可得到特征图。
1)自下而上的路径。以ResNet[17]为骨干网络,根据特征图的尺寸分为5个阶段,其中由于第1阶段需要耗费大量内存不进行使用,第2—5阶段分别为{C2,C3,C4,C5},相对于原始图像的步长分别为{4,8,16,32},每个阶段的残差模块都将作为下一阶段的输入。
2)自上而下的路径和从左到右的侧向连接。自上而下的路径是从最高层开始进行下采样,这里下采样采用的是最邻近下采样。从左到右的侧向连接将下采样的结果和自下而上路径中生成的特征图进行融合,即{C2,C3,C4,C5}中的每一层都使用1×1的卷积(Conv)操作后和下采样生成的特征图进行相加操作,它们具有相同的尺寸; 在融合后再使用3×3的卷积对融合特征进行处理(消除上采样产生的混叠效应)。
3)最终生成了特征图集合{P2,P3,P4,P5,P6}。网络结构如图3所示。
图3
2.2 特征图的池化操作
一般的池化方法依然存在着一些问题,比如在计算时存在小数的情况,此时就需要进行取整操作,但是取整就容易造成误差。ROI align[18]方法提出了不对池化值进行取整,如果在计算中得到小数,也就是没有落到真实的像素上,那么就用最近的像素对得到的虚拟的像素进行双线性插值,最终得到这个像素的值。
图4
2.3 分类回归及模型预测
遥感影像疏林地智能识别模型的预测主要包括3个部分: 分类、定位和分割。它主要利用Mask R-CNN网络定位原始图像中的ROI(即训练结果所考虑的目标),标记分类标签,分割二值蒙版,如图5所示,其中“LD”是通过预测生成的分类标签; 虚线边框是用于定位的回归框; 绿色掩模部分是通过预测生成的用于分割的二值蒙版。在图像中生成二值蒙版可以有效地识别目标区域,并为矢量图斑的生成提供数据。
图5
图5
遥感影像疏林地智能识别模型结果转换效果
Fig.5
Conversion effect of remote sensing image sparse woods intelligent recognition model result
2.4 遥感影像疏林地识别结果转换
为了实现对遥感影像疏林地智能识别结果的编辑,结合常见的编辑格式以及遥感数据处理的方法,对识别结果的转换方法进行了分析研究。
结合常用的栅格转矢量的步骤,设计遥感影像疏林地智能识别模型识别结果转换的流程: ①数据输入,即将原始影像和二值蒙版输入,读取原始影像中的地理坐标信息; ②创建相同坐标系下的矢量文件,用来存储图斑数据,并对矢量创建属性“类别”,记录识别结果的标签; ③读取二值蒙版图像,获取二值蒙版内各个顶点的相对坐标,使用原始图像的仿射信息进行像素坐标到地理坐标的转换,完成提取边界线的步骤; ④利用转换后的坐标,生成多边形,并添加到矢量文件中,根据识别结果显示的标签为“类别”赋值。通过以上4个步骤实现对所识别结果的转换。
3 遥感影像疏林地智能识别实验
遥感影像疏林地智能识别方法流程如图6所示,该流程从数据集制作开始,以输出矢量数据为结束,可以分为4个步骤: 数据集制作、模型训练、模型测试、结果转换。其中数据集制作使用的是第1章介绍的遥感影像疏林地数据集自动生成方法,模型训练及测试使用的是第2章介绍的遥感影像疏林地智能识别模型。
图6
图6
遥感影像疏林地智能识别方法框架
Fig.6
Framework of intelligent identification method for sparse woods from remote sensing image
3.1 数据集介绍
本文中选用的数据来自于雄安新区高空间分辨率卫星遥感数据,如图7所示,为经过专业人员解译的包含疏林地的遥感影像及其矢量数据[19],本文将利用此类遥感影像使用本文提出的遥感影像疏林地数据集自动生成方法制作数据集。由于Mask R-CNN实例分割模型对输入数据的尺寸有一定的要求,必须是64的倍数,同时考虑到选用的影像中疏林地的特征并不具有一致性,且形状大小不一,尤其是有呈带状的样本存在,该数据集在制作过程中将样本尺寸设置为1 024×1 024像素,将已经由专业人员“解译”的遥感影像数据和矢量文件放入数据集制作工具,数据集的制作依赖于遥感影像疏林地数据集自动生成工具,最终获得的数据集为9 156个样本数据,一个类别,即疏林地。
图7
图7
疏林地遥感数据局部影像和矢量数据
Fig.7
Remote sensing data local image and vector data of sparse woods
3.2 实验环境
遥感影像疏林地智能识别模型的运行需要有一定的硬件和软件支持,本文中关于模型的相关流程都是在Centos7操作系统下进行的,模型的训练和测试的硬件环境为: 1个Tesla GPU、16 G显存、10个Intel CPU和40 G内存。软件环境主要包括使用的编译器、语言和主要的函数库。根据对各种数据划分方法的分析结果,在结合已有的遥感影像疏林地数据集,本文中将采用留出法,由于硬件的限制,将从已有的9 156个样本中筛选出1 000个样本用来划分训练集和验证集,测试集则从未参与训练和验证的剩余数据中选择; 除去数据集之外,学习率和迭代次数等参数的设置也会对训练结果产生影响,在训练中设置初始的学习率为0.01。
3.3 评价指标
基于Mask R-CNN的遥感影像疏林地智能识别模型的识别能力通过均值平均精确度(mean average precision,MAP)来进行模型总体评价。MAP的值就是计算多个验证样本的平均精确度。计算MAP所需的准确率A、精确率P、召回率R都需要用到混淆矩阵。其中,准确率表示预测为疏林地的样本占总样本的百分比,精确率表示被预测为疏林地的样本中实际为疏林地样本的百分比,召回率表示实际为疏林地的样本被预测为疏林地的百分比,计算公式分别为:
式中: TP为正类判定为正类,即识别中疏林地被识别为疏林地的样本数; FP为负类判定为正类,即识别中背景类判定为疏林地的样本数; FN为正类判定为负类,即应为疏林地的要素未被识别出来的样本数; TN为负类判定为负类,即背景类被识别为背景类的样本数。
4 结果与分析
所设计的模型性能识别能力可以由实验中得到的损失函数表示,如图8所示。从图8中可以看出其损失值(epoch_loss)随着epoch次数(epoch_times)逐渐降低,最终基本稳定在0.5左右,因此推断训练结果与epoch次数有一定的关系。选用epoch_times为10处的训练权重文件对测试数据集进行识别测试,其结果显示如图9所示,图9(a)和(b)分别为根据遥感影像疏林地数据集自动生成方法裁剪出的原始图像和掩模数据,图9(c)为最终的识别结果,图中颜色遮掩部分为识别的二值蒙版图,外边框是目标检测结果,一个边框代表着识别出的一块疏林地。虽然识别的结果存在误差,但也体现了训练结果的泛化能力。
图8
图9
图10
图11
实验中呈现的结果证明遥感影像疏林地智能识别模型具有一定的泛化能力。但是由于在实验中未进行严格的变量控制,并不能证明数据集的数量对模型性能的影响,但是可以从模型训练过程中损失函数的变化曲线可以证明损失函数随着迭代次数逐步降低,当迭代次数达到一定量时,损失函数可以达到1.0以下,模型的识别能力也随之增强。
5 结论
在已有的遥感影像疏林地数据的基础上,根据遥感影像疏林地数据集自动制作方法,生成遥感影像疏林地数据集,极大地减少了数据集制作的时间,降低了数据集制作成本。本文提出的遥感影像疏林地智能识别方法对疏林地进行了测试,通过基于Mask R-CNN的遥感影像疏林地智能识别模型,对遥感影像疏林地数据集进行网络智能识别,实验结果表明: 针对遥感影像疏林地数据,本文构建的遥感影像疏林地智能识别方法可以进行良好的识别,证明了遥感影像疏林地智能识别方法的可行性。尽管本文方法对遥感影像疏林地识别效果较好,但仍存在以下问题:
1)在数据预处理方面,本文采用的是第一季度的疏林地遥感数据,影像中一些农田和疏林地的边界模糊,导致识别结果中存在边界不完整的情况,因此在数据预处理方面还需要进一步增强。
2)相比于其他自然场景下要素的识别,遥感影像疏林地的识别精度相对较低,尤其是一些带状的疏林地影像,识别结果存在破碎的情况,如何提高遥感影像疏林地的识别精度还有待进一步的研究。
参考文献
The pascal visual object classes challenge:A retrospective
[J].DOI:10.1007/s11263-014-0733-5 URL [本文引用: 2]
Microsoft COCO:Common objects in context
[J].
ImageNet classification with deep convolutional neural networks
[J].
DOI:10.1145/3065386
URL
[本文引用: 1]
We trained a large, deep convolutional neural network to classify the 1.2 million high-resolution images in the ImageNet LSVRC-2010 contest into the 1000 different classes. On the test data, we achieved top-1 and top-5 error rates of 37.5% and 17.0%, respectively, which is considerably better than the previous state-of-the-art. The neural network, which has 60 million parameters and 650,000 neurons, consists of five convolutional layers, some of which are followed by max-pooling layers, and three fully connected layers with a final 1000-way softmax. To make training faster, we used non-saturating neurons and a very efficient GPU implementation of the convolution operation. To reduce overfitting in the fully connected layers we employed a recently developed regularization method called \"dropout\" that proved to be very effective. We also entered a variant of this model in the ILSVRC-2012 competition and achieved a winning top-5 test error rate of 15.3%, compared to 26.2% achieved by the second-best entry.
DOTA:A large-scale dataset for object detection in aerial images
[C]//
高分辨率遥感影像线状地物提取方法研究
[J].
Research on the extraction method of line features from high-resolution remote sensing images
[J].
基于GF-1号影像的南方水稻种植信息提取
[J].
Information extraction of southern rice planting based on GF-1 image
[J].
基于面向对象的无人机遥感影像荒漠植被分类
[J].
Desert vegetation classification based on object-oriented UAV remote sensing images
[J].
DOI:10.13304/j.nykjdb.2020.0851
[本文引用: 1]
The sparse distribution and small leaf area of desert vegetation lead to the weak vegetation spectral characteristics in the image, which makes the classification difficult. In order to improve the accuracy of desert vegetation classification, the Gurbantunggut Desert was selected as the research area, the remote sensing image and digital surface model of drones were used as data sources, and the object-oriented random forest algorithm was used to enhance the basis of decorrelation stretched spectral information, and then analyze the change of classification accuracy before and after the correlation stretching. The results showed that: the overall classification accuracy of slightly, moderately and seriusly desertified areas based on decorrelation stretching combined with object-oriented and random forest algorithm was 91.01%, 95.34% and 93.18%, respectively, which was 19.94%, 16.10% and 17.61% higher than the original image classification accuracy. This study realized the high-precision classification of desert vegetation, and provided reference for obtaining the distribution of desert vegetation and desertification monitoring test.
基于面向对象分类法的贵州烤烟种植区域提取——以烤烟成熟期为例
[J].
Extraction of roasted tobacco growing areas in Guizhou based on object-oriented classification method:Taking roasted tobacco maturity period as an example
[J].
Object detection in optical remote sensing images:A survey and a new benchmark
[J].DOI:10.1016/j.isprsjprs.2019.11.023 URL [本文引用: 1]
基于深度学习的无人机遥感影像水体识别
[J].
Deep learning based UAV remote sensing image water body identification
[J].
基于深度学习的高分辨率遥感影像建筑物提取方法
[J].
A high-resolution remote sensing image building extraction method based on deep learning
[J].
矿山遥感监测实例分割数据集的自动生成方法
[J].
Automatic generation method of instance segmentation data set in mine remote sensing monitoring
[J].
EPANET in QGIS framework:The QEPANET plugin
[J].
DOI:10.2166/aqua.2019.087
URL
[本文引用: 1]
In the current era, the digitization of geographical data is a transverse need of several engineering sectors, including the hydraulic networks management. Thus, water supply systems' modelling requires adequate tools in both the digitization and the simulation phases. This paper presents the QEPANET plugin, which aims at merging the flexibility of QGIS and the robustness of EPANET hydraulic simulations software. Several editing and graphical tools available with QEPANET are introduced to model new and existing water distribution systems, to read and modify existing text-based EPANET files, to run simulations and visualize results in a geo-referenced framework. In addition, an application is illustrated to underline the novelty and the practical functionality of the presented tool, such as 3D pipe lengths' automatic calculation and the supporting functionalities for the network drawing. The plugin is available via the official QGIS Python Plugins Repository and on the world-wide-web at https://gitlab.com/albertodeluca/qepanet.
A loss-balanced multi-task model for simultaneous detection and segmentation
[J].DOI:10.1016/j.neucom.2020.11.024 URL [本文引用: 1]
Mask R-CNN
[J].
DOI:10.1109/TPAMI.2018.2844175
PMID:29994331
[本文引用: 1]
We present a conceptually simple, flexible, and general framework for object instance segmentation. Our approach efficiently detects objects in an image while simultaneously generating a high-quality segmentation mask for each instance. The method, called Mask R-CNN, extends Faster R-CNN by adding a branch for predicting an object mask in parallel with the existing branch for bounding box recognition. Mask R-CNN is simple to train and adds only a small overhead to Faster R-CNN, running at 5 fps. Moreover, Mask R-CNN is easy to generalize to other tasks, e.g., allowing us to estimate human poses in the same framework. We show top results in all three tracks of the COCO suite of challenges, including instance segmentation, bounding-box object detection, and person keypoint detection. Without bells and whistles, Mask R-CNN outperforms all existing, single-model entries on every task, including the COCO 2016 challenge winners. We hope our simple and effective approach will serve as a solid baseline and help ease future research in instance-level recognition. Code has been made available at: https://github.com/facebookresearch/Detectron.
Fully convolutional network with attention modules for semantic segmentation
[J].DOI:10.1007/s11760-020-01828-8 [本文引用: 1]
ResNet based on feature-inspired gating strategy
[J].DOI:10.1007/s11042-021-10802-6 [本文引用: 1]
An optimized faster R-CNN method based on DRNet and RoI align for building detection in remote sensing images
[J].
DOI:10.3390/rs12050762
URL
[本文引用: 1]
In recent years, the increase of satellites and UAV (unmanned aerial vehicles) has multiplied the amount of remote sensing data available to people, but only a small part of the remote sensing data has been properly used; problems such as land planning, disaster management and resource monitoring still need to be solved. Buildings in remote sensing images have obvious positioning characteristics; thus, the detection of buildings can not only help the mapping and automatic updating of geographic information systems but also have guiding significance for the detection of other types of ground objects in remote sensing images. Aiming at the deficiency of traditional building remote sensing detection, an improved Faster R-CNN (region-based Convolutional Neural Network) algorithm was proposed in this paper, which adopts DRNet (Dense Residual Network) and RoI (Region of Interest) Align to utilize texture information and to solve the region mismatch problems. The experimental results showed that this method could reach 82.1% mAP (mean average precision) for the detection of landmark buildings, and the prediction box of building coordinates was relatively accurate, which improves the building detection results. Moreover, the recognition of buildings in a complex environment was also excellent.
基于遥感的雄安新区地表水时序变化与区域规划研究
[J].
Research on time series changing trend of surface water and regional planning in Xiong’an New Area based on remote sensing
[J].
/
〈 |
|
〉 |
