CN117292278A - Digital orchard fruit tree positioning method, device, equipment and medium - Google Patents
Digital orchard fruit tree positioning method, device, equipment and medium Download PDFInfo
- Publication number
- CN117292278A CN117292278A CN202311278741.1A CN202311278741A CN117292278A CN 117292278 A CN117292278 A CN 117292278A CN 202311278741 A CN202311278741 A CN 202311278741A CN 117292278 A CN117292278 A CN 117292278A
- Authority
- CN
- China
- Prior art keywords
- fruit tree
- litchi
- orchard
- remote sensing
- tree
- 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.)
- Pending
Links
- 235000013399 edible fruits Nutrition 0.000 title claims abstract description 435
- 239000002420 orchard Substances 0.000 title claims abstract description 121
- 238000000034 method Methods 0.000 title claims abstract description 43
- 230000011218 segmentation Effects 0.000 claims abstract description 109
- 241001629511 Litchi Species 0.000 claims abstract description 88
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 22
- 238000012549 training Methods 0.000 claims description 37
- 230000006870 function Effects 0.000 claims description 30
- 238000004590 computer program Methods 0.000 claims description 10
- 238000003860 storage Methods 0.000 claims description 10
- 238000012795 verification Methods 0.000 claims description 10
- 238000000605 extraction Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 7
- 239000000575 pesticide Substances 0.000 claims description 7
- 238000001514 detection method Methods 0.000 claims description 6
- 238000005507 spraying Methods 0.000 claims description 6
- 238000013519 translation Methods 0.000 claims description 6
- 241000607479 Yersinia pestis Species 0.000 claims description 5
- 230000008859 change Effects 0.000 claims description 5
- 230000004927 fusion Effects 0.000 claims description 3
- 238000011176 pooling Methods 0.000 claims description 3
- 230000002265 prevention Effects 0.000 claims description 3
- 238000012876 topography Methods 0.000 claims 5
- 238000002372 labelling Methods 0.000 claims 3
- 238000010276 construction Methods 0.000 claims 1
- 230000003993 interaction Effects 0.000 claims 1
- 238000012216 screening Methods 0.000 claims 1
- 238000012163 sequencing technique Methods 0.000 claims 1
- 244000183278 Nephelium litchi Species 0.000 abstract description 146
- 235000015742 Nephelium litchi Nutrition 0.000 abstract description 146
- 238000013527 convolutional neural network Methods 0.000 description 11
- 238000012545 processing Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 9
- 238000011161 development Methods 0.000 description 9
- 230000018109 developmental process Effects 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 238000012271 agricultural production Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 2
- 201000010099 disease Diseases 0.000 description 2
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 239000002689 soil Substances 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000035558 fertility Effects 0.000 description 1
- 239000003337 fertilizer Substances 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 238000011478 gradient descent method Methods 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000013526 transfer learning Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/10—Terrestrial scenes
- G06V20/17—Terrestrial scenes taken from planes or by drones
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
- G06N3/0442—Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/757—Matching configurations of points or features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/766—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using regression, e.g. by projecting features on hyperplanes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Multimedia (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Life Sciences & Earth Sciences (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Remote Sensing (AREA)
- Image Analysis (AREA)
Abstract
本申请涉及一种数字果园果树定位方法、装置、设备及介质,所述方法包括:将Mask R‑CNN模型中的骨干网络更新为Swin‑Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述Mask R‑CNN模型中,以构建果树图像实例分割模型;将荔枝果树的荔枝果树遥感图像输入至训练好的果树图像实例分割模型进行实例分割,确定果树分割结果,基于果树识别模型识别果树分割结果的荔枝果树遥感图像,确定荔枝果树遥感图像中荔枝果树的数量以及像素坐标;基于数字地形图确定果树的全球定位系统坐标;基于匹配算法将荔枝果树遥感图像中荔枝果树的数量以及像素坐标与荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定荔枝果树的位置。本申请能够节约成本,无需安装定位装置。
This application relates to a digital orchard fruit tree positioning method, device, equipment and medium. The method includes: updating the backbone network in the Mask R-CNN model to a Swin-Transformer network, and converting the Hybrid Task Cascade architecture into a The detector is embedded into the Mask R-CNN model to build a fruit tree image instance segmentation model; input the lychee fruit tree remote sensing image of the lychee fruit tree into the trained fruit tree image instance segmentation model for instance segmentation, and determine the fruit tree segmentation result, based on the fruit tree The recognition model identifies the lychee fruit tree remote sensing image of the fruit tree segmentation result, determines the number and pixel coordinates of the lychee fruit tree in the lychee fruit tree remote sensing image; determines the global positioning system coordinates of the fruit tree based on the digital terrain map; uses the matching algorithm to classify the lychee fruit tree in the litchi fruit tree remote sensing image. The quantity and pixel coordinates are paired with the global positioning system coordinates of the lychee trees in the orchard digital terrain map to determine the location of the lychee trees. This application can save costs and eliminates the need to install a positioning device.
Description
技术领域Technical field
本申请涉及农业生产领域,尤其涉及一种数字果园果树定位方法、相应的装置、电子设备及计算机可读存储介质。The present application relates to the field of agricultural production, and in particular to a digital orchard fruit tree positioning method, corresponding devices, electronic equipment and computer-readable storage media.
背景技术Background technique
荔枝园是一个复杂的生态系统,受生态环境、天气、地形、土壤、病虫害、栽培技术等多种影响树木生长的因素影响。传统果园水、肥、农药管理全靠经验,人为因素占主导地位,管理粗放、效率低下。传统果园很少使用信息化工具进行精准管理,不收集生产数据来了解树木必要的生长数据。传统果园为提高产量,多采用改良品种、提高地力、加强传统病虫害防治,耗费人力和农业资源,但产量和荔枝品质仍存在不确定性。传统果园模式已不能满足现代果园发展要求,将传统果园升级为智慧果园是果园发展的必由之路。果业在我国农村经济发展中占有重要地位,但果园生产管理整体水平与国际先进水平相比仍有差距,尤其是在数字化、信息化、智能化管理技术方面。因此,有必要系统总结数字果园研究取得的进展,进一步明确未来的发展方向,为信息化、智能化果园的发展提供技术支撑。The litchi orchard is a complex ecosystem that is affected by many factors that affect tree growth, such as ecological environment, weather, terrain, soil, pests and diseases, and cultivation techniques. Traditional orchard water, fertilizer, and pesticide management relies entirely on experience, with human factors dominating the field, resulting in extensive management and low efficiency. Traditional orchards rarely use information tools for precise management, and do not collect production data to understand the necessary growth data of trees. In order to increase yields, traditional orchards often use improved varieties, increase soil fertility, and strengthen traditional pest and disease control, which consumes manpower and agricultural resources. However, there are still uncertainties in yield and lychee quality. The traditional orchard model can no longer meet the development requirements of modern orchards. Upgrading traditional orchards to smart orchards is the only way for orchard development. The fruit industry occupies an important position in my country's rural economic development, but the overall level of orchard production management still lags behind the international advanced level, especially in terms of digitalization, informatization, and intelligent management technology. Therefore, it is necessary to systematically summarize the progress made in digital orchard research, further clarify the future development direction, and provide technical support for the development of informatized and intelligent orchards.
近年来,随着深度学习技术的发展,无人机遥感与计算机视觉技术广泛应用在农业生产中。研究人员利用遥感图像的方法来实现果树的分割。例如,采用传统的机器学习方法,如分水岭算法、种子区域生长算法对果树进行分割。例如,采用语义分割的方法,如UNet将果树与背景分割开来。然而,关于数字果园地图的研究还比较少,朝着这一目标的进展还比较缓慢,其中也存在一些有待进一步解决的问题。例如,由于特征匹配错误、拼接边缘处理不当等问题,拼接图的中的树普遍存在模糊不清的情况,对后续树冠上相关信息的提取有很大影响。从原图像中获取冠层信息,但原图中不包含果树的位置信息,而为每棵树安装定位装置的方案,成本巨大。In recent years, with the development of deep learning technology, drone remote sensing and computer vision technology have been widely used in agricultural production. Researchers use remote sensing images to segment fruit trees. For example, traditional machine learning methods, such as watershed algorithm and seed region growing algorithm, are used to segment fruit trees. For example, semantic segmentation methods such as UNet are used to separate fruit trees from the background. However, there is still relatively little research on digital orchard maps, and progress towards this goal is still slow, and there are also some problems that need to be further solved. For example, due to problems such as feature matching errors and improper processing of splicing edges, the trees in the spliced image are generally ambiguous, which has a great impact on the subsequent extraction of relevant information on the tree crown. Canopy information is obtained from the original image, but the original image does not contain the location information of the fruit trees, and the solution of installing positioning devices for each tree is very costly.
综上所述,适应由于特征匹配错误、拼接边缘处理不当等问题,拼接图的中的树普遍存在模糊不清的情况,对后续树冠上相关信息的提取有很大影响;从原图像中获取冠层信息,但原图中不包含果树的位置信息,而为每棵树安装定位装置的方案,成本巨大等问题,本申请人出于解决该问题的考虑作出相应的探索。In summary, due to problems such as feature matching errors and improper processing of splicing edges, the trees in the spliced image are generally blurred, which has a great impact on the subsequent extraction of relevant information on the tree crown; obtained from the original image Canopy information, but the original image does not contain the location information of the fruit trees, and the solution of installing a positioning device for each tree has problems such as huge costs. The applicant has made corresponding explorations in order to solve this problem.
发明内容Contents of the invention
本申请的目的在于解决上述问题而提供一种数字果园果树定位方法、相应的装置、电子设备及计算机可读存储介质。The purpose of this application is to solve the above problems and provide a digital orchard fruit tree positioning method, corresponding devices, electronic equipment and computer-readable storage media.
为满足本申请的各个目的,本申请采用如下技术方案:In order to meet the various purposes of this application, this application adopts the following technical solutions:
适应本申请的目的之一而提出的一种数字果园果树定位方法,包括如下步骤:A digital orchard fruit tree positioning method proposed to meet one of the purposes of this application includes the following steps:
响应果园果树定位指令,获取果园中各个荔枝果树相对应的荔枝果树遥感图像;Respond to the orchard fruit tree positioning instructions and obtain remote sensing images of lychee fruit trees corresponding to each lychee fruit tree in the orchard;
将Mask R-CNN模型中的骨干网络更新为Swin-Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述Mask R-CNN模型中,以构建果树图像实例分割模型;Update the backbone network in the Mask R-CNN model to the Swin-Transformer network, and embed the Hybrid Task Cascade detector of the hybrid task cascade architecture into the Mask R-CNN model to build a fruit tree image instance segmentation model;
将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果,基于预设的果树识别模型识别所述果树分割结果相对应的荔枝果树遥感图像,确定所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标;The lychee fruit tree remote sensing image corresponding to the lychee fruit tree is input into the trained fruit tree image instance segmentation model for instance segmentation, the fruit tree segmentation result is determined, and the lychee corresponding to the fruit tree segmentation result is identified based on the preset fruit tree recognition model. Remote sensing images of fruit trees, determining the number and pixel coordinates of lychee fruit trees in the remote sensing images of lychee fruit trees;
构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标;Construct a digital topographic map of the orchard, and determine the global positioning system coordinates corresponding to each fruit tree based on the digital topographic map;
基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置,以完成数字果园中荔枝果树的定位。Based on the preset matching algorithm, the number and pixel coordinates of the lychee fruit trees in the remote sensing image of the lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital topographic map, and the corresponding position of the lychee fruit tree is determined. Complete the positioning of lychee fruit trees in the digital orchard.
可选的,训练所述果树图像实例分割模型的步骤,包括如下步骤:Optionally, the step of training the fruit tree image instance segmentation model includes the following steps:
标注所述荔枝果树相对应的荔枝果树遥感图像中荔枝果树部分以及其相对应的图片序号,以确定所述果树图像实例分割模型的训练集以及验证集;Mark the lychee fruit tree part in the lychee fruit tree remote sensing image corresponding to the lychee fruit tree and its corresponding picture serial number to determine the training set and verification set of the fruit tree image instance segmentation model;
根据所述训练集以及验证集对所述果树图像实例分割模型进行反向传播迭代训练,以使在每一次反向传播迭代训练中,根据标注后的所述荔枝果树相对应的荔枝果树遥感图像输入至所述果树图像实例分割模型所得到的预测框结果与实际标注结果的误差,计算目标损失函数;The fruit tree image instance segmentation model is subjected to back propagation iterative training based on the training set and the verification set, so that in each back propagation iterative training, the lychee fruit tree remote sensing image corresponding to the annotated lychee fruit tree is The error between the prediction box result and the actual annotation result obtained by inputting into the fruit tree image instance segmentation model is used to calculate the target loss function;
根据所述目标损失函数更新模型参数,直至所述目标损失函数的变化值小于预设阈值或训练次数大于预设次数之后,保存模型参数并完成所述果树图像实例分割模型的训练。The model parameters are updated according to the target loss function until the change value of the target loss function is less than the preset threshold or the number of training times is greater than the preset number, then the model parameters are saved and the training of the fruit tree image instance segmentation model is completed.
可选的,将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果的步骤,包括如下步骤:Optionally, the step of inputting the lychee fruit tree remote sensing image corresponding to the lychee fruit tree to the trained fruit tree image instance segmentation model for instance segmentation and determining the fruit tree segmentation result includes the following steps:
所述果树图像实例分割模型中的Swin-Transformer网络将输入的所述荔枝果树相对应的荔枝果树遥感图像划分为若干个大小相等的小块,对每个小块进行嵌入,以确定各个小块内的特征表示;The Swin-Transformer network in the fruit tree image instance segmentation model divides the input lychee fruit tree remote sensing image corresponding to the lychee fruit tree into several small blocks of equal size, and embeds each small block to determine each small block. Characteristic representation within;
采用多层平移窗口对各个小块进行自注意力计算,以将相邻的小块的特征进行信息交互;Multi-layer translation windows are used to perform self-attention calculations on each small patch to exchange information between the features of adjacent small patches;
基于多层平移窗口自注意力和MLP层进行特征提取,同时,在每个块的输出上进行多尺度特征融合;Feature extraction is performed based on multi-layer translation window self-attention and MLP layers, and at the same time, multi-scale feature fusion is performed on the output of each block;
将多个尺度的特征进行特征金字塔操作,采用全局池化和线性层进行分类输出。Perform feature pyramid operation on features at multiple scales, and use global pooling and linear layers for classification output.
可选的,将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果的步骤,包括如下步骤:Optionally, the step of inputting the lychee fruit tree remote sensing image corresponding to the lychee fruit tree to the trained fruit tree image instance segmentation model for instance segmentation and determining the fruit tree segmentation result includes the following steps:
所述果树图像实例分割模型中的所述Hybrid Task Cascade检测器采用Swin-Transformer网络作为主干网络,对输入的所述荔枝果树相对应的荔枝果树遥感图像进行特征提取;The Hybrid Task Cascade detector in the fruit tree image instance segmentation model uses the Swin-Transformer network as the backbone network to perform feature extraction on the input remote sensing image of the lychee fruit tree corresponding to the lychee fruit tree;
采用锚点框对所述荔枝果树遥感图像中的候选目标区域进行提取,将所述候选目标区域经过多级检测和分割头,以进行目标区域的检测和分割;An anchor point frame is used to extract the candidate target area in the litchi fruit tree remote sensing image, and the candidate target area is passed through a multi-level detection and segmentation head to detect and segment the target area;
对每个目标区域进行边界框的回归和实例分割掩码的预测;Perform bounding box regression and instance segmentation mask prediction for each target region;
对重叠的候选目标区域进行去重,以确定果树分割结果。Deduplication is performed on overlapping candidate target areas to determine the fruit tree segmentation results.
可选的,构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标的步骤,包括如下步骤:Optionally, the step of constructing a digital topographic map of the orchard and determining the global positioning system coordinates corresponding to each fruit tree based on the digital topographic map includes the following steps:
构建果园数字地形图,确定所述果园数字地形图中各个果树相对应的GPS信息以及高程信息;Construct a digital topographic map of the orchard, and determine the GPS information and elevation information corresponding to each fruit tree in the digital topographic map of the orchard;
将果园的数字地形图分块处理,采用果树识别模型对数字地形图子块进行识别以确定数字地形图子块识别结果;The digital topographic map of the orchard is processed into blocks, and the fruit tree recognition model is used to identify the sub-blocks of the digital topographic map to determine the recognition results of the sub-blocks of the digital topographic map;
对所述数字地形图子块识别结果进行数据拼接,确定果园中各个果树相对应的像素坐标;Perform data splicing on the digital terrain map sub-block recognition results to determine the corresponding pixel coordinates of each fruit tree in the orchard;
将果树像素坐标转换为各个果树相对应的全球定位系统坐标。Convert the pixel coordinates of the fruit trees into the global positioning system coordinates corresponding to each fruit tree.
可选的,基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置的步骤,包括如下步骤:Optionally, based on a preset matching algorithm, the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital topographic map to determine the corresponding lychee fruit tree. The steps for the location include the following steps:
计算所述荔枝果树遥感图像中荔枝果树的像素坐标到荔枝果树遥感图像中点的像素距离,并从近到远排序;Calculate the pixel distance from the pixel coordinates of the litchi fruit tree in the litchi fruit tree remote sensing image to the midpoint of the litchi fruit tree remote sensing image, and sort them from near to far;
将所述像素距转换为全球定位系统坐标距离,确定与荔枝果树遥感图像中果树数量相同的全球定位系统坐标;Convert the pixel distance into a global positioning system coordinate distance, and determine the global positioning system coordinates with the same number of fruit trees in the litchi fruit tree remote sensing image;
基于半正矢函数采用矢量角度对所述全球定位系统坐标进行对比筛选以配对荔枝果树的全球定位系统坐标,确定所述荔枝果树在数字果园中相对应的位置。Based on the semi-vector function, vector angles are used to compare and filter the global positioning system coordinates to match the global positioning system coordinates of the lychee fruit tree, and determine the corresponding position of the lychee fruit tree in the digital orchard.
可选的,基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置的步骤,包括如下步骤:Optionally, based on a preset matching algorithm, the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital topographic map to determine the corresponding lychee fruit tree. The steps for the location include the following steps:
响应农药喷洒指令,基于半正矢函数将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置;In response to the pesticide spraying instruction, the number and pixel coordinates of the lychee fruit trees in the remote sensing image of the lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map based on the semisine function to determine the corresponding lychee fruit tree. s position;
根据所述荔枝果树相对应的位置对荔枝果园中的各个荔枝果树进行农药喷洒,以完成荔枝果树的害虫预防。Pesticide spraying is performed on each lychee fruit tree in the lychee orchard according to the corresponding position of the lychee fruit tree to complete pest prevention of the lychee fruit trees.
适应本申请的另一目的而提供的一种数字果园果树定位装置,包括:A digital orchard fruit tree positioning device adapted to another purpose of this application includes:
图像获取模块,设置为响应果园果树定位指令,获取果园中各个荔枝果树相对应的荔枝果树遥感图像;The image acquisition module is configured to respond to the orchard fruit tree positioning instructions and acquire remote sensing images of lychee fruit trees corresponding to each lychee fruit tree in the orchard;
分割模型构建模块,设置为将Mask R-CNN模型中的骨干网络更新为Swin-Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述MaskR-CNN模型中,以构建果树图像实例分割模型;Segmentation model building module, set to update the backbone network in the Mask R-CNN model to a Swin-Transformer network, and embed the Hybrid Task Cascade detector of the hybrid task cascade architecture into the MaskR-CNN model to build a fruit tree Image instance segmentation model;
像素坐标确定模块,设置为将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果,基于预设的果树识别模型识别所述果树分割结果相对应的荔枝果树遥感图像,确定所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标;The pixel coordinate determination module is configured to input the litchi fruit tree remote sensing image corresponding to the litchi fruit tree into the trained fruit tree image instance segmentation model for instance segmentation, determine the fruit tree segmentation result, and identify the fruit tree based on the preset fruit tree recognition model. A remote sensing image of lychee fruit trees corresponding to the fruit tree segmentation result, and determining the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees;
全球定位坐标确定模块,设置为构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标;The global positioning coordinate determination module is configured to construct a digital terrain map of the orchard, and determine the global positioning system coordinates corresponding to each fruit tree based on the digital terrain map;
果树定位模块,设置为基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置,以完成数字果园中荔枝果树的定位。The fruit tree positioning module is configured to match the number and pixel coordinates of the lychee fruit trees in the remote sensing image of the lychee fruit trees with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map based on a preset matching algorithm to determine the lychee fruit tree. Corresponding positions to complete the positioning of lychee fruit trees in the digital orchard.
适应本申请的另一目的而提供的一种电子设备,包括中央处理器和存储器,所述中央处理器用于调用运行存储于所述存储器中的计算机程序以执行本申请所述数字果园果树定位方法的步骤。An electronic device adapted to another object of the present application is provided, including a central processor and a memory. The central processor is used to call and run a computer program stored in the memory to execute the digital orchard fruit tree positioning method described in the present application. A step of.
适应本申请的另一目的而提供的一种计算机可读存储介质,其以计算机可读指令的形式存储有依据所述数字果园果树定位方法所实现的计算机程序,该计算机程序被计算机调用运行时,执行相应的方法所包括的步骤。A computer-readable storage medium is provided to meet another object of the present application, which stores a computer program implemented according to the digital orchard fruit tree positioning method in the form of computer-readable instructions. The computer program is called and run by the computer. , execute the steps included in the corresponding method.
相对于现有技术,本申请针对由于特征匹配错误、拼接边缘处理不当等问题,拼接图的中的树普遍存在模糊不清的情况,对后续树冠上相关信息的提取有很大影响;从原图像中获取冠层信息,但原图中不包含果树的位置信息,而为每棵树安装定位装置的方案,成本巨大等问题,本申请包括不限于如下有益效果:Compared with the existing technology, this application aims at problems such as feature matching errors and improper processing of splicing edges. The trees in the spliced image are generally ambiguous, which has a great impact on the subsequent extraction of relevant information on the tree crown; from the original The canopy information is obtained from the image, but the original image does not contain the location information of the fruit trees, and the solution of installing a positioning device for each tree has problems such as huge costs. This application includes but is not limited to the following beneficial effects:
其一,本申请所提出的匹配算法,通过获取地图和无人机图像中果树的GPS信息进行匹配,无需安装定位装置,节约成本;First, the matching algorithm proposed in this application performs matching by obtaining the GPS information of fruit trees in maps and drone images, eliminating the need to install a positioning device and saving costs;
其二,本申请所提出的Swi n-CMN模型在荔枝树冠层分割上具有优越性,相较于其他网络具有更好的性能指标和分割效果;Secondly, the Swin-CMN model proposed in this application has superiority in lychee canopy segmentation, and has better performance indicators and segmentation effects than other networks;
其三,本申请所提出的数字果园果树定位方法,该方法能够将无人机拍摄图像中的高分辨率冠层对应到地图上的思想,从而提供荔枝树高分辨率的真实冠层信息,为后续的处理提供了极大的帮助。该方法准确度高、可重复性强,解决了传统果园管理粗放、效率低下的问题,为智慧果园的有效发展提供了有效的技术支持。Third, the digital orchard fruit tree positioning method proposed in this application can map the high-resolution canopy in the drone image to the map, thereby providing high-resolution real canopy information of the lychee tree. It provides great help for subsequent processing. This method has high accuracy and repeatability, solves the problems of extensive and low efficiency of traditional orchard management, and provides effective technical support for the effective development of smart orchards.
附图说明Description of drawings
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
图1为本申请实施例中数字果园果树定位方法的实现流程图;Figure 1 is a flow chart of the implementation of the digital orchard fruit tree positioning method in the embodiment of the present application;
图2为本申请实施例中数字果园果树定位方法的流程示意图;Figure 2 is a schematic flow chart of the digital orchard fruit tree positioning method in the embodiment of the present application;
图3为本申请实施例中Swi n-CMN模型的网络结构图;Figure 3 is a network structure diagram of the Swin-CMN model in the embodiment of this application;
图4为本申请实施例中对荔枝遥感图像进行实例分割的识别结果;Figure 4 is the recognition result of instance segmentation of litchi remote sensing images in the embodiment of the present application;
图5为本申请实施例中对果园地图进行识别的识别结果;Figure 5 is the recognition result of the orchard map recognition in the embodiment of the present application;
图6为本申请实施例中基于预设的匹配算法确定荔枝果树的位置的实现效果图;Figure 6 is an implementation rendering of determining the location of a lychee fruit tree based on a preset matching algorithm in an embodiment of the present application;
图7为本申请实施例中数字地图系统可视化的效果图;Figure 7 is a visual rendering of the digital map system in the embodiment of the present application;
图8为本申请实施例中数字果园果树定位装置的原理框图;Figure 8 is a functional block diagram of the digital orchard fruit tree positioning device in the embodiment of the present application;
图9为本申请实施例中的计算机设备的结构示意图。Figure 9 is a schematic structural diagram of a computer device in an embodiment of the present application.
具体实施方式Detailed ways
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present application and cannot be construed as limiting the present application.
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。Those skilled in the art will understand that, unless expressly stated otherwise, the singular forms "a", "an", "the" and "the" used herein may also include the plural form. It should be further understood that the word "comprising" used in the description of this application refers to the presence of stated features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components and/or groups thereof. It will be understood that when we refer to an element being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Additionally, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. As used herein, the term "and/or" includes all or any unit and all combinations of one or more of the associated listed items.
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本申请所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It should also be understood that terms, such as those defined in general dictionaries, are to be understood to have meanings consistent with their meaning in the context of the prior art, and are not to be used in an idealistic or overly descriptive manner unless specifically defined as here. to explain the formal meaning.
本技术领域技术人员可以理解,这里所使用的“客户端”、“终端”、“终端设备”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,进行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他诸如个人计算机、平板电脑之类的通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(PersonalCommunications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global PositioningSystem,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“客户端”、“终端”、“终端设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“客户端”、“终端”、“终端设备”还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。Those skilled in the art can understand that the "client", "terminal" and "terminal device" used here include both devices with wireless signal receivers, devices that only have wireless signal receivers without transmission capabilities, and A device with receiving and transmitting hardware capable of conducting two-way communications on a two-way communications link. Such devices may include: cellular or other communication devices such as personal computers and tablet computers, which have a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service, personal communication system) ), which can combine voice, data processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant, personal digital assistant), which can include a radio frequency receiver, pager, Internet/Intranet access, web browser, notepad , calendar and/or GPS (Global Positioning System, Global Positioning System) receiver; conventional laptop and/or handheld computer or other device having and/or including a conventional laptop and/or handheld radio frequency receiver computer or other device. As used herein, "client", "terminal" and "terminal device" may be portable, transportable, installed in a vehicle (air, sea and/or land), or adapted and/or configured to be used locally Operate, and/or operate in distributed form, at any other location on Earth and/or space. The "client", "terminal" and "terminal device" used here can also be communication terminals, Internet access terminals, music/video playback terminals, for example, they can be PDA, MID (Mobile Internet Device, mobile Internet device) and/or A mobile phone with music/video playback function can also be a smart TV, set-top box and other devices.
本申请所称的“服务器”、“客户端”、“服务节点”等名称所指向的硬件,本质上是具备个人计算机等效能力的电子设备,为具有中央处理器(包括运算器和控制器)、存储器、输入设备以及输出设备等冯诺依曼原理所揭示的必要构件的硬件装置,计算机程序存储于其存储器中,中央处理器将存储在外存中的程序调入内存中运行,执行程序中的指令,与输入输出设备交互,借此完成特定的功能。The hardware referred to by names such as "server", "client", and "service node" in this application are essentially electronic devices with equivalent capabilities to personal computers, and are equipped with a central processing unit (including arithmetic units and controllers). ), memory, input devices, output devices and other necessary components disclosed by the von Neumann principle. The computer program is stored in its memory. The central processor transfers the program stored in the external memory into the memory to run, and executes the program. The instructions in it interact with input and output devices to complete specific functions.
需要指出的是,本申请所称的“服务器”这一概念,同理也可扩展到适用于服务器机群的情况。依据本领域技术人员所理解的网络部署原理,所述各服务器应是逻辑上的划分,在物理空间上,这些服务器既可以是互相独立但可通过接口调用的,也可以是集成到一台物理计算机或一套计算机机群的。本领域技术人员应当理解这一变通,而不应以此约束本申请的网络部署方式的实施方式。It should be pointed out that the concept of "server" in this application can also be extended to the situation of server cluster. According to the network deployment principles understood by those skilled in the art, the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or they can be integrated into a physical server. of a computer or a cluster of computers. Those skilled in the art should understand this modification, but it should not limit the implementation of the network deployment method of the present application.
本申请的一个或数个技术特征,除非明文指定,既可部署于服务器实施而由客户端远程调用获取服务器提供的在线服务接口来实施访问,也可直接部署并运行于客户端来实施访问。Unless expressly specified, one or several technical features of this application can either be deployed on the server for implementation and the client remotely calls to obtain the online service interface provided by the server to implement access, or can be directly deployed and run on the client to implement access.
本申请中所引用或可能引用到的神经网络模型,除非明文指定,既可部署于远程服务器且在客户端实施远程调用,也可部署于设备能力胜任的客户端直接调用,某些实施例中,当其运行于客户端时,其相应的智能可通过迁移学习来获得,以便降低对客户端硬件运行资源的要求,避免过度占用客户端硬件运行资源。The neural network models cited or possibly cited in this application, unless expressly specified, can be deployed on a remote server and remotely called on the client, or can be deployed on a client with competent device capabilities for direct calling. In some embodiments, , when it runs on the client, its corresponding intelligence can be obtained through transfer learning, so as to reduce the requirements for client hardware running resources and avoid excessive occupation of client hardware running resources.
本申请所涉及的各种数据,除非明文指定,既可远程存储于服务器,也可存储于本地终端设备,只要其适于被本申请的技术方案所调用即可。Various data involved in this application, unless expressly specified, can be stored remotely in a server or in a local terminal device, as long as they are suitable for being called by the technical solution of this application.
本领域技术人员对此应当知晓:本申请的各种方法,虽然基于相同的概念而进行描述而使其彼此间呈现共通性,但是,除非特别说明,否则这些方法都是可以独立执行的。同理,对于本申请所揭示的各个实施例而言,均基于同一发明构思而提出,因此,对于相同表述的概念,以及尽管概念表述不同但仅是为了方便而适当变换的概念,应被等同理解。Those skilled in the art should know that although the various methods of the present application are described based on the same concept and are common to each other, these methods can all be executed independently unless otherwise specified. Similarly, the various embodiments disclosed in this application are all proposed based on the same inventive concept. Therefore, the same expressed concepts, as well as the concepts that are appropriately transformed for convenience only, although the conceptual expressions are different, should be regarded as equivalent. understand.
本申请即将揭示的各个实施例,除非明文指出彼此之间的相互排斥关系,否则,各个实施例所涉的相关技术特征可以交叉结合而灵活构造出新的实施例,只要这种结合不背离本申请的创造精神且可满足现有技术中的需求或解决现有技术中的某方面的不足即可。对此变通,本领域技术人员应当知晓。Unless the mutually exclusive relationship between the various embodiments to be disclosed in this application is explicitly stated, the relevant technical features involved in the various embodiments can be cross-combined to flexibly construct new embodiments, as long as such combination does not deviate from the present disclosure. The application must be creative and can meet the needs of the existing technology or solve some deficiencies in the existing technology. Those skilled in the art will be aware of modifications to this.
在参考以上示例性场景的基础上,请参阅图1以及图2,本申请的数字果园果树定位方法在其一个实施例中,包括如下步骤:Based on the above exemplary scenarios, please refer to Figure 1 and Figure 2. In one embodiment, the digital orchard fruit tree positioning method of the present application includes the following steps:
步骤S10、响应果园果树定位指令,获取果园中各个荔枝果树相对应的荔枝果树遥感图像;Step S10: Respond to the orchard fruit tree positioning instruction and obtain remote sensing images of lychee fruit trees corresponding to each lychee fruit tree in the orchard;
终端设备可以响应果园果树定位指令,获取果园中各个荔枝果树相对应的荔枝果树遥感图像;获取所述荔枝果树遥感图像可以采用大疆精灵4RTK无人机,分别在高度20m、30m、50m对荔枝果园进行拍摄,设定航向重叠度为80%,旁向重叠度为60%,拍摄的荔枝果树品种有糯米糍、桂味以及仙进奉等等。The terminal device can respond to the orchard fruit tree positioning instructions and obtain remote sensing images of lychee fruit trees corresponding to each lychee fruit tree in the orchard; to obtain the remote sensing images of lychee fruit trees, a DJI Phantom 4RTK drone can be used to map lychees at heights of 20m, 30m, and 50m respectively. For shooting in the orchard, set the heading overlap to 80% and the side overlap to 60%. The lychee fruit tree varieties photographed include Nuomi Ci, Guiwei, Xianjinfeng, etc.
在一些实施例中,对原始图片进行筛选,过滤掉拍摄模糊、过曝等无效的图片,将无人机拍摄的图片导入三维建模软件生成正射影像,将正射影像按照1024*1024与512*512尺寸进行随机裁剪,得到数据800张。对原有的数据进行锐化、模糊等数据增强,得到数据4000张,增加训练的数据量,提高模型的泛化能力,增加噪声数据,提升模型的鲁棒性,可以使用Labe lme进行数据标注,转换成COCO格式的数据集。In some embodiments, the original pictures are screened to filter out invalid pictures such as blurry and overexposed pictures, the pictures taken by the drone are imported into the three-dimensional modeling software to generate orthophotos, and the orthophotos are combined according to 1024*1024 and Randomly crop the 512*512 size to obtain 800 pieces of data. Perform data enhancements such as sharpening and blurring on the original data to obtain 4,000 data, increase the amount of training data, improve the generalization ability of the model, add noise data, and improve the robustness of the model. You can use Labe lme for data annotation. , converted into a data set in COCO format.
步骤S20、将Mask R-CNN模型中的骨干网络更新为Swin-Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述Mask R-CNN模型中,以构建果树图像实例分割模型;Step S20: Update the backbone network in the Mask R-CNN model to the Swin-Transformer network, and embed the Hybrid Task Cascade detector of the hybrid task cascade architecture into the Mask R-CNN model to construct fruit tree image instance segmentation Model;
请参阅图3,将Mask R-CNN模型中的骨干网络更新为Swin-Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述Mask R-CNN模型中,以构建果树图像实例分割模型,对所述荔枝果树遥感图像进行实例分割,嵌入Swin Transformer网络作为骨干网络,通过patch partition将输入图片H×W×3划分为不重合的patch集合,其中每个patch尺寸为4×4,那么每个patch的特征维度为4×4×3=48,patch块的数量为H/4×W/4。stage1首先通过一个linear embedding将输划分后的patch特征维度变成C,送入Swin Transformer Block分别进行W-MSA与SW-MSA处理。stage2-stage4操作相同,先通过一个patch merging,将输入按照2x2的相邻patches合并,这样子patch块的数量就变成了H/8×W/8,特征维度就变成了4C,使用linear embedding将4C压缩成2C,通过一个全连接层再调整通道维度为原来的两倍,然后送入Swin Transformer Block进行W-MSA与SW-MSA处理。Refer to Figure 3, update the backbone network in the Mask R-CNN model to the Swin-Transformer network, and embed the Hybrid Task Cascade detector of the hybrid task cascade architecture into the Mask R-CNN model to construct the fruit tree image Instance segmentation model, perform instance segmentation on the litchi fruit tree remote sensing image, embed the Swin Transformer network as the backbone network, and divide the input image H×W×3 into non-overlapping patch sets through patch partition, where each patch size is 4× 4, then the feature dimension of each patch is 4×4×3=48, and the number of patch blocks is H/4×W/4. Stage1 first uses a linear embedding to change the patch feature dimension after division into C, and sends it to the Swin Transformer Block for W-MSA and SW-MSA processing respectively. The operation of stage2-stage4 is the same. First, through a patch merging, the input is merged according to 2x2 adjacent patches. In this way, the number of sub-patch blocks becomes H/8×W/8, and the feature dimension becomes 4C. Use linear Embedding compresses 4C into 2C, adjusts the channel dimension to twice the original through a fully connected layer, and then sends it to the Swin Transformer Block for W-MSA and SW-MSA processing.
混合任务级联架构的Hybrid Task Cascade检测器的主要思想是在Faster R-CNN的基础上引入级联结构,同时利用多任务学习来提高检测性能。将RPN的输出和第一层特征图拼接起来,然后将第二层到第四层的特征图依次和第一层的特征图拼接起来,得到一个级联的特征金字塔。在融合特征的基础上,对每个金字塔层都进行边界框生成和分类,使用两个任务的多任务学习,即边界框生成任务和类别分类任务。The main idea of the Hybrid Task Cascade detector is to introduce a cascade structure based on Faster R-CNN and simultaneously utilize multi-task learning to improve detection performance. The output of RPN is spliced with the first layer feature map, and then the feature maps from the second to fourth layers are spliced with the first layer feature map in turn to obtain a cascaded feature pyramid. On the basis of fused features, bounding box generation and classification are performed for each pyramid layer using multi-task learning of two tasks, namely the bounding box generation task and the category classification task.
在一些实施例中,根据荔枝树的边缘特征提出FBLoss损失函数LFB,计算方法如下In some embodiments, the FBLoss loss function L FB is proposed based on the edge features of the litchi tree. The calculation method is as follows
LFB=λFLLFL+λSMLSM+λBLB L FB =λ FL L FL +λ SM L SM +λ B L B
其中,LFL为焦点损失函数,计算公式为Among them, L FL is the focus loss function, and the calculation formula is
LFL=-(1-pt)γlog(pt)L FL =-(1-p t ) γ log(p t )
(1-pt)γ是调节因子,γ≥0是可调节的聚焦参数。(1-p t ) γ is the adjustment factor, and γ≥0 is the adjustable focus parameter.
LSM为平滑损失函数,计算公式为L SM is the smoothing loss function, and the calculation formula is:
x为预测框和真实框之间的数值差异。x is the numerical difference between the predicted box and the real box.
LB为边界损失函数,计算公式为L B is the boundary loss function, and the calculation formula is
LB=∫ΩΦG(q)sθ(q)dqL B =∫ Ω ΦG(q)s θ (q)dq
ΦG是边界的水平集表示,sθ表示分割网络的softmax概率输出,DG是一个相对于边界的距离图。ΦG is the level set representation of the boundary, s θ represents the softmax probability output of the segmentation network, and D G is a distance map relative to the boundary.
在一些实施例中,将荔枝冠层训练图片数据集划分为训练集、测试集和验证集,设定初始学习率、训练轮次等超参数,对Swin-CMN模型进行训练,训练结束后获得Swin-CMN模型的推理权重文件和分割模型性能指标。In some embodiments, the lychee canopy training image data set is divided into a training set, a test set and a verification set, hyper-parameters such as initial learning rate and training rounds are set, the Swin-CMN model is trained, and after the training is completed, the Inference weight files and segmentation model performance metrics for the Swin-CMN model.
优选地,将数据集按照8:1:1的比例划分为训练集、测试集、验证集。设定初始学习率为0.02,梯度下降方法为SGD,学习率策略为warmup,epochs(训练轮次)为200,batch_size(批尺寸)为8,在RTX3090上进行训练,训练结束后得到模型权重文件。Preferably, the data set is divided into a training set, a test set, and a verification set in a ratio of 8:1:1. Set the initial learning rate to 0.02, the gradient descent method to SGD, the learning rate strategy to warmup, epochs (training rounds) to 200, batch_size (batch size) to 8, train on RTX3090, and obtain the model weight file after training. .
进一步地,模型性能指标可以采用如下步骤获得,选取平均值平均精密度(mAP)用作评价训练模型准确度的指标。mAP(Mean Average Precision)是对多个对象类别的平均精度(Average Precision)进行算术平均得到的评估指标,用于评估目标检测算法的整体效果。通常使用的mAP值在0-1之间,数值越高说明目标检测算法的效果越好。在图像分割中,可以基于准确率P(Precision)和召回率R(Recall)为每个类别绘制曲线,使用曲线下面积(AUC)计算AP值。多个指标的计算方法如下:Furthermore, the model performance index can be obtained through the following steps. The average average precision (mAP) is selected as an index to evaluate the accuracy of the training model. mAP (Mean Average Precision) is an evaluation index obtained by arithmetic averaging the average precision (Average Precision) of multiple object categories. It is used to evaluate the overall effect of the target detection algorithm. The commonly used mAP value is between 0-1. The higher the value, the better the effect of the target detection algorithm. In image segmentation, a curve can be drawn for each category based on precision P (Precision) and recall R (Recall), and the AP value is calculated using the area under the curve (AUC). Multiple indicators are calculated as follows:
其中TP表示模型预测为正,且真实为正的样本数量;FP表示表示模型预测为正,但实际为负的样本数量;FN表示真实为正,但模型预测为负的样本数量;P是准确率,指的是模型预测为正的样本中,真实为正的样本占比;R是召回率,指的是真实为正的样本中,被模型预测为正的样本占比。高的正确率说明预测为正的样本中真实正样本占比较高,模型识别能力较强;高的召回率说明真实正样本中被模型识别为正的样本占比较高,模型覆盖能力较强。TP represents the number of samples that are predicted to be positive by the model and are actually positive; FP represents the number of samples that are predicted to be positive by the model but are actually negative; FN represents the number of samples that are actually positive but are predicted to be negative by the model; P is the accuracy Rate refers to the proportion of samples that are actually positive among the samples predicted by the model to be positive; R is the recall rate, which refers to the proportion of samples that are predicted to be positive by the model among the samples that are actually positive. A high accuracy rate indicates that the true positive samples account for a high proportion of the predicted positive samples, and the model has strong recognition ability; a high recall rate indicates that the true positive samples account for a high proportion of samples identified as positive by the model, and the model coverage ability is strong.
步骤S30、将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果,基于预设的果树识别模型识别所述果树分割结果相对应的荔枝果树遥感图像,确定所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标;Step S30: Input the remote sensing image of the lychee fruit tree corresponding to the lychee fruit tree into the trained fruit tree image instance segmentation model for instance segmentation, determine the fruit tree segmentation result, and identify the phase of the fruit tree segmentation result based on the preset fruit tree recognition model. Corresponding remote sensing image of lychee fruit trees, determine the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees;
将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割之前,对所述果树图像实例分割模型进行训练,标注所述荔枝果树相对应的荔枝果树遥感图像中荔枝果树部分以及其相对应的图片序号,以确定所述果树图像实例分割模型的训练集以及验证集;根据所述训练集以及验证集对所述果树图像实例分割模型进行反向传播迭代训练,以使在每一次反向传播迭代训练中,根据标注后的所述荔枝果树相对应的荔枝果树遥感图像输入至所述果树图像实例分割模型所得到的预测框结果与实际标注结果的误差,计算目标损失函数;根据所述目标损失函数更新模型参数,直至所述目标损失函数的变化值小于预设阈值或训练次数大于预设次数之后,保存模型参数并完成所述果树图像实例分割模型的训练。Before inputting the lychee fruit tree remote sensing image corresponding to the lychee fruit tree into the trained fruit tree image instance segmentation model for instance segmentation, the fruit tree image instance segmentation model is trained and the lychee fruit tree corresponding to the lychee fruit tree is marked. The part of the lychee fruit tree in the remote sensing image and its corresponding picture serial number are used to determine the training set and verification set of the fruit tree image instance segmentation model; the fruit tree image instance segmentation model is backpropagated according to the training set and the verification set. Iterative training, so that in each backpropagation iterative training, the predicted frame result obtained by inputting the remote sensing image of the lychee fruit tree corresponding to the annotated lychee fruit tree into the fruit tree image instance segmentation model is different from the actual annotation result. error, calculate the target loss function; update the model parameters according to the target loss function, until the change value of the target loss function is less than the preset threshold or the number of training times is greater than the preset number, save the model parameters and complete the fruit tree image instance segmentation Model training.
请参阅图4,在训练好所述果树图像实例分割模型之后,将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果,基于预设的果树识别模型识别所述果树分割结果相对应的荔枝果树遥感图像,确定所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标。Please refer to Figure 4. After training the fruit tree image instance segmentation model, the lychee fruit tree remote sensing image corresponding to the lychee fruit tree is input to the trained fruit tree image instance segmentation model to perform instance segmentation and determine the fruit tree segmentation result. The lychee fruit tree remote sensing image corresponding to the fruit tree segmentation result is identified based on the preset fruit tree recognition model, and the number and pixel coordinates of the lychee fruit tree in the lychee fruit tree remote sensing image are determined.
步骤S40、构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标;Step S40: Construct a digital terrain map of the orchard, and determine the global positioning system coordinates corresponding to each fruit tree based on the digital terrain map;
请参阅图5,构建果园数字地形图,确定所述果园数字地形图中各个果树相对应的全球定位系统坐标(GPS)信息以及高程信息;将果园的数字地形图分块处理,采用果树识别模型对数字地形图子块进行识别以确定数字地形图子块识别结果;对所述数字地形图子块识别结果进行数据拼接,确定果园中各个果树相对应的像素坐标;将果树像素坐标转换为各个果树相对应的全球定位系统坐标,并存储果园中所有荔枝果树的(GPS)全球定位系统坐标数据。Please refer to Figure 5 to construct a digital topographic map of the orchard, and determine the global positioning system coordinates (GPS) information and elevation information corresponding to each fruit tree in the digital topographic map of the orchard; process the digital topographic map of the orchard into blocks and use a fruit tree identification model Identify the digital terrain map sub-blocks to determine the digital terrain map sub-block identification results; perform data splicing on the digital terrain map sub-block identification results to determine the pixel coordinates corresponding to each fruit tree in the orchard; convert the fruit tree pixel coordinates into each The corresponding global positioning system coordinates of the fruit trees are stored, and the (GPS) global positioning system coordinate data of all lychee fruit trees in the orchard is stored.
步骤S50、基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置,以完成数字果园中荔枝果树的定位。Step S50: Match the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map based on a preset matching algorithm to determine the corresponding location of the lychee fruit tree. location to complete the positioning of lychee fruit trees in the digital orchard.
请参阅图6,计算所述荔枝果树遥感图像中荔枝果树的像素坐标到荔枝果树遥感图像中点的像素距离,并从近到远排序;将所述像素距转换为全球定位系统坐标距离,确定与荔枝果树遥感图像中果树数量相同的全球定位系统坐标;基于半正矢函数采用矢量角度对所述全球定位系统坐标进行对比筛选以配对荔枝果树的全球定位系统坐标,确定所述荔枝果树在数字果园中相对应的位置。Referring to Figure 6, calculate the pixel distance from the pixel coordinates of the litchi fruit tree in the litchi fruit tree remote sensing image to the midpoint of the litchi fruit tree remote sensing image, and sort them from near to far; convert the pixel distance into a global positioning system coordinate distance, and determine GPS coordinates with the same number of fruit trees in the remote sensing image of lychee fruit trees; based on the semi-vector function and vector angle, the GPS coordinates are compared and screened to match the global positioning system coordinates of the lychee fruit trees, and the digital position of the lychee fruit trees is determined. Corresponding location in the orchard.
具体而言,可以基于半正矢函数(Haversine公式)分别计算荔枝果树遥感图像中点GPS和果园所有果树GPS的距离值,从小到大排序,计算遥感图像中果树像素坐标到图像中点坐标像素距离值,与GPS坐标互换,即计算出荔枝果树遥感图像中果树的GPS信息。Specifically, the distance values between the midpoint GPS of the litchi fruit tree remote sensing image and the GPS of all the orchard fruit trees can be calculated based on the semisine function (Haversine formula), sorted from small to large, and the pixel coordinates of the fruit trees in the remote sensing image to the midpoint coordinate pixels of the image can be calculated. The distance value is interchanged with the GPS coordinates, that is, the GPS information of the fruit tree in the litchi fruit tree remote sensing image is calculated.
分别根据荔枝果树遥感图像中果树和整体果园果树的矢量关系,计算两种情况下的果树夹角用于提高果树配对的精确度。所述匹配算法的具体步骤如下:According to the vector relationship between the fruit trees in the litchi fruit tree remote sensing image and the whole orchard fruit tree, the angle between the fruit trees in the two situations was calculated to improve the accuracy of fruit tree pairing. The specific steps of the matching algorithm are as follows:
对荔枝果树遥感图像中果树识别,识别出n颗果树,当n小于等于1时,直接使用整体果园中匹配的果树的GPS;当n大于1时,比较第k颗果树和第k+1颗果树距离图像中点距离,当距离大于1米时,维持原有配对方案(1<k<=n)。For fruit tree recognition in litchi fruit tree remote sensing images, n fruit trees are identified. When n is less than or equal to 1, the GPS of the matching fruit trees in the entire orchard is directly used; when n is greater than 1, the k-th fruit tree is compared with the k+1-th fruit tree. The distance between the fruit tree and the midpoint of the image. When the distance is greater than 1 meter, the original pairing scheme (1<k<=n) is maintained.
当距离小于1米时,我们以第1颗果树、图像中点、第k颗果树构建矢量三角形,比较他们的像素矢量角度和GPS矢量角度,计算差值p。When the distance is less than 1 meter, we construct a vector triangle using the first fruit tree, the image midpoint, and the k-th fruit tree, compare their pixel vector angles with the GPS vector angle, and calculate the difference p.
以第1颗果树、图像中点、第k+1颗果树构建三角形,用GPS矢量角度与B2步骤中第k颗果树像素矢量角度比较,计算差值p1。Construct a triangle using the first fruit tree, the image midpoint, and the k+1th fruit tree, compare the GPS vector angle with the k-th fruit tree pixel vector angle in step B2, and calculate the difference p1.
计算公式如下:Calculated as follows:
其中,a、b、c分别为图像中点、第1颗果树、第k颗果树所围成的像素三角形的对边,a1、b、c分别为图像中点、第1颗果树、第k+1颗果树所围成的像素三角形的对边;x、y、z分别为图像中点、第1颗果树、第k颗果树所围成的GPS三角形的对边,x1、y1、z1分别为图像中点、第1颗果树、第k颗果树所围成的GPS三角形的对边,x、y、z、x1、y1、z1由Haversine公式对图像中点、第1颗果树、第k颗果树、第k+1颗果树的经纬度坐标计算得到。Among them, a, b, and c are respectively the opposite sides of the pixel triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree. a1, b, and c are respectively the midpoint of the image, the first fruit tree, and the k-th fruit tree. The opposite sides of the pixel triangle surrounded by +1 fruit trees; x, y, and z are the opposite sides of the GPS triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree respectively. x1, y1, and z1 are respectively are the opposite sides of the GPS triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree. x, y, z, x1, y1, and z1 are calculated by the Haversine formula for The longitude and latitude coordinates of the first fruit tree and the k+1th fruit tree are calculated.
比较p与p1数值,若p<p1,则第k颗果树对应第k+1颗果树GPS,交换第k颗果树和第k+1颗果树。Compare the values of p and p1. If p<p1, then the k-th fruit tree corresponds to the k+1-th fruit tree GPS, and the k-th fruit tree and the k+1-th fruit tree are exchanged.
计算所得GPS即无人机拍摄图像中有效区域内果树的GPS信息。The calculated GPS is the GPS information of the fruit trees in the effective area of the image captured by the drone.
在一些实施例中,请参阅图7,可以基于Vue框架搭建一个数字果园系统展示界面,读取存储在文件中的果树信息,将荔枝果树相对应的位置信息在系统中实现可视化。In some embodiments, please refer to Figure 7. A digital orchard system display interface can be built based on the Vue framework, the fruit tree information stored in the file is read, and the corresponding location information of the lychee fruit trees is visualized in the system.
由上述实施例可知,相对于现有技术,本申请针对由于特征匹配错误、拼接边缘处理不当等问题,拼接图的中的树普遍存在模糊不清的情况,对后续树冠上相关信息的提取有很大影响;从原图像中获取冠层信息,但原图中不包含果树的位置信息,而为每棵树安装定位装置的方案,成本巨大等问题,本申请包括不限于如下有益效果:It can be seen from the above embodiments that compared with the existing technology, this application aims at problems such as feature matching errors and improper processing of splicing edges. Trees in the spliced image are generally blurred, and it is difficult to extract relevant information on the subsequent tree crowns. It has a great impact; the canopy information is obtained from the original image, but the original image does not contain the location information of the fruit trees, and the solution of installing a positioning device for each tree has huge costs and other issues. This application includes but is not limited to the following beneficial effects:
其一,本申请所提出的匹配算法,通过获取地图和无人机图像中果树的GPS信息进行匹配,无需安装定位装置,节约成本;First, the matching algorithm proposed in this application performs matching by obtaining the GPS information of fruit trees in maps and drone images, eliminating the need to install a positioning device and saving costs;
其二,本申请所提出的Swi n-CMN模型在荔枝树冠层分割上具有优越性,相较于其他网络具有更好的性能指标和分割效果;Secondly, the Swin-CMN model proposed in this application has superiority in lychee canopy segmentation, and has better performance indicators and segmentation effects than other networks;
其三,本申请所提出的数字果园果树定位方法,该方法能够将无人机拍摄图像中的高分辨率冠层对应到地图上的思想,从而提供荔枝树高分辨率的真实冠层信息,为后续的处理提供了极大的帮助。该方法准确度高、可重复性强,解决了传统果园管理粗放、效率低下的问题,为智慧果园的有效发展提供了有效的技术支持。Third, the digital orchard fruit tree positioning method proposed in this application can map the high-resolution canopy in the drone image to the map, thereby providing high-resolution real canopy information of the lychee tree. It provides great help for subsequent processing. This method has high accuracy and repeatability, solves the problems of extensive and low efficiency of traditional orchard management, and provides effective technical support for the effective development of smart orchards.
在本申请任意实施例的基础上,训练所述果树图像实例分割模型的步骤,包括如下步骤:Based on any embodiment of the present application, the steps of training the fruit tree image instance segmentation model include the following steps:
标注所述荔枝果树相对应的荔枝果树遥感图像中荔枝果树部分以及其相对应的图片序号,以确定所述果树图像实例分割模型的训练集以及验证集;Mark the lychee fruit tree part in the lychee fruit tree remote sensing image corresponding to the lychee fruit tree and its corresponding picture serial number to determine the training set and verification set of the fruit tree image instance segmentation model;
根据所述训练集以及验证集对所述果树图像实例分割模型进行反向传播迭代训练,以使在每一次反向传播迭代训练中,根据标注后的所述荔枝果树相对应的荔枝果树遥感图像输入至所述果树图像实例分割模型所得到的预测框结果与实际标注结果的误差,计算目标损失函数;The fruit tree image instance segmentation model is subjected to back propagation iterative training based on the training set and the verification set, so that in each back propagation iterative training, the lychee fruit tree remote sensing image corresponding to the annotated lychee fruit tree is The error between the prediction box result and the actual annotation result obtained by inputting into the fruit tree image instance segmentation model is used to calculate the target loss function;
根据所述目标损失函数更新模型参数,直至所述目标损失函数的变化值小于预设阈值或训练次数大于预设次数之后,保存模型参数并完成所述果树图像实例分割模型的训练。The model parameters are updated according to the target loss function until the change value of the target loss function is less than the preset threshold or the number of training times is greater than the preset number, then the model parameters are saved and the training of the fruit tree image instance segmentation model is completed.
在本申请任意实施例的基础上,将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果的步骤,包括如下步骤:On the basis of any embodiment of the present application, the step of inputting the lychee fruit tree remote sensing image corresponding to the lychee fruit tree into the trained fruit tree image instance segmentation model for instance segmentation and determining the fruit tree segmentation result includes the following steps:
所述果树图像实例分割模型中的Swi n-Transformer网络将输入的所述荔枝果树相对应的荔枝果树遥感图像划分为若干个大小相等的小块,对每个小块进行嵌入,以确定各个小块内的特征表示;The Swin-Transformer network in the fruit tree image instance segmentation model divides the input lychee fruit tree remote sensing image corresponding to the lychee fruit tree into several small blocks of equal size, and embeds each small block to determine the size of each small block. Feature representation within blocks;
采用多层平移窗口对各个小块进行自注意力计算,以将相邻的小块的特征进行信息交互;Multi-layer translation windows are used to perform self-attention calculations on each small patch to exchange information between the features of adjacent small patches;
基于多层平移窗口自注意力和MLP层进行特征提取,同时,在每个块的输出上进行多尺度特征融合;Feature extraction is performed based on multi-layer translation window self-attention and MLP layers, and at the same time, multi-scale feature fusion is performed on the output of each block;
将多个尺度的特征进行特征金字塔操作,采用全局池化和线性层进行分类输出。Perform feature pyramid operation on features at multiple scales, and use global pooling and linear layers for classification output.
在本申请任意实施例的基础上,将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果的步骤,包括如下步骤:On the basis of any embodiment of the present application, the step of inputting the remote sensing image of the lychee fruit tree corresponding to the lychee fruit tree into the trained instance segmentation model of the fruit tree image for instance segmentation and determining the fruit tree segmentation result includes the following steps:
所述果树图像实例分割模型中的所述Hybrid Task Cascade检测器采用Swin-Transformer网络作为主干网络,对输入的所述荔枝果树相对应的荔枝果树遥感图像进行特征提取;The Hybrid Task Cascade detector in the fruit tree image instance segmentation model uses the Swin-Transformer network as the backbone network to perform feature extraction on the input remote sensing image of the lychee fruit tree corresponding to the lychee fruit tree;
采用锚点框对所述荔枝果树遥感图像中的候选目标区域进行提取,将所述候选目标区域经过多级检测和分割头,以进行目标区域的检测和分割;An anchor point frame is used to extract the candidate target area in the litchi fruit tree remote sensing image, and the candidate target area is passed through a multi-level detection and segmentation head to detect and segment the target area;
对每个目标区域进行边界框的回归和实例分割掩码的预测;Perform bounding box regression and instance segmentation mask prediction for each target region;
对重叠的候选目标区域进行去重,以确定果树分割结果。Deduplication is performed on overlapping candidate target areas to determine the fruit tree segmentation results.
在本申请任意实施例的基础上,构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标的步骤,包括如下步骤:On the basis of any embodiment of the present application, the orchard digital terrain map is constructed, and the step of determining the global positioning system coordinates corresponding to each fruit tree based on the digital terrain map includes the following steps:
构建果园数字地形图,确定所述果园数字地形图中各个果树相对应的GPS信息以及高程信息;Construct a digital topographic map of the orchard, and determine the GPS information and elevation information corresponding to each fruit tree in the digital topographic map of the orchard;
将果园的数字地形图分块处理,采用果树识别模型对数字地形图子块进行识别以确定数字地形图子块识别结果;The digital topographic map of the orchard is processed into blocks, and the fruit tree recognition model is used to identify the sub-blocks of the digital topographic map to determine the recognition results of the sub-blocks of the digital topographic map;
对所述数字地形图子块识别结果进行数据拼接,确定果园中各个果树相对应的像素坐标;Perform data splicing on the digital terrain map sub-block recognition results to determine the corresponding pixel coordinates of each fruit tree in the orchard;
将果树像素坐标转换为各个果树相对应的全球定位系统坐标。Convert the pixel coordinates of the fruit trees into the global positioning system coordinates corresponding to each fruit tree.
在本申请任意实施例的基础上,基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置的步骤,包括如下步骤:On the basis of any embodiment of the present application, based on a preset matching algorithm, the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map to determine The steps of positioning the lychee fruit tree correspondingly include the following steps:
计算所述荔枝果树遥感图像中荔枝果树的像素坐标到荔枝果树遥感图像中点的像素距离,并从近到远排序;Calculate the pixel distance from the pixel coordinates of the litchi fruit tree in the litchi fruit tree remote sensing image to the midpoint of the litchi fruit tree remote sensing image, and sort them from near to far;
将所述像素距转换为全球定位系统坐标距离,确定与荔枝果树遥感图像中果树数量相同的全球定位系统坐标;Convert the pixel distance into a global positioning system coordinate distance, and determine the global positioning system coordinates with the same number of fruit trees in the litchi fruit tree remote sensing image;
基于半正矢函数采用矢量角度对所述全球定位系统坐标进行对比筛选以配对荔枝果树的全球定位系统坐标,确定所述荔枝果树在数字果园中相对应的位置。Based on the semi-vector function, vector angles are used to compare and filter the global positioning system coordinates to match the global positioning system coordinates of the lychee fruit tree, and determine the corresponding position of the lychee fruit tree in the digital orchard.
具体而言,可以基于半正矢函数(Haversine公式)分别计算荔枝果树遥感图像中点GPS和果园所有果树GPS的距离值,从小到大排序,计算遥感图像中果树像素坐标到图像中点坐标像素距离值,与GPS坐标互换,即计算出荔枝果树遥感图像中果树的GPS信息。Specifically, the distance values between the midpoint GPS of the litchi fruit tree remote sensing image and the GPS of all the orchard fruit trees can be calculated based on the semisine function (Haversine formula), sorted from small to large, and the pixel coordinates of the fruit trees in the remote sensing image to the midpoint coordinate pixels of the image can be calculated. The distance value is interchanged with the GPS coordinates, that is, the GPS information of the fruit tree in the litchi fruit tree remote sensing image is calculated.
分别根据荔枝果树遥感图像中果树和整体果园果树的矢量关系,计算两种情况下的果树夹角用于提高果树配对的精确度。算法思路如下:According to the vector relationship between the fruit trees in the litchi fruit tree remote sensing image and the whole orchard fruit tree, the angle between the fruit trees in the two situations was calculated to improve the accuracy of fruit tree pairing. The algorithm idea is as follows:
对荔枝果树遥感图像中果树识别,识别出n颗果树,当n小于等于1时,直接使用整体果园中匹配的果树的GPS;当n大于1时,比较第k颗果树和第k+1颗果树距离图像中点距离,当距离大于1米时,维持原有配对方案(1<k<=n)。For fruit tree recognition in litchi fruit tree remote sensing images, n fruit trees are identified. When n is less than or equal to 1, the GPS of the matching fruit trees in the entire orchard is directly used; when n is greater than 1, the k-th fruit tree is compared with the k+1-th fruit tree. The distance between the fruit tree and the midpoint of the image. When the distance is greater than 1 meter, the original pairing scheme (1<k<=n) is maintained.
当距离小于1米时,我们以第1颗果树、图像中点、第k颗果树构建矢量三角形,比较他们的像素矢量角度和GPS矢量角度,计算差值p。When the distance is less than 1 meter, we construct a vector triangle using the first fruit tree, the image midpoint, and the k-th fruit tree, compare their pixel vector angles with the GPS vector angle, and calculate the difference p.
以第1颗果树、图像中点、第k+1颗果树构建三角形,用GPS矢量角度与B2步骤中第k颗果树像素矢量角度比较,计算差值p1。Construct a triangle using the first fruit tree, the image midpoint, and the k+1th fruit tree, compare the GPS vector angle with the k-th fruit tree pixel vector angle in step B2, and calculate the difference p1.
计算公式如下:Calculated as follows:
其中,a、b、c分别为图像中点、第1颗果树、第k颗果树所围成的像素三角形的对边,a1、b、c分别为图像中点、第1颗果树、第k+1颗果树所围成的像素三角形的对边;x、y、z分别为图像中点、第1颗果树、第k颗果树所围成的GPS三角形的对边,x1、y1、z1分别为图像中点、第1颗果树、第k颗果树所围成的GPS三角形的对边,x、y、z、x1、y1、z1由Haversine公式对图像中点、第1颗果树、第k颗果树、第k+1颗果树的经纬度坐标计算得到。Among them, a, b, and c are respectively the opposite sides of the pixel triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree. a1, b, and c are respectively the midpoint of the image, the first fruit tree, and the k-th fruit tree. The opposite sides of the pixel triangle surrounded by +1 fruit trees; x, y, and z are the opposite sides of the GPS triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree respectively. x1, y1, and z1 are respectively are the opposite sides of the GPS triangle surrounded by the midpoint of the image, the first fruit tree, and the k-th fruit tree. x, y, z, x1, y1, and z1 are calculated by the Haversine formula for The longitude and latitude coordinates of the first fruit tree and the k+1th fruit tree are calculated.
比较p与p1数值,若p<p1,则第k颗果树对应第k+1颗果树GPS,交换第k颗果树和第k+1颗果树。Compare the values of p and p1. If p<p1, then the k-th fruit tree corresponds to the k+1-th fruit tree GPS, and the k-th fruit tree and the k+1-th fruit tree are exchanged.
计算所得GPS即无人机拍摄图像中有效区域内果树的GPS信息。The calculated GPS is the GPS information of the fruit trees in the effective area of the image captured by the drone.
在本申请任意实施例的基础上,基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置的步骤,包括如下步骤:On the basis of any embodiment of the present application, based on a preset matching algorithm, the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map to determine The steps of positioning the lychee fruit tree correspondingly include the following steps:
响应农药喷洒指令,基于半正矢函数将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置;In response to the pesticide spraying instruction, the number and pixel coordinates of the lychee fruit trees in the remote sensing image of the lychee fruit trees are matched with the global positioning system coordinates of each lychee fruit tree in the orchard digital terrain map based on the semisine function to determine the corresponding lychee fruit tree. s position;
根据所述荔枝果树相对应的位置对荔枝果园中的各个荔枝果树进行农药喷洒,以完成荔枝果树的害虫预防。Pesticide spraying is performed on each lychee fruit tree in the lychee orchard according to the corresponding position of the lychee fruit tree to complete pest prevention of the lychee fruit trees.
请参阅图8,适应本申请的目的之一而提供的一种数字果园果树定位装置,包括图像获取模块1100、分割模型构建模块1200、像素坐标确定模块1300、全球定位坐标确定模块1400以及果树定位模块1500。其中,图像获取模块1100,设置为响应果园果树定位指令,获取果园中各个荔枝果树相对应的荔枝果树遥感图像;分割模型构建模块1200,设置为将Mask R-CNN模型中的骨干网络更新为Swin-Transformer网络,并将混合任务级联架构的Hybrid Task Cascade检测器嵌入至所述Mask R-CNN模型中,以构建果树图像实例分割模型;像素坐标确定模块1300,设置为将所述荔枝果树相对应的荔枝果树遥感图像输入至训练好的所述果树图像实例分割模型进行实例分割,确定果树分割结果,基于预设的果树识别模型识别所述果树分割结果相对应的荔枝果树遥感图像,确定所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标;全球定位坐标确定模块1400,设置为构建果园数字地形图,基于所述数字地形图确定各个果树相对应的全球定位系统坐标;果树定位模块1500,设置为基于预设的匹配算法将所述荔枝果树遥感图像中荔枝果树的数量以及像素坐标与各个荔枝果树在果园数字地形图中的全球定位系统坐标进行配对,确定所述荔枝果树相对应的位置,以完成数字果园中荔枝果树的定位。Referring to Figure 8, a digital orchard fruit tree positioning device adapted to one of the purposes of this application is provided, including an image acquisition module 1100, a segmentation model building module 1200, a pixel coordinate determination module 1300, a global positioning coordinate determination module 1400 and a fruit tree positioning module. Module 1500. Among them, the image acquisition module 1100 is configured to respond to the orchard fruit tree positioning instructions and acquire remote sensing images of lychee fruit trees corresponding to each lychee fruit tree in the orchard; the segmentation model building module 1200 is configured to update the backbone network in the Mask R-CNN model to Swin -Transformer network, and embed the Hybrid Task Cascade detector of the hybrid task cascade architecture into the Mask R-CNN model to construct a fruit tree image instance segmentation model; the pixel coordinate determination module 1300 is configured to compare the lychee fruit tree with the The corresponding lychee fruit tree remote sensing image is input to the trained fruit tree image instance segmentation model for instance segmentation, and the fruit tree segmentation result is determined. Based on the preset fruit tree recognition model, the lychee fruit tree remote sensing image corresponding to the fruit tree segmentation result is identified, and the result is determined. The number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees; the global positioning coordinate determination module 1400 is configured to construct a digital terrain map of the orchard, and determine the global positioning system coordinates corresponding to each fruit tree based on the digital terrain map; the fruit tree positioning module 1500 , set to match the number and pixel coordinates of lychee fruit trees in the remote sensing image of lychee fruit trees with the global positioning system coordinates of each lychee fruit tree in the orchard digital topographic map based on a preset matching algorithm, and determine the corresponding location of the lychee fruit tree. location to complete the positioning of lychee fruit trees in the digital orchard.
在本申请任意实施例的基础上,请参阅图9,本申请的另一实施例还提供一种电子设备,所述电子设备可由计算机设备实现,如图9所示,计算机设备的内部结构示意图。该计算机设备包括通过系统总线连接的处理器、计算机可读存储介质、存储器和网络接口。其中,该计算机设备的计算机可读存储介质存储有操作系统、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器执行时,可使得处理器实现一种数字果园果树定位方法。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器中可存储有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行本申请的数字果园果树定位方法。该计算机设备的网络接口用于与终端连接通信。本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Based on any embodiment of the present application, please refer to Figure 9. Another embodiment of the present application further provides an electronic device. The electronic device can be implemented by a computer device. As shown in Figure 9, a schematic diagram of the internal structure of the computer device . The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected by a system bus. Among them, the computer readable storage medium of the computer device stores an operating system, a database and computer readable instructions. The database can store a sequence of control information. When the computer readable instructions are executed by the processor, the processor can implement a Digital orchard fruit tree positioning method. The processor of the computer device is used to provide computing and control capabilities and support the operation of the entire computer device. Computer readable instructions may be stored in the memory of the computer device. When executed by the processor, the computer readable instructions may cause the processor to execute the digital orchard fruit tree positioning method of the present application. The network interface of the computer device is used for communication with the terminal connection. Those skilled in the art can understand that the structure shown in Figure 9 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Specific computer equipment can May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
本实施方式中处理器用于执行图8中的各个模块及其子模块的具体功能,存储器存储有执行上述模块或子模块所需的程序代码和各类数据。网络接口用于向用户终端或服务器之间的数据传输。本实施方式中的存储器存储有本申请的数字果园果树定位装置中执行所有模块/子模块所需的程序代码及数据,服务器能够调用服务器的程序代码及数据执行所有子模块的功能。In this embodiment, the processor is used to execute the specific functions of each module and its sub-modules in Figure 8, and the memory stores program codes and various types of data required to execute the above modules or sub-modules. Network interfaces are used for data transmission to user terminals or between servers. The memory in this embodiment stores the program codes and data required to execute all modules/sub-modules in the digital orchard fruit tree positioning device of the present application, and the server can call the server's program codes and data to execute the functions of all sub-modules.
本申请还提供一种存储有计算机可读指令的存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行本申请任一实施例所述数字果园果树定位方法的步骤。This application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the digital orchard fruit tree positioning described in any embodiment of this application. Method steps.
本申请还提供一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被一个或多个处理器执行时实现本申请任一实施例所述数字果园果树定位方法的步骤。This application also provides a computer program product, including a computer program/instruction, which when executed by one or more processors, implements the steps of the digital orchard fruit tree positioning method described in any embodiment of this application.
本领域普通技术人员可以理解实现本申请上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等计算机可读存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments of the present application can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
以上所述仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only some of the embodiments of the present application. It should be pointed out that those of ordinary skill in the technical field can also make several improvements and modifications without departing from the principles of the present application. These improvements and modifications can also be made. should be regarded as the scope of protection of this application.
综上所述,该方法能够将无人机拍摄图像中的高分辨率冠层对应到地图上的思想,从而提供荔枝树高分辨率的真实冠层信息,为后续的处理提供了极大的帮助。该方法准确度高、可重复性强,解决了传统果园管理粗放、效率低下的问题,为智慧果园的有效发展提供了有效的技术支持。In summary, this method can map the high-resolution canopy in the drone image to the map, thereby providing high-resolution real canopy information of the lychee tree and providing great convenience for subsequent processing. help. This method has high accuracy and repeatability, solves the problems of extensive and low efficiency of traditional orchard management, and provides effective technical support for the effective development of smart orchards.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311278741.1A CN117292278A (en) | 2023-09-28 | 2023-09-28 | Digital orchard fruit tree positioning method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311278741.1A CN117292278A (en) | 2023-09-28 | 2023-09-28 | Digital orchard fruit tree positioning method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117292278A true CN117292278A (en) | 2023-12-26 |
Family
ID=89258317
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311278741.1A Pending CN117292278A (en) | 2023-09-28 | 2023-09-28 | Digital orchard fruit tree positioning method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117292278A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118397483A (en) * | 2024-04-22 | 2024-07-26 | 中国农业大学 | Fruit tree target positioning and navigation line region segmentation method based on YOLO network |
-
2023
- 2023-09-28 CN CN202311278741.1A patent/CN117292278A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118397483A (en) * | 2024-04-22 | 2024-07-26 | 中国农业大学 | Fruit tree target positioning and navigation line region segmentation method based on YOLO network |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Fu et al. | Fast and accurate detection of kiwifruit in orchard using improved YOLOv3-tiny model | |
CN111080794B (en) | A 3D reconstruction method for edge-cloud collaboration in arable land | |
CN111626128B (en) | A Pedestrian Detection Method Based on Improved YOLOv3 in Orchard Environment | |
Liu et al. | Survey of road extraction methods in remote sensing images based on deep learning | |
CN115311502A (en) | A small sample scene classification method for remote sensing images based on multi-scale dual-stream architecture | |
CN110765882A (en) | Video tag determination method, device, server and storage medium | |
CN116363532A (en) | Traffic target detection method for UAV images based on attention mechanism and reparameterization | |
CN114926726A (en) | Unmanned ship sensing method based on multitask network and related equipment | |
CN112052736A (en) | Cloud computing platform-based field tea tender shoot detection method | |
Zhang et al. | An improved target detection method based on YOLOv5 in natural orchard environments | |
CN116977633A (en) | Feature element segmentation model training method, feature element segmentation method and device | |
CN117292278A (en) | Digital orchard fruit tree positioning method, device, equipment and medium | |
CN118230125A (en) | Airport toilet sheet image automatic labeling method, airport toilet sheet image automatic labeling system, electronic equipment and medium | |
CN116307105A (en) | Winter wheat yield prediction method, device and equipment based on multi-mode canopy image | |
CN115294479A (en) | High-resolution remote sensing image semantic segmentation method based on anisotropic context network | |
CN112464997B (en) | Multi-sensor cooperative monitoring method and system based on fuzzy-greedy search decision | |
CN118521712A (en) | Three-dimensional reconstruction method, device, equipment and medium for citrus seedlings | |
CN118628913A (en) | Citrus fruit picking positioning method, device, equipment and medium | |
CN117173556B (en) | Small sample SAR target recognition method based on twin neural network | |
CN117152105A (en) | Method, device, equipment and medium for estimating yield of litchi in orchard | |
CN117612031A (en) | A remote sensing recognition method for abandoned land based on semantic segmentation | |
CN117197609A (en) | Construction method, system, medium and equipment of remote sensing sample data set | |
CN114694021B (en) | Object detection and identification method for large-size remote sensing image | |
CN117232523A (en) | Navigation route planning method, device, equipment and medium for orchard robot | |
CN117218467A (en) | Model training method and related device |
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 |