CN113487529B - Cloud map target detection method for meteorological satellite based on yolk - Google Patents

Cloud map target detection method for meteorological satellite based on yolk Download PDF

Info

Publication number
CN113487529B
CN113487529B CN202110783150.4A CN202110783150A CN113487529B CN 113487529 B CN113487529 B CN 113487529B CN 202110783150 A CN202110783150 A CN 202110783150A CN 113487529 B CN113487529 B CN 113487529B
Authority
CN
China
Prior art keywords
cloud
visible light
image
picture
infrared
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.)
Active
Application number
CN202110783150.4A
Other languages
Chinese (zh)
Other versions
CN113487529A (en
Inventor
何丽莉
付豪
白洪涛
曹英晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jilin University
Original Assignee
Jilin University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jilin University filed Critical Jilin University
Priority to CN202110783150.4A priority Critical patent/CN113487529B/en
Publication of CN113487529A publication Critical patent/CN113487529A/en
Application granted granted Critical
Publication of CN113487529B publication Critical patent/CN113487529B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10048Infrared image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30181Earth observation
    • G06T2207/30192Weather; Meteorology

Landscapes

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

Abstract

本发明公开了一种基于Yolo的气象卫星云图目标检测方法,包括:一、提取出多张红外云图和多张可见光云图;二、统计可见光云图中的无效信息,根据可见光云图中的无效信息占比将多张可见光云图划分为:第一可见光云图、第二可见光云图和第三可见光云图;其中,第一可见光云图的无效信息占比ψ1满足ψ1<ψmin;第二可见光云图的无效信息占比ψ2满足ψmin≤ψ2≤ψmax;第三可见光云图的无效信息占比ψ3满足ψ3>ψmax;ψmin为无效信息阈值下限,ψmax为无效信息阈值上限;三、将第一可见光云图与其对应的红外云图进行融合,得到融合云图;将与第一可见光云图相对应的红外云图、融合云图以及第三可见光云图组成待检测云图集;四、采用Yolo算法对检测云图集中的云图进行目标检测,识别出云图中的典型天气现象。

Figure 202110783150

The invention discloses a Yolo-based meteorological satellite cloud image target detection method. The multiple visible light nephograms are divided into: the first visible light nephogram, the second visible light nephogram and the third visible light nephogram; wherein, the invalid information ratio of the first visible light nephogram ψ 1 satisfies ψ 1min ; the invalidity of the second visible light nephogram The information proportion ψ 2 satisfies ψ min ≤ψ 2 ≤ψ max ; the invalid information proportion ψ 3 of the third visible light cloud image satisfies ψ 3max ; ψ min is the lower limit of the invalid information threshold, and ψ max is the upper limit of the invalid information threshold; three , fuse the first visible cloud image with its corresponding infrared cloud image to obtain a fusion cloud image; compose the infrared cloud image corresponding to the first visible cloud image, the fusion cloud image and the third visible cloud image to form a cloud atlas to be detected; 4. Use the Yolo algorithm to detect Target detection is performed on the cloud images in the cloud atlas, and typical weather phenomena in the cloud images are identified.

Figure 202110783150

Description

一种基于Yolo的气象卫星云图目标检测方法A Yolo-based meteorological satellite cloud image target detection method

技术领域technical field

本发明属于气象卫星云图识别检测技术领域,特别涉及一种基于Yolo的气象卫星云图目标检测方法。The invention belongs to the technical field of meteorological satellite cloud image identification and detection, in particular to a Yolo-based meteorological satellite cloud image target detection method.

背景技术Background technique

气象卫星是一种重要的气象工具,而在气象卫星传输的数据中,比较重要的是气象云图文件,它们在天气预报尤其是分析降水等工作中扮演了重要的角色。气象卫星可以获取白天的可见光云图、昼夜的红外云图和水汽分布图等并进行传真传播,提供国内外气象资料利用站接收利用。对于气象预报来说,卫星云图分析的内容包括了区分不同通道的云图,如红外云图和可见光云图,以及分析大范围云的分布,及其对应的天气系统。在对卫星云图进行分析的过程中,有一些基本特征,例如型式(结构),可以通过不同型式的云系或云团与不同的天气系统或物理系统过程向关联,例如台风、气旋、低涡等云系呈螺旋状结构、而锋面、急流和热带辐合带的云系成带状结构[1]。对于此类云系的分析,基本是通过对不同通道云图的形状来进行判断。但是目前还没有比较好的卫星云图分析方法,主要通过人工的目视判读法等,不仅速度慢而且精度低。Meteorological satellites are an important meteorological tool, and among the data transmitted by meteorological satellites, the most important are meteorological cloud image files, which play an important role in weather forecasting, especially precipitation analysis. Meteorological satellites can obtain daytime visible light cloud images, day and night infrared cloud images and water vapor distribution maps, etc. and transmit them by fax, and provide domestic and foreign meteorological data utilization stations for reception and utilization. For weather forecasting, the content of satellite cloud image analysis includes distinguishing cloud images of different channels, such as infrared cloud images and visible light cloud images, as well as analyzing the distribution of large-scale clouds and their corresponding weather systems. In the process of analyzing satellite cloud images, there are some basic features, such as patterns (structures), which can be related to different weather systems or physical system processes through different types of cloud systems or cloud clusters, such as typhoons, cyclones, and low vortices. The iso-cloud system has a spiral structure, while the cloud system of the front, the jet stream and the tropical convergence zone has a belt-like structure [1] . For the analysis of such cloud systems, it is basically judged by the shape of the cloud images of different channels. However, there is no better satellite cloud image analysis method, mainly through manual visual interpretation, which is not only slow but also low in accuracy.

目前卫星云图中有多种通道,但是一般都只使用红外云图来进行云图分析。因为气象卫星在白天和夜晚都可以进行红外云图的探测,它是通过对物体、大气辐射的红外区域的波长探测获得,只要云系有温度就可以被检测出来,和光照无关。在成像过程中,温度越高的区域亮度越高,温度越低的地区,亮度越低。云层的温度和周围大气的温度有明显的区别,这样我们就可以通过红外辐射判断出云的形状。与之类似的有可见光云图,它通过云层对光照的反射直接测量获得,可见光云图的优点是它探测的云的形状纹理等特性较好(好于红外云图),但是可见光云图在光照不充分的情况下无法进行常规探测。事实上在实际生产中,存在对除了红外云图其他通道利用率低的情况。At present, there are various channels in satellite cloud images, but generally only infrared cloud images are used for cloud image analysis. Because meteorological satellites can detect infrared cloud images during the day and night, it is obtained by detecting the wavelength of the infrared region of objects and atmospheric radiation. As long as the cloud system has temperature, it can be detected, regardless of illumination. During the imaging process, areas with higher temperatures have higher brightness, and areas with lower temperatures have lower brightness. The temperature of the cloud layer is significantly different from the temperature of the surrounding atmosphere, so that we can judge the shape of the cloud by infrared radiation. Similar to it is the visible light cloud map, which is obtained by directly measuring the reflection of light by the cloud layer. The advantage of the visible light cloud map is that the shape and texture of the clouds it detects are better (better than the infrared cloud map), but the visible light cloud map is not enough. Routine detection is not possible in this case. In fact, in actual production, there are cases where the utilization of other channels other than the infrared cloud image is low.

因此,因此寻求一个能够更充分的利用卫星云图信息,并且高精度实时的卫星云图检测算法具有重要的研究意义。Therefore, it is of great significance to seek a high-precision real-time satellite cloud image detection algorithm that can make full use of satellite cloud image information.

发明内容SUMMARY OF THE INVENTION

本发明的目的是针对现有技术的缺陷,提供了一种基于Yolo的气象卫星云图目标检测方法,其将红外云图和可见光云图进行融合后,采用Yolo算法进行检测识别出云图中的典型天气现象;能够有效利用可见光云图中的信息,提高卫星云图的检测速度和检测精度。The purpose of the present invention is to provide a Yolo-based meteorological satellite cloud image target detection method, which uses the Yolo algorithm to detect and identify typical weather phenomena in the cloud image after fusing the infrared cloud image and the visible light cloud image. ; It can effectively use the information in the visible light cloud map to improve the detection speed and detection accuracy of the satellite cloud map.

本发明提供的技术方案为:The technical scheme provided by the present invention is:

一种基于Yolo的气象卫星云图目标检测方法,包括如下步骤:A Yolo-based meteorological satellite cloud image target detection method, comprising the following steps:

步骤一、从气象卫星采集的原始卫星云图数据中提取出多张红外云图和多张可见光云图;Step 1, extracting multiple infrared cloud images and multiple visible light cloud images from the original satellite cloud image data collected by the meteorological satellite;

其中,所述红外云图与所述可见光云图为一一对应关系;Wherein, the infrared cloud map and the visible light cloud map are in a one-to-one correspondence;

步骤二、统计所述可见光云图中的无效信息,并且根据所述可见光云图中的无效信息占比将所述多张可见光云图划分为:第一可见光云图、第二可见光云图和第三可见光云图;Step 2: Counting invalid information in the visible light nephogram, and dividing the multiple visible light nephograms into: a first visible light nephogram, a second visible light nephogram and a third visible light nephogram according to the proportion of invalid information in the visible light nephogram;

其中,所述第一可见光云图的无效信息占比ψ1满足ψ1<ψminWherein, the invalid information ratio ψ 1 of the first visible light nephogram satisfies ψ 1min ;

所述第二可见光云图的无效信息占比ψ2满足ψmin≤ψ2≤ψmaxThe invalid information ratio ψ 2 of the second visible light nephogram satisfies ψ min ≤ψ 2 ≤ψ max ;

所述第三可见光云图的无效信息占比ψ3满足ψ3>ψmaxThe invalid information ratio ψ 3 of the third visible light nephogram satisfies ψ 3max ;

式中,ψmin为无效信息阈值下限,ψmax为无效信息阈值上限;In the formula, ψ min is the lower limit of the invalid information threshold, and ψ max is the upper limit of the invalid information threshold;

步骤三、将所述第二可见光云图与其对应的所述红外云图进行融合,得到融合云图;以及Step 3, fuse the second visible nephogram with its corresponding infrared nephogram to obtain a fusion nephogram; and

将与所述第三可见光云图相对应的红外云图、所述融合云图以及所述第一可见光云图组成待检测云图集;Composing the infrared cloud map corresponding to the third visible light cloud map, the fusion cloud map and the first visible light cloud map to form a cloud atlas to be detected;

步骤四、采用Yolo算法对所述检测云图集中的云图进行目标检测,识别出云图中的典型天气现象。Step 4: Use the Yolo algorithm to perform target detection on the cloud images in the detected cloud image set, and identify typical weather phenomena in the cloud images.

优选的是,在所述步骤二中,使用开源opencv库统读取可见光云图的所有像素点,并判断所述可见光云图中的无用像素点的数量占总像素点的比重,得到所述可见光云图中的无效信息占比。Preferably, in the second step, use the open-source opencv library to read all the pixels of the visible light cloud image, and determine the proportion of the number of useless pixels in the visible light cloud image to the total pixel points to obtain the visible light cloud image The percentage of invalid information in .

优选的是,ψmin=25%,ψmax=75%。Preferably, ψ min =25% and ψ max =75%.

优选的是,在所述步骤三中,所述第二可见光云图与其对应的所述红外云图进行融合,包括:Preferably, in the step 3, the second visible light cloud image is fused with the corresponding infrared cloud image, including:

步骤1、将待融合的所述第二可见光云图和所述红外云图缩放为相同尺寸;Step 1, scaling the second visible light cloud image and the infrared cloud image to be fused to the same size;

步骤2、采用拉普拉斯金字塔分别对所述第二可见光云图和所述红外云图进行多尺度表达后,对所述第二可见光云图和所述红外云图进行分层融合;Step 2. After the second visible light cloud image and the infrared cloud image are respectively expressed at multiple scales by using the Laplace pyramid, layered fusion is performed on the second visible light cloud image and the infrared cloud image;

其中,在每个层次进行融合时,根据位置信息将第二可见光云图中有用像素点所在的区域与红外云图中的其他区域融合,得到融合云图;Among them, when merging at each level, the region where the useful pixels in the second visible light cloud image are located is fused with other regions in the infrared cloud image according to the position information to obtain a fusion cloud image;

所述其他区域指红外云图中对应光云图中无用像素点所在位置的区域。The other area refers to the area in the infrared cloud image corresponding to the location of the useless pixel in the light cloud image.

优选的是,在所述步骤四之前还包括:根据卫星云图数据制作COCO数据集格式的训练数据集,对Yolo算法模型进行训练,并对训练模型进行速度和检测精度测试后,得到Yolo算法气象云图检测模型。Preferably, before the step 4, the method further includes: creating a training data set in the COCO data set format according to the satellite cloud image data, training the Yolo algorithm model, and testing the speed and detection accuracy of the training model to obtain the Yolo algorithm meteorological data. Cloud image detection model.

优选的是,所述的基于Yolo的气象卫星云图目标检测方法,还包括对所述Yolo算法气象云图检测模型进行Web端部署,使用Flask框架作为前端框架,Vue框架作为后端框架;以实现在web端上传云图进行检测的功能,达到实时检测的效果。Preferably, the Yolo-based meteorological satellite cloud image target detection method further includes deploying the Yolo algorithm meteorological cloud image detection model on the Web side, using the Flask framework as the front-end framework and the Vue framework as the back-end framework; The function of uploading cloud images on the web side for detection achieves the effect of real-time detection.

优选的是,在所述步骤四中,采用Yolov3或Yolov5算法对所述检测云图集中的云图进行目标检测。Preferably, in the fourth step, the Yolov3 or Yolov5 algorithm is used to perform target detection on the cloud images in the detection cloud atlas.

优选的是,在所述步骤四中,采用Yolov5算法对所述检测云图集中的云图进行目标检测。Preferably, in the fourth step, the Yolov5 algorithm is used to perform target detection on the cloud images in the detected cloud image set.

优选的是,所述典型天气现象包括:冷锋、暖锋、台风、气旋、强对流和激流云系6种天气现象。Preferably, the typical weather phenomena include six weather phenomena: cold front, warm front, typhoon, cyclone, strong convection and torrent cloud system.

本发明的有益效果是:The beneficial effects of the present invention are:

(1)本发明提供的基于Yolo的气象卫星云图目标检测方法,将可见光云图和红外云图进行融合,不仅吸取了可见光云图纹理清晰的优点,也从红外云图弥补了可见光云图黑夜不可测量的缺陷;综合两种云图能够获取更为完整、准确的气象数据。(1) The meteorological satellite cloud image target detection method based on Yolo provided by the present invention, the visible light cloud image and the infrared cloud image are fused, not only absorbs the advantage of the clear texture of the visible light cloud image, but also makes up the visible light cloud image from the infrared cloud image. The defect that cannot be measured at night; Combining the two cloud images can obtain more complete and accurate meteorological data.

(2)本发明提供的基于Yolo的气象卫星云图目标检测方法,能够有效提高卫星云图的检测速度和检测精度,并且达到实时监测的效果。(2) The Yolo-based meteorological satellite cloud image target detection method provided by the present invention can effectively improve the detection speed and detection accuracy of the satellite cloud image, and achieve the effect of real-time monitoring.

附图说明Description of drawings

图1为本发明所述的右半部分为有用信息的可见光云图。FIG. 1 is a visible light cloud diagram with useful information in the right half according to the present invention.

图2为本发明所述的融合前的左侧有部分有用信息的可见光云图。FIG. 2 is a visible light cloud diagram with some useful information on the left side before fusion according to the present invention.

图3为本发明所述的融合前的红外云图。FIG. 3 is an infrared cloud image before fusion according to the present invention.

图4为采用本发明中的融合方法融合后的云图。FIG. 4 is a cloud image after fusion using the fusion method in the present invention.

图5为本发明所述的YOLOv5的算法结构图。FIG. 5 is an algorithm structure diagram of YOLOv5 according to the present invention.

图6为本发明所述的CBL结构图。FIG. 6 is a structural diagram of the CBL according to the present invention.

图7为本发明所述的Res unit结构图。FIG. 7 is a structural diagram of the Res unit according to the present invention.

图8为本发明所述的SPP结构图。FIG. 8 is a structural diagram of the SPP according to the present invention.

图9为本发明所述的YOLOv5算法主要流程图。FIG. 9 is the main flow chart of the YOLOv5 algorithm according to the present invention.

图10为本发明所述的召回率图像。Figure 10 is a recall image according to the present invention.

图11为本发明所述的mAP 0.5图像。Figure 11 is a mAP 0.5 image according to the present invention.

图12为本发明所述的mAP 0.5:0.95图像。Figure 12 is a mAP 0.5:0.95 image according to the present invention.

图13为本发明所述的精度图像。Figure 13 is a precision image according to the present invention.

图14为本发明所述的气象云图检测结果示意图。FIG. 14 is a schematic diagram of a meteorological cloud image detection result according to the present invention.

图15为本发明所述的MVVM框架示意图。FIG. 15 is a schematic diagram of the MVVM framework according to the present invention.

具体实施方式Detailed ways

下面结合附图对本发明做进一步的详细说明,以令本领域技术人员参照说明书文字能够据以实施。The present invention will be further described in detail below with reference to the accompanying drawings, so that those skilled in the art can implement it with reference to the description.

本发明提供了一种基于Yolo的气象卫星云图目标检测方法,针对红外通道(波长10.5~12.5微米)和可见光通道(波长0.4~0.78微米)对不同天气现象的特征,进行两个通道图像的融合,之后使用YOLO算法识别出云图中的典型天气现象。The invention provides a Yolo-based meteorological satellite cloud image target detection method, which is used for infrared channel (wavelength 10.5-12.5 micrometers) and visible light channel (wavelength 0.4-0.78 micrometers) to detect the characteristics of different weather phenomena, and perform image fusion of the two channels , and then use the YOLO algorithm to identify typical weather phenomena in the cloud map.

一、可见光云图与红外云图融合方法。1. Fusion method of visible light cloud image and infrared cloud image.

首先,通过观察VIS图像(可见光云图),可以看出图片中存在着两种无法得到有用信息的数据,一种是由于没有光照无法测量到的数据,背景呈现大面积蓝色;一种是损坏的数据,背景呈现大面积黄色。对于这两种数据,采取直接丢弃并使用红外云图作为检测数据集代替。First of all, by observing the VIS image (visible light cloud map), it can be seen that there are two kinds of data in the picture that cannot obtain useful information. One is that there is no data that cannot be measured by light, and the background shows a large area of blue; the other is damage. , with a large area of yellow in the background. For both kinds of data, we take the direct discard and use the infrared nephogram as the detection dataset instead.

对于部分可见光云图部分存在着大面积的背景信息,但还是有许多有用的信息(气象信息),如图1所示,可见光云图右半部分的信息属于有用信息,但是左半部分信息由于没有光照无法探测到。对于右半部分的信息如果简单抛弃则浪费了云图资源,所以应该采用图像融合的算法,使用红外云图补全可见光云图左半部分的丢失信息然后对融合后的图片进行增强处理。For part of the visible light cloud map, there is a large area of background information, but there is still a lot of useful information (meteorological information). Unable to detect. If the information in the right half is simply discarded, the cloud image resources will be wasted. Therefore, an image fusion algorithm should be used, and the infrared cloud image should be used to complete the missing information in the left half of the visible cloud image, and then the fused image should be enhanced.

在本实施例中,采用图像像素阈值化的处理方法,对图像进行判断,判断哪些图像直接丢弃,哪些图像进行融合,哪些图像直接使用。In this embodiment, the image pixel thresholding processing method is used to judge the images, and judge which images are directly discarded, which images are fused, and which images are directly used.

图像像素阈值化的处理方法流程是:首先对两种图片(可见光云图和红外云图)使用python的cv2函数库中imread函数读取图片,然后使用resize函数把图片进行缩放,目的是让红外云图和可见光云图尺寸大小相同,方便以后的处理。之后读取图片中云图的所有像素点把图片数据转化格式为纯数据格式,判断无用像素点的数量占图像总体的比重,如果超出一定的阈值,则说明可见光云图中包含的无用信息过多,图片直接丢弃,使用红外云图作为替代,如果低于一定的阈值,说明可见光云图中包含的无用信息不多,可以直接利用,如果在两个个阈值之间,说明图片中有用信息和无用信息占比相近,可以使用红外云图填充可见光图中的无用信息。The processing method of image pixel thresholding is as follows: first, use the imread function in python's cv2 function library to read the two images (visible light cloud image and infrared cloud image), and then use the resize function to zoom the image, in order to make the infrared cloud image and the infrared cloud image. The size of the visible light cloud map is the same, which is convenient for future processing. After that, read all the pixels of the cloud image in the image, convert the image data into pure data format, and determine the proportion of useless pixels in the overall image. If it exceeds a certain threshold, it means that there is too much useless information in the visible cloud image. The picture is discarded directly, and the infrared cloud image is used as a substitute. If it is lower than a certain threshold, it means that there is not much useless information in the visible light cloud image and can be used directly. If it is between the two thresholds, it means that the useful information and useless information in the image occupy the In a similar way, the infrared cloud map can be used to fill in the useless information in the visible light map.

在本实施例中,118张卫星云图可见光通道图片中无用信息的占比情况为:47张图片10%以下,7张图片20%以下,11张图片30%以下,6张图片40%以下,6张图片50%以下,5张图片60%以下,2张图片70%以下,4张图片80%以下,4张图片90%以下,26张图片99%以下;可见图片中有相当多的图片存在着大量无用信息。在设置阈值下限25%,阈值上限75%的情况下,有63张图片包含的无用信息较少,33张图片包含无用信息较多,22张图片二者比例相近。对于无用信息较多(高于阈值上限)的可见光云图直接采用红外云图进行替换融合,对于无用信息较少(低于阈值下限)的可见光云图直接使用,无用信息信息适中(处于阈值上限和下限之间)的可见光云图要和红外云图进行深度融合。In this embodiment, the proportion of useless information in the visible light channel pictures of the 118 satellite cloud images is as follows: 47 pictures are below 10%, 7 pictures are below 20%, 11 pictures are below 30%, 6 pictures are below 40%, 6 5 pictures below 50%, 5 pictures below 60%, 2 pictures below 70%, 4 pictures below 80%, 4 pictures below 90%, 26 pictures below 99%; it can be seen that there are quite a few pictures in the picture A lot of useless information. When the lower threshold is 25% and the upper threshold is 75%, 63 images contain less useless information, 33 images contain more useless information, and 22 images have similar proportions. For the visible light cloud image with more useless information (higher than the upper threshold limit), the infrared cloud image is directly used for replacement and fusion. The visible light nephogram and the infrared nephogram should be deeply integrated.

本发明采用改进的拉普拉斯融合算法对可见光云图要和红外云图进行深度融合。The invention adopts the improved Laplace fusion algorithm to deeply fuse the visible light cloud image and the infrared cloud image.

图像金字塔是对于同一种图片的不同分辨率表示,可以表达多种尺度的图片,所以图像金字塔可以用于图片的缩放,图像分割等领域。它对图像进行多尺度表示的原理是进行不断的卷积操作和下采样操作,在每次循环操作的过程中,图片的尺度会被缩小,同时它的表达能力也得到增强。越靠近金字塔顶层的图片对图片的抽象度越高同时损失的信息也越多。为了弥补在下采样过程中信息损失过多的缺陷,拉普拉斯算法可以对传统金字塔进行改进,通过在每层获得金字塔的图像之后,用上一层图像的上采样和本层的图像进行线性计算生成新的图像,从而让图像的细节得到了保留。The image pyramid is a representation of different resolutions for the same image, and can express images of multiple scales, so the image pyramid can be used for image scaling, image segmentation and other fields. The principle of its multi-scale representation of images is to perform continuous convolution operations and downsampling operations. In the process of each loop operation, the scale of the image will be reduced, and its expressive ability will also be enhanced. The image closer to the top of the pyramid has a higher degree of abstraction to the image and also loses more information. In order to make up for the defect of too much information loss in the downsampling process, the Laplacian algorithm can improve the traditional pyramid, by obtaining the image of the pyramid at each layer, using the upsampling of the image of the previous layer and the image of this layer to linearly The computation generates a new image so that the details of the image are preserved.

在上采样的具体过程中,首先通过插值让图片尺寸变大,具体操作是通过判断行列数的奇偶性插入空白占位符,然后使用卷积核进行滤波处理。这样上采样得到的结果和下层的尺寸相同,再把二者进行线性运算就得到了拉普拉斯金字塔。In the specific process of upsampling, the image size is first increased by interpolation. The specific operation is to insert blank placeholders by judging the parity of the number of rows and columns, and then use the convolution kernel for filtering. In this way, the result obtained by upsampling is the same as the size of the lower layer, and the Laplacian pyramid is obtained by linear operation of the two.

拉普拉斯金字塔进行图像融合的方式是首先把图片分解到不同的尺度上,然后在各个层次上分别融合。首先从顶部的金字塔进行融合,融合的方法是计算两个图片中相同位置像素点的梯度,然后和周围像素点进行比较,如果在两幅图片中,其中一幅图片的像素梯度较大,就在融合后的图片中使用相应的图像的像素点,因为梯度大说明图像边缘纹理等信息更为丰富,更应该得到保留。在其他层次的处理过程中,也是通过结合上层的图片信息并进行矩阵运算得到梯度信息,然后进行比较,选择两个图片中梯度较大的作为融合的结果。The way of image fusion in the Laplacian pyramid is to first decompose the image into different scales, and then fuse them separately at each level. First, the fusion is performed from the top pyramid. The method of fusion is to calculate the gradient of the pixels at the same position in the two pictures, and then compare them with the surrounding pixels. If one of the two pictures has a larger pixel gradient, then The pixels of the corresponding image are used in the fused image, because the large gradient indicates that the image edge texture and other information are richer and should be preserved. In the processing of other levels, the gradient information is obtained by combining the image information of the upper layer and performing matrix operations, and then comparing, and selecting the larger gradient in the two images as the fusion result.

本发明是进行红外云图和可见光图的融合。在可见光图中,光照是连续的,所以无用信息基本集中在了图片的某个区域,例如全部在左半部分或者右半部分。因此本发明针对可见光云图的特点对传统的融合算法进行了改进。首先对可见光图和红外云图进行拉普拉斯运算,然后在每个层次进行融合的时候,通过位置信息决定融合后的图像使用原图像中哪个图像的像素信息。在本实施例中,结合上一阶段的实验中选择的75%和25%作为融合阈值,本阶段使用了可见光云图的1/4和红外云图的3/4进行融合。改进的方法具体来说是在每层的融合过程中放弃使用梯度决定的传统模式,而是把可见光云图的1/4直接作为融合后图像前半部分的像素,红外云图的3/4作为融合后图像后半部分的像素,之后分层融合进行处理。The present invention is to perform fusion of infrared cloud image and visible light image. In the visible light image, the illumination is continuous, so the useless information is basically concentrated in a certain area of the image, such as all in the left half or the right half. Therefore, the present invention improves the traditional fusion algorithm according to the characteristics of the visible light cloud image. First, the Laplace operation is performed on the visible light image and the infrared cloud image, and then when each level is fused, the position information is used to determine which image pixel information in the original image is used for the fused image. In this embodiment, combined with 75% and 25% selected in the experiment of the previous stage as the fusion threshold, this stage uses 1/4 of the visible light cloud image and 3/4 of the infrared cloud image for fusion. Specifically, the improved method is to abandon the traditional mode of using gradient determination in the fusion process of each layer, but directly use 1/4 of the visible light cloud image as the pixels in the first half of the image after fusion, and 3/4 of the infrared cloud image as the fusion image. The pixels in the second half of the image are then processed by layered fusion.

由于本发明数据集图片大小为1222*916,融合需要输入2的n次方的图片大小,所以实验首先把图片缩放到512*512,融合完成后再增大到1222*916。Since the image size of the data set of the present invention is 1222*916, the fusion needs to input the image size of the nth power of 2, so the experiment first scales the image to 512*512, and then increases it to 1222*916 after the fusion is completed.

融合前的可见光图和红外云图分别如图2和图3所示,融合后的图像如图4所示。可见融合后的图片拼接自然,两张图片的信息都有所保留,处理效果较好。The visible light image and infrared cloud image before fusion are shown in Figure 2 and Figure 3, respectively, and the image after fusion is shown in Figure 4. It can be seen that the fused pictures are stitched naturally, the information of the two pictures are preserved, and the processing effect is better.

利用本发明提供的方法进行可见光云图和红外云图的融合后,不仅让图片资源的利用率得到了提高,而且让图片信息更为丰富,为下一步图像检测识别做好了铺垫。After the method provided by the invention is used for the fusion of the visible light cloud image and the infrared cloud image, not only the utilization rate of the image resources is improved, but also the image information is enriched, which lays the groundwork for the next image detection and identification.

二、采用YOLO算法对卫星云图进行目标检测建模,用以识别冷锋、暖锋、台风、气旋、强对流和激流云系共计典型的6种天气现象。2. The YOLO algorithm is used to perform target detection and modeling on satellite cloud images to identify six typical weather phenomena, including cold fronts, warm fronts, typhoons, cyclones, strong convection and torrent cloud systems.

1、卫星图像HDF5数据预处理1. Satellite image HDF5 data preprocessing

hdf是一种新型的数据格式,它具有很多优点,首先可以在单个hdf文件中存储所有数据,其次不同格式的数据都可以存入一个hdf文件,例如符号数据、数值数据、图形数据等。用户可以对存储的数据进行不同层次的划分,对每一层可以添加描述信息。分层可以按照用户自己的需要进行,较为灵活。同时hdf文件和其他格式兼容性比较好,可以加入新的数据模式。在不同平台之间传递hdf文件也不需要进行额外的数据转换操作,因为它是和平台无关的格式,在不同平台都可以操作相同的hdf文件。hdf is a new type of data format, it has many advantages, firstly, all data can be stored in a single hdf file, secondly, data in different formats can be stored in one hdf file, such as symbolic data, numerical data, graphic data, etc. Users can divide the stored data into different levels, and add descriptive information to each level. Layering can be carried out according to the user's own needs, which is more flexible. At the same time, hdf files are more compatible with other formats, and new data modes can be added. No additional data conversion operations are required to transfer hdf files between different platforms, because it is a platform-independent format, and the same hdf files can be manipulated on different platforms.

而在卫星云图数据中,hdf格式使用较多。首先hdf文件可以存储图像的图片信息,对于图像的单位信息还可以加以说明。其次对于卫星云图不同通道的信息可以在hdf文件分层次进行存储,方便用户读取。本发明采用的实验云图数据采用了hdf格式的数据。In satellite cloud image data, hdf format is used more. First of all, the hdf file can store the picture information of the image, and the unit information of the image can also be explained. Secondly, the information of different channels of the satellite cloud image can be stored hierarchically in the hdf file, which is convenient for users to read. The experimental cloud image data adopted in the present invention adopts data in hdf format.

本发明使用的卫星云图数据是从全圆盘图截取北纬0-60度、东经70-150度范围内云图,生成等经纬度投影文件(hdf文件)。每个hdf文件包含14个数据集,存储14个通道的等经纬投影数据。数据集名称为:LonLatChannelB04、LonLatChannelB05、LonLatChannelB06、LonLatChannelB09、LonLatChannelB10、LonLatChannelB11、LonLatChannelB12、LonLatChannelB14、LonLatChannelB16、LonLatChannelIR1、LonLatChannelIR2、LonLatChannelIR3、LonLatChannelIR4、LonLatChannelVIS。数据集名称的后3个字符表示通道名称,如B04,IR1,VIS。数据集首行首列的数据表示北纬60度、东经70度处的数据,数据集末行末列的数据表示北纬0度、东经150度处的数据。其中VIS通道的数据集为3666行、4888列,其他通道数据集均为916行、1222列。所有数据集的数据类型都是16位大端无符号整数。B04、B05、B06和VIS数据集中数据的单位是ALBEDO(%),B09、B10、B11、B12、B14、B16、IR1、IR2、IR3、IR4数据集单位是KELVIN。The satellite cloud image data used in the present invention is to intercept cloud images in the range of 0-60 degrees north latitude and 70-150 degrees east longitude from the full disk image, and generate equal longitude and latitude projection files (hdf files). Each hdf file contains 14 datasets, storing 14 channels of isolatitude and longitude projection data. The dataset names are: LonLatChannelB04, LonLatChannelB05, LonLatChannelB06, LonLatChannelB09, LonLatChannelB10, LonLatChannelB11, LonLatChannelB12, LonLatChannelB14, LonLatChannelB16, LonLatChannelIR1, LonLatChannelIR2, LonLatChannelIR3, LonLatChannelIR4, LonLatChannelVIS. The last 3 characters of the dataset name represent the channel name, such as B04, IR1, VIS. The data in the first row and first column of the data set represents the data at 60 degrees north latitude and 70 degrees east longitude, and the data in the last row and last column of the data set represents the data at 0 degrees north latitude and 150 degrees east longitude. Among them, the data set of the VIS channel is 3666 rows and 4888 columns, and the other channel data sets are 916 rows and 1222 columns. The data type of all datasets is a 16-bit big-endian unsigned integer. The unit of data in B04, B05, B06 and VIS datasets is ALBEDO (%), and the unit of B09, B10, B11, B12, B14, B16, IR1, IR2, IR3, IR4 datasets is KELVIN.

使用python的h5py库,步骤如下:Using python's h5py library, the steps are as follows:

(1)首先使用h5py.File(“路径名”)读取文件(1) First use h5py.File("pathname") to read the file

(2)按照字典格式读取通道的文件(2) Read the file of the channel according to the dictionary format

(3)使用matplotlib库显示图片。通过函数pyplot.imshow()和函数pyplot()函数可以简单地显示图像。(3) Use the matplotlib library to display pictures. The image can be displayed simply by the function pyplot.imshow() and the function pyplot().

以“H8_ALL_PROJ_L2_20190114_0500.hdf”文件为例,读取并显示B04通道图像。其中,图像宽度为1222,高度为916,使用了索引颜色模式。Take the "H8_ALL_PROJ_L2_20190114_0500.hdf" file as an example, read and display the B04 channel image. Among them, the image width is 1222, the height is 916, and the indexed color mode is used.

之后需要把显示的图片按照原来的分辨率保存下来,来用于之后神经网络的训练。如果直接使用matplotlib.pyplot中的savefig函数保存图片,那么保存的图片不仅仅含有坐标轴,而且含有上下左右的空边,这样会让训练的输入和我们的预期不相符,图片的分辨率大于真实数据显示,标记文件也会错位。所以本发明进行了matlabplotlib库的一些设置。Afterwards, the displayed image needs to be saved at the original resolution for later neural network training. If you directly use the savefig function in matplotlib.pyplot to save the picture, then the saved picture not only contains the coordinate axis, but also contains the upper, lower, left and right empty edges, which will make the training input inconsistent with our expectations, and the resolution of the picture is larger than the real one The data shows that markup files are also misplaced. Therefore, some settings of the matlabplotlib library are carried out in the present invention.

首先使用set_size_inches函数对图片大小进行设置,然后使用去掉坐标轴显示,之后在用subplots_adjust函数和margins函数去掉图片四周的空白,最后再用savefig函数保存图片,得到了理想的图片。First, use the set_size_inches function to set the size of the picture, then use the remove coordinate axis display, then use the subplots_adjust function and the margins function to remove the blanks around the picture, and finally use the savefig function to save the picture, and get the ideal picture.

最后循环读取每个文件以及他们的每个通道数据,把他们保存为文件。Finally, read each file and each of their channel data in a loop, and save them as files.

由有关气象专家提供的标记文件为csv格式的标记文件,包括type、name、top、left、bottom、right、filename7个字段。为了进行训练,需要type、top、left、bottom、right、filename6个字段。The marker file provided by the relevant meteorological experts is a marker file in csv format, including seven fields of type, name, top, left, bottom, right, and filename. For training, six fields of type, top, left, bottom, right, and filename are required.

在“H8_ALL_PROJ_L2_20190114_0500.hdf”文件中,可以截取部分样本简单显示一下。In the "H8_ALL_PROJ_L2_20190114_0500.hdf" file, some samples can be intercepted and displayed briefly.

2、构建目标检测标记数据集2. Build a target detection marker dataset

YOLO算法基于一个前馈卷积神经网络完成。YOLOv5使用了CSPDaeknet(跨阶段局域网络)作为Backbone,并且使用了PANET(路径聚合网络)和SPP(空间金字塔池化)作为Neck,并且使用和YOLOv3一样的Head。在YOLOv5中,各个部分的激活函数有所区别,在中间层和隐含层使用的是Leaky ReLU,在检测层使用Sigmod激活函数。这些激活函数在计算代价上相比v4算法更小。YOLOv5配置了两种优化函数,并分别给出了相应训练使用的初始化超参数。随机梯度优化,对于大型数据集的训练效果更好,而Adam优化器对较小自定义数据集的训练效果更好The YOLO algorithm is based on a feedforward convolutional neural network. YOLOv5 uses CSPDaeknet (cross-stage local area network) as Backbone, and uses PANET (path aggregation network) and SPP (spatial pyramid pooling) as Neck, and uses the same Head as YOLOv3. In YOLOv5, the activation function of each part is different. Leaky ReLU is used in the middle layer and hidden layer, and Sigmod activation function is used in the detection layer. These activation functions are computationally less expensive than the v4 algorithm. YOLOv5 is configured with two optimization functions, and the initialization hyperparameters used for the corresponding training are given respectively. Stochastic gradient optimization, which trains better on large datasets, while Adam optimizer trains better on smaller custom datasets

YOLOv5网络主要由4个组件组成:The YOLOv5 network mainly consists of 4 components:

1)输入层:对输入图像进行数据增强处理1) Input layer: perform data enhancement processing on the input image

2)Backbone:通过对图像进行不同分辨率大小上的聚合形成图像更为丰富的特征2) Backbone: Aggregate images at different resolutions to form richer features of images

3)Neck:对输入的图像特征进行混合处理3) Neck: Mixing the input image features

4)Predication:预测边界框以及类别的置信度4) Prediction: Predict the bounding box and the confidence of the category

算法结构如图5所示。The algorithm structure is shown in Figure 5.

各个组件结构和张量计算如下:The individual component structures and tensors are calculated as follows:

(1)CBL(如图6所示):对传统的卷积操作等进行组合生成新的网络部件,这是网络中的最基本的组件。(1) CBL (as shown in Figure 6): Combine traditional convolution operations, etc. to generate new network components, which are the most basic components in the network.

(2)Res unit(如图7所示):在结构中存在不同数目连续的残差结构,更多的res_unit可以让网络可以构建得更深(2) Res unit (as shown in Figure 7): There are different numbers of continuous residual structures in the structure, and more res_units can allow the network to be built deeper

(3)Concat:把两个张量按照某个维度组合成一个张量。(3) Concat: Combine two tensors into one tensor according to a certain dimension.

(4)Add:把两个张量在相同维度上进行加法操作,生成同样大小的结果(4) Add: Add two tensors on the same dimension to generate results of the same size

(5)Spp结构(如图8所示):首先在不同尺寸分别进行采样操作,之后把不同的结果通过计算融合到一块,最后再次进行卷积修改输出的大小。(5) Spp structure (as shown in Figure 8): First, sampling operations are performed at different sizes, and then different results are fused into one block by calculation, and finally convolution is performed again to modify the size of the output.

本实施例中采用单阶段检测YOLOv5算法,其主要流程如图9所示。In this embodiment, the single-stage detection YOLOv5 algorithm is adopted, and the main process is shown in FIG. 9 .

YOLOv5的数据集训练需要COCO数据集,本发明首先制作VOC2007数据集,之后进行转化。The data set training of YOLOv5 requires the COCO data set. The present invention first produces the VOC2007 data set, and then converts it.

新建文件夹,用来存储整个数据集:Create a new folder to store the entire dataset:

对图片进行标记的工具有很多本发明选择了labelimg开源工具,保存之后,生成一个同名的xml格式的文件,用来保存标记信息。其中object字段用来保存每个样本信息,文件中存在两条重要的数据,其中的bndbox保存目标的位置,name保存目标的类别。There are many tools for labeling pictures. The present invention selects the labelimg open source tool. After saving, a file in xml format with the same name is generated to save the label information. The object field is used to save the information of each sample. There are two important data in the file. The bndbox saves the location of the target, and the name saves the category of the target.

由于本发明使用了大量的标记数据,若使用此工具进行逐条标记,将会较为繁琐,所以本发明使用了一个简单的python程序从前文中的存储标记的csv文件中读取需要的6个字段并根据上图所示文件格式生成对应的xml标记文件。Since the present invention uses a large amount of marked data, it will be cumbersome to use this tool to mark each item one by one, so the present invention uses a simple python program to read the required 6 fields from the csv file that stores the mark in the preceding paragraph and Generate the corresponding xml tag file according to the file format shown in the figure above.

然后把xml标注文件放入相应的文件夹中。Then put the xml annotation file into the corresponding folder.

使用txt文件中存放每个类别使用的训练文件的名称,本发明使用了一个简单的python程序生成,之后需要把制作的数据转化为coco数据集,也是通过一个python文件实现。在每个train或val目录下存放着相应的图片名或标签文件名。The name of the training file used by each category is stored in the txt file. The present invention uses a simple python program to generate, and then the data needs to be converted into a coco data set, which is also realized by a python file. The corresponding image name or label file name is stored in each train or val directory.

3、训练参数设置3. Training parameter settings

在准备好数据集之后,对模型进行进一步参数配置,本实施例用了YOLOv5网络精度最高的YOLOv5x模型。After the data set is prepared, the model is further configured with parameters. In this example, the YOLOv5x model with the highest accuracy of the YOLOv5 network is used.

(1)设置模型配置文件(1) Set the model configuration file

根据yolov5x.yaml文件修改待检测物体的类别为6。Modify the category of the object to be detected to 6 according to the yolov5x.yaml file.

(2)设置训练配置文件(2) Set the training profile

根据coco.yaml文件修改训练文件夹和验证文件夹路径,物体的类别以及每种类别的标记。According to the coco.yaml file, modify the training folder and verification folder paths, the category of the object and the label of each category.

4、训练与评估4. Training and evaluation

训练环境配置如下:The training environment is configured as follows:

(1)操作系统:CentOS Linux release 7.8.2003(Core)(1) Operating system: CentOS Linux release 7.8.2003 (Core)

(2)显卡:8块TITAN X显卡(实验使用了其中2块)(2) Graphics card: 8 TITAN X graphics cards (2 of which were used in the experiment)

(3)cpu:56个(3) cpu: 56

(4)内存:256G(4) Memory: 256G

(5)cuda版本:11.0(5) cuda version: 11.0

(6)pytorch版本:1.7.1(6)pytorch version: 1.7.1

算法在训练之前设置超参数。The algorithm sets hyperparameters before training.

训练流程:Training process:

(1)设置DDP模式的参数(1) Set the parameters of DDP mode

可以设置全局进程的个数,进程编号等。You can set the number of global processes, process number, etc.

(2)设置是否恢复训练(2) Set whether to resume training

(3)加载处理超参数列表,(3) Load processing hyperparameter list,

(4)模型训练(4) Model training

首先获取训练日志的路径,需要读取result文件,result文件包括了每次迭代时保存的训练结果,对上一次运行结果进行分析之后可以更好地进行下一步的实验。之后需要进行一些模型的设置,例如设置下保存ground truth的参数,一般比3小的时候会被保存,训练时会产生日志文件,算法采用evolve文件夹进行保存。设置在每次迭代过程中产生的权重文件保存的路径,设置每次训练的结果保存的路径。然后从程序中获取一些信息,例如训练的轮次、数据集输入的批次、训练的总批次(分布式训练)、训练一次图片之后产生的权重文件、进程序号(分布式训练)。然后需要保存运行时的一些设置,保存超参数文件hyp和项目的命令参数opt。分辨cuda的类型是否采用了GPU进行训练,获取识别目标的类别数量和类别名字,如果在命令行参数中设置了single_cls那么待检测目标都属于一类。接着读取pt格式的模型参数文件。如果选择采用预训练,那么可以调用脚本从网络自动下载预训练模型,之后创建模型,也可以用命令行或者配置文件设置参数。使用文件或者命令行区别就在于是否设置了恢复参数,若是会按照配置文件创建模型;参数的设置会导致锚框参数中关键字的设置,即是否加载预定义锚框的问题,要是训练设置了恢复参数,会在上次训练权重参数的基础上来继续训练;文件已经为用户提供了数据集默认的训练参数,默认是使用文件中自定义权重,如果没有设置参数的话,用户直接设置锚框再加载预训练权重进行训练,用户自定义的设置就会被文件设置覆盖,文件的设置具有更高的优先级;所以在程序运行之前需要设置决定使用哪种参数,若采用权重文件也进行训练过程的话,权重文件种锚框的位置就被丢弃使用用户自己定义的锚框;若设置了恢复参数,那么就不丢弃参数,把权重和锚框配置文件一起加载。还需要设置冻结层模型,设置模拟的处理批次的图像大小batch_size,选择使用合适的优化器,并设置pg0组的优化方式,设置训练过程的参数weight、对特征批量归一化的bn的优化方式,设置偏置参数biases的优化方式,之后把优化的信息打印出来。还需要设置学习率衰减测速度,模型会使用余弦退火的方式进行衰减之后恢复训练。初始化最开始的一代训练数据选择是否使用之前最好的训练结果进行继续训练。然后根据best_gitness来把训练过程中最好的参数文件的权重保存为best.pt。然后进行判断,如果之前训练过程已经完成了那么就进行新一轮的实验,进行参数的设置,设置加载优化器和best_fitness,加载训练结果result.txt,加载训练的轮次。如果设置了恢复参数还要备份权重,尽管目前的恢复参数可以近似完美不出错,但是在参数的恢复过程中可能出现别的问题丢失了以前的权重,采用额外的备份操作可以让数据更为安全。若设置的训练次数epoches比较大,那么新设置的epoches为需要再训练的轮次数而不是总的轮次数。然后从模型结构文件读取模型的总步长和模型输入图片分辨率,检查用户设置的输入图片分辨率确保能够整除步长gs。然后查看是否设置采用分布式训练,设置rank进程号和以及是否使用仅支持本机多卡的DataParallel模式,当rank设置为-1并且gpu只有一个,会跳过分布式训练。之后同步BatchNorm,使用跨卡同步bn。为模型创建EMA指数滑动平均,如果GPU进程数大于1,这个指数就不用创建。然后创建训练集的dataloader,获取标签中最大的类别值,并和类别数做比较,如果大于类别数则表示出现了问题。这之后开始设置模型。根据自己的数据集的类别数设置分类损失的系数,设置类别数,超参数。然后设置giou的值在objectness loss中做标签的系数,根据labels初始化图片采样权重,获取类别的名字。接着开始设置类别的频率,将所有样本的标签拼接到一起,统计后做可视化。获取所有样本的类别,然后根据这个统计,设置长宽和中心位置做可视化。计算默认锚点anchor与数据集标签框的长宽比值。如果标签框满足上面条件的数量小于总数的99%,那么会使用一些无监督机器学习方法获取新的锚点设置。First, to obtain the path of the training log, you need to read the result file. The result file includes the training results saved in each iteration. After analyzing the results of the previous operation, you can better perform the next experiment. After that, some model settings need to be performed, such as setting the parameters for saving the ground truth, which will generally be saved when it is smaller than 3, and log files will be generated during training, and the algorithm will be saved in the evolve folder. Set the path to save the weight files generated in each iteration, and set the path to save the results of each training. Then get some information from the program, such as the training round, the batch of data set input, the total batch of training (distributed training), the weight file generated after training a picture, and the program number (distributed training). Then you need to save some settings at runtime, save the hyperparameter file hyp and the command parameter opt of the project. Identify whether the type of cuda uses GPU for training, and obtain the number of categories and category names of the recognized targets. If single_cls is set in the command line parameters, the targets to be detected belong to one category. Then read the model parameter file in pt format. If you choose to use pre-training, you can call the script to automatically download the pre-trained model from the network, and then create the model, or you can use the command line or configuration file to set parameters. The difference between using the file or the command line is whether the recovery parameters are set. If the model will be created according to the configuration file; the parameter setting will lead to the setting of the keywords in the anchor box parameters, that is, whether to load the predefined anchor box, if the training is set. Restoring parameters will continue training on the basis of the last training weight parameters; the file has provided the user with the default training parameters of the dataset, the default is to use the custom weight in the file, if no parameters are set, the user can directly set the anchor box and then Load the pre-training weights for training, the user-defined settings will be overwritten by the file settings, and the file settings have a higher priority; so before the program runs, you need to set the parameters to decide which parameters to use. If the weight file is used, the training process is also performed. If so, the position of the anchor box in the weight file is discarded and the anchor box defined by the user is used; if the recovery parameters are set, the parameters are not discarded, and the weight and the anchor box configuration file are loaded together. It is also necessary to set the frozen layer model, set the image size batch_size of the simulated processing batch, select the appropriate optimizer, and set the optimization method of the pg0 group, set the parameter weight of the training process, and optimize the bn for batch normalization of features. mode, set the optimization mode of the bias parameter biases, and then print the optimized information. You also need to set the learning rate decay to measure the speed, and the model will use cosine annealing to decay and then resume training. Initialize the first generation of training data to choose whether to continue training with the best previous training results. Then save the weight of the best parameter file during the training process as best.pt according to best_gitness. Then make a judgment. If the previous training process has been completed, then perform a new round of experiments, set parameters, set the loading optimizer and best_fitness, load the training result result.txt, and load the training round. If the recovery parameters are set, the weights should be backed up. Although the current recovery parameters can be approximately perfect without errors, other problems may occur during the parameter recovery process and the previous weights may be lost. Using additional backup operations can make the data more secure. . If the set number of training epoches is relatively large, the newly set epoches is the number of rounds that need to be retrained instead of the total number of rounds. Then read the total step size of the model and the model input image resolution from the model structure file, and check the input image resolution set by the user to ensure that the step size gs is divisible. Then check whether the distributed training is set, set the rank process number and whether to use the DataParallel mode that only supports native multi-card, when the rank is set to -1 and there is only one gpu, distributed training will be skipped. After synchronizing BatchNorm, use cross-card synchronization bn. Create an EMA exponential moving average for the model. If the number of GPU processes is greater than 1, this index is not created. Then create the dataloader of the training set, get the largest category value in the label, and compare it with the number of categories. If it is greater than the number of categories, there is a problem. After this start setting up the model. Set the coefficient of classification loss, set the number of categories, and hyperparameters according to the number of categories of your own dataset. Then set the value of giou as the coefficient of the label in the objectness loss, initialize the image sampling weight according to the labels, and obtain the name of the category. Then start to set the frequency of the categories, stitch the labels of all samples together, and visualize them after statistics. Get the categories of all samples, and then set the length, width and center position for visualization based on this statistic. Calculates the aspect ratio value of the default anchor point anchor and the dataset label box. If the number of label boxes satisfying the above conditions is less than 99% of the total, then some unsupervised machine learning methods are used to obtain new anchor settings.

之后开始模型的训练。设置热身训练的迭代次数,初始化mAP和results。设置学习率衰减所进行到的轮次,目的是在打断训练后,恢复参数可以接着训练也能正常的衔接之前的训练进行学习率衰减。然后打印训练和测试输入图片的分辨率,加载图片时调用的cpu进程数,判断epoches开始的序号数。然后进入每个epoch的循环训练。如果设置进行图片采样策略则根据前面初始化的图片采样权重model.class_weights以及maps配合每张图片包含的类别数,通过random.choices生成图片索引indices从而选择采样。如果设置了DDP模式,则广播采样策略。然后初始化训练时打印的平均损失信息。若在DDP模式下打乱数据,ddp.sampler的随机采样数据是基于epoch+seed作为随机种子,所以每次epoch不同,随机数种子也不同。然后使用tqdm创建进度条,方便训练时信息的展示。然后计算迭代的次数iteration。在前nw次迭代中使用热身训练,并通过一定的方式选取accumulate和学习率。偏置参数bias的学习率从0.1下降到基准学习率lr*lf(epoch),其他的学习率从0增加到lr*lf(epoch)。lf为之前设置的余弦退火的衰减系数,参数momentmum从0.9逐渐增加。然后进行多尺度训练,在imgsz*0.5,imgsz*1.5+gs中随机选取尺寸。然后进行混合精度向前传播,并计算损失包括分类损失,onjectness损失,框的回归损失,loss总损失值。loss的值存储loss_items为一个元组,包含分类损失,objectness损失,框的回归损失和总损失。之后进行反向传播。模型反向传播一定次数后再根据累积的梯度更新一次参数然后进行学习率衰减。如果是单GPU或者cpu进行训练,还需要更新mAP,包括更新EMA属性,添加include的属性。判断该epoch是否是最后一轮。然后对测试集进行测试,计算mAP等指标。同时负责将指标写进result文件,如果设置了bucket命令行参数还需要把result文件上传到网络。然后设置可视化工具Tensorbord,添加模型指标,训练损失等信息到tensorboard显示。更新最好的mAP通过best_fitness。之后进行保存模型的工作,此外还需要保存epoch,results,optimizer等信息,optimizer将在最后一轮完成后保存。其他的参数,例如model保存的是EMA的模型。在模型训练完成之后,使用strip_optimizer函数将optimizer从ckpt中剔除,并且为了减少变量存储,对模型进行model.half操作,将Float32的模型变成Float16,可以减少模型大小,提高inference速度。结束之后对results文件进行可视化操作。最后释放显卡的显存。Then start the training of the model. Set the number of iterations for warm-up training, initialize mAP and results. Set the number of rounds for the learning rate decay. The purpose is that after the training is interrupted, the recovery parameters can continue the training and can also connect to the previous training for the learning rate decay. Then print the resolution of the training and test input images, the number of cpu processes called when loading the image, and determine the number of serial numbers that epoches start with. Then enter the loop training for each epoch. If the picture sampling strategy is set, according to the previously initialized picture sampling weight model.class_weights and maps and the number of categories contained in each picture, the picture index indices are generated through random.choices to select the sampling. If DDP mode is set, the sampling policy is broadcast. Then initialize the average loss information printed during training. If the data is scrambled in DDP mode, the random sampling data of ddp.sampler is based on epoch+seed as the random seed, so each time the epoch is different, the random number seed is also different. Then use tqdm to create a progress bar to facilitate the display of information during training. Then calculate the number of iterations. Use warm-up training in the first nw iterations, and choose accumulate and learning rate in a certain way. The learning rate of the bias parameter is decreased from 0.1 to the baseline learning rate lr*lf(epoch), and the other learning rates are increased from 0 to lr*lf(epoch). lf is the decay coefficient of the cosine annealing set before, and the parameter momentmum gradually increases from 0.9. Then multi-scale training is performed, and the size is randomly selected from imgsz*0.5, imgsz*1.5+gs. Then carry out mixed-precision forward propagation, and calculate the loss including classification loss, injectness loss, box regression loss, and total loss value. The value of loss is stored loss_items as a tuple containing classification loss, objectness loss, box regression loss and total loss. Then do backpropagation. The model backpropagates a certain number of times, then updates the parameters once according to the accumulated gradient and then performs learning rate decay. If it is a single GPU or cpu for training, mAP needs to be updated, including updating the EMA attribute and adding the include attribute. Determine whether the epoch is the last round. Then the test set is tested, and indicators such as mAP are calculated. At the same time, it is responsible for writing the indicators into the result file. If the bucket command line parameter is set, the result file needs to be uploaded to the network. Then set the visualization tool Tensorbord, add model metrics, training loss and other information to the tensorboard display. Update the best mAP by best_fitness. After that, save the model. In addition, you need to save information such as epoch, results, optimizer, etc. The optimizer will be saved after the last round is completed. Other parameters, such as model saves the EMA model. After the model training is completed, use the strip_optimizer function to remove the optimizer from the ckpt, and in order to reduce the variable storage, perform the model.half operation on the model to change the Float32 model to Float16, which can reduce the model size and improve the inference speed. After the end, visualize the results file. Finally free the video memory of the graphics card.

对超参数进行进化:Evolve the hyperparameters:

在conda环境中,使用train.py文件,设置device为“cuda0,1”,设置好参数配置文件,模型迭代的批数据量大小设置为16。In the conda environment, use the train.py file, set the device to "cuda0, 1", set the parameter configuration file, and set the batch size of model iteration to 16.

在经过了1小时13分钟35秒的300次epoch的训练之后得到了结果。The results were obtained after training for 300 epochs of 1 hour 13 minutes 35 seconds.

实验召回率图像如图10所示,实验最高达到96%以上。mAP_0.5图像如图11所示,最高达到97%以上;mAP_0.5:0.95图像如图12所示。精度图像如图13所示,最高精度接近99%。The experimental recall image is shown in Figure 10, and the experiment reaches a maximum of more than 96%. The mAP_0.5 image is shown in Figure 11, and the highest is more than 97%; the mAP_0.5:0.95 image is shown in Figure 12. The accuracy image is shown in Fig. 13, the highest accuracy is close to 99%.

mAP即mean AP,对神经网络结果进行评价的时候这个值反映了模型的优良程度,mAP值越高,对应的分类算法精度更高,性能更好。mAP的计算方法是,首先计算出每种目标检测的AP值,然后对它们进行加权平均。mAP最小为0,最大为1,数值越大越好。这个判断标准在目标检测算法最主要。本实验使用的YOLOv5x模型,所有类别平均精度值接近99%。同时本实验的精度、召回率、PR曲线等都达到了不错的效果。在取得良好训练结果的同时,我们的训练速度非常快,可以达到30ms左右。mAP is mean AP. When evaluating the results of the neural network, this value reflects the goodness of the model. The higher the mAP value, the higher the accuracy and the better performance of the corresponding classification algorithm. mAP is calculated by first calculating the AP value for each target detection and then taking a weighted average of them. The minimum value of mAP is 0 and the maximum value is 1. The larger the value, the better. This criterion is the most important in the target detection algorithm. The YOLOv5x model used in this experiment has an average precision value close to 99% for all categories. At the same time, the precision, recall rate and PR curve of this experiment have achieved good results. While achieving good training results, our training speed is very fast, which can reach around 30ms.

在另一实施例中,在相同条件下使用YOLOv3算法进行了实验,YOLOv3算法在精度和召回率等方面稍微弱于YOLOv5,但是YOLOv3的训练时间较短,在相同条件下使用了49分钟35秒。即在同样迭代了300次情况下,YOLOv3算法训练时间比YOLOv5算法减少了24分钟,召回率提高了1.43%,但是YOLOv3算法精度比YOLOv5下降了3.75%。所以如果对精度要求不是特别高的情况下,可以选择使用YOLOv3算法进行更快的训练。In another embodiment, experiments were conducted using the YOLOv3 algorithm under the same conditions. The YOLOv3 algorithm was slightly weaker than YOLOv5 in terms of precision and recall, but the training time of YOLOv3 was shorter, using 49 minutes and 35 seconds under the same conditions. . That is, in the same case of 300 iterations, the training time of the YOLOv3 algorithm is reduced by 24 minutes compared with the YOLOv5 algorithm, and the recall rate is increased by 1.43%, but the accuracy of the YOLOv3 algorithm is 3.75% lower than that of the YOLOv5 algorithm. So if the accuracy requirements are not particularly high, you can choose to use the YOLOv3 algorithm for faster training.

5、结果测试与分析5. Results testing and analysis

测试过程如下所述,首先判断是否是在训练时调用test,如果是则获取训练时的设备。否则直接调用,选择设备。删除之前的test_batch0_gt.jpg和test_batch0_pred.jpg。然后加载模型,检查输入图片的分辨率是否可以被32整除。如果设备不是cpu并且GPU的数目为1,则将模型由Float32转化为FLoat16,以提高向前传播的速度。然后进行配置,加载数据配置信息,设置iou阈值,从0.5到0.95每间隔0.05取一次。然后设置Dataloader,把rect参数设置为true因为yolov5的测试评估是基于矩形推理的。The testing process is as follows. First, determine whether the test is called during training, and if so, obtain the equipment during training. Otherwise, call it directly and select the device. Delete the previous test_batch0_gt.jpg and test_batch0_pred.jpg. Then load the model and check if the resolution of the input image is divisible by 32. If the device is not a cpu and the number of GPUs is 1, convert the model from Float32 to FLoat16 to improve the speed of forward propagation. Then configure it, load the data configuration information, and set the iou threshold, which is taken every 0.05 from 0.5 to 0.95. Then set the Dataloader and set the rect parameter to true because the test evaluation of yolov5 is based on rectangle inference.

初始化测试参数和路径索引信息。设置tqdm进度条的显示信息。初始化指标,时间。初始化测试集的损失,初始化json文件的字典统计信息,ap。然后禁用梯度传播,让模型进行向前传播,累计计算向前传播的时间。计算损失,如果是在训练时进行的test,需要通过训练结果计算并返回测试集的GIoU,obj,cls损失。之后设置置信度阈值,iou阈值并进行NMS处理,计算累计处理NMS的时间。Initialize test parameters and path index information. Set the display information of the tqdm progress bar. Initialize indicator, time. Initialize loss for test set, initialize dictionary stats for json file, ap. Then disable gradient propagation, let the model do forward propagation, and calculate the time of forward propagation cumulatively. Calculate the loss. If it is a test performed during training, it is necessary to calculate and return the GIoU, obj, and cls losses of the test set through the training results. Then set the confidence threshold and iou threshold and perform NMS processing, and calculate the cumulative processing time of NMS.

然后为每一张图片进行统计,写入预测信息到txt文件中,生成json文件字典,统计tp等。首先获取第si张图片的标签信息,包括class,x,y,w,h。获取标签类别,统计测试图片数量,如果预测为空,那么添加空的信息到stats中,保存预测结果到txt文件。通过获得对应图片的长和宽,然后根据图片名字设置txt文件的路径。将预测框的坐标调整到基于其原本长宽的坐标。保存类别和坐标到txt文件。修正预测坐标到图片内部。保存coco格式的json文件字典。首先获取图片id,获取框,将框调整为基于原图大小的,转换为xywh格式。格式的通道次序发生了变化,coco的json格式中的框坐标格式为xyzh,此处的xy为左上角坐标,也就是coco的json格式的坐标格式为:左上角坐标+长宽,所以需要将中心点坐标转换到左上角。之后初始化预测评定。存放已检测到的目标,获得xyxy格式的框并乘以wh,对图片中的每个类单独处理,计算标签框该类别的索引和预测框该类别的索引。计算预测框的iou值,选出最大的ious值。然后把检测到的目标添加到detected,获取不同iou阈值下的true positive。然后将每张图片的结构统计到stats里面。画出第一个batch的图片的ground truth和预测框并保存。然后将stats列表的信息拼接到一起。打印指标结果并细节展示每一个类别的指标。打印向前传播耗费的时间、nms的时间、总时间。采用之前保存的json格式预测的结果,并通过cocoapi评估指标,测试集的标签也需要转成coco的json格式。首先获取图片id,获取预测框的json文件路径并打开。获取并初始化测试集标签的json文件。初始化预测框的文件。创建评估器。评估,然后展示结果。最后返回测试指标结果。Then make statistics for each picture, write the prediction information to the txt file, generate a json file dictionary, count tp, etc. First obtain the label information of the si-th image, including class, x, y, w, h. Get the label category, count the number of test images, if the prediction is empty, add empty information to stats and save the prediction result to a txt file. By obtaining the length and width of the corresponding image, and then setting the path of the txt file according to the image name. Adjust the coordinates of the prediction box to the coordinates based on its original length and width. Save the categories and coordinates to a txt file. Correct the predicted coordinates to the inside of the image. Save a dictionary of json files in coco format. First get the picture id, get the frame, adjust the frame to the size of the original image, and convert it to xywh format. The channel order of the format has changed. The frame coordinate format in coco's json format is xyzh, where xy is the upper-left corner coordinate, that is, the coordinate format of coco's json format is: upper-left corner coordinate + length and width, so it is necessary to set The coordinates of the center point are converted to the upper left corner. The prediction evaluation is then initialized. Store the detected target, obtain the box in xyxy format and multiply it by wh, process each class in the picture separately, calculate the index of the label box and the index of the prediction box. Calculate the iou value of the prediction box and select the largest ious value. Then add the detected target to detected to get true positives under different iou thresholds. Then count the structure of each image into stats. Draw the ground truth and prediction box of the first batch of pictures and save. The information from the stats list is then stitched together. Print the indicator results and show the indicators for each category in detail. Print the time spent on forward propagation, the time in nms, and the total time. Using the previously saved json format prediction results, and evaluating the indicators through cocoapi, the labels of the test set also need to be converted into coco json format. First get the image id, get the json file path of the prediction box and open it. Get and initialize a json file of test set labels. File to initialize prediction boxes. Create an evaluator. Evaluate and present the results. Finally, return the test indicator results.

本发明对所有的图片进行了一次检测,可以在图片中框出云的种类以及它们的置信度,其中用0表示冷锋、1表示暖锋、2表示台风、3表示气旋、4表示强对流、5表示急流云系。云图检测效果如图14所示。图14中,两个位置用置信框圈出检测出的目标所属的类别为3(气旋),以及显示预测的概率值分别为0.87和0.91。The present invention tests all the pictures once, and can frame the types of clouds and their confidence in the pictures, wherein 0 means cold front, 1 means warm front, 2 means typhoon, 3 means cyclone, 4 means strong convection, 5 indicates the jet stream system. The cloud image detection effect is shown in Figure 14. In Figure 14, the two positions are circled with confidence boxes, the detected target belongs to the category 3 (cyclone), and the probability values of the display prediction are 0.87 and 0.91, respectively.

三、模型部署与应用3. Model deployment and application

1、模型Web端部署1. Model web deployment

(1)Flask框架(1) Flask framework

Flask是一个python语言中的轻量级框架,提供了web框架最基本的功能,相较于其他的框架使用更自由灵活。它的核心比较简单,只提供了基础的通信功能,用户需要自己选择拓展去实现特定的需求。把功能从框架中分离出来就不用让用户每次都安装不必要的功能,而是根据自己的选择去添加。Flask is a lightweight framework in the python language, which provides the most basic functions of a web framework and is more flexible and flexible than other frameworks. Its core is relatively simple, and only provides basic communication functions. Users need to choose and expand to achieve specific needs. Separating functionality from the framework eliminates the need for users to install unnecessary functionality every time, but to add them at their own discretion.

Flask具有巨大的优势,它让用户开发有了更多的选择的权力,设计风格极简,使得用户以更大的自由度构建应用程序。首先Flask的设计轻量化、模块化,使用各种丰富的拓展可以设计出符合需要的程序。其次Flask的API的基础UI设计美观连贯,让简单的设计就可以产生漂亮的界面。Flask模型小,得益于python平台在实际环境中较为容易部署。此外,Flask支持各种http请求处理的功能,框架高度灵活,配置灵活,可以满足多种输出需求。Flask has a huge advantage, it allows users to develop more options, and the design style is minimalist, allowing users to build applications with greater freedom. First of all, the design of Flask is lightweight and modular, and a variety of rich extensions can be used to design programs that meet the needs. Secondly, the basic UI design of Flask's API is beautiful and coherent, so that a simple design can produce a beautiful interface. The Flask model is small, thanks to the fact that the python platform is easier to deploy in the actual environment. In addition, Flask supports various http request processing functions. The framework is highly flexible and flexible in configuration, which can meet various output requirements.

本发明需要对神经网络框架进行web端部署,仅仅需要使用部分网络功能,所以后端框架中Flask就成了一个比较好选择,可以在微框架上添加所需要的功能。此外,由于本发明使用的神经网络框架平台是python语言编写,使用Flask可以更方便原生地对二者进行结合。The present invention needs to deploy the neural network framework on the web side, and only needs to use some network functions, so Flask in the back-end framework becomes a better choice, and the required functions can be added to the micro-framework. In addition, since the neural network framework platform used in the present invention is written in the python language, the two can be more conveniently and natively combined by using Flask.

(2)Vue框架(2) Vue framework

Vue采用MVVM架构,即View(视图)、ViewModel(逻辑)、Model(数据),如图15所示。MVVM框架里面视图层和数据层不直接交换数据,而是通过ViewModel层交换。Vue采用了数据的双向绑定技术,ViewModel负责去监听用户数据,然后在发生变化时通知视图层。用户操作通过ViewModel操作视图层时,也会通知相应的数据进行持久化操作。MVVM架构为前端页面提供了分层次的架构抽象,他还可以结合其他js库例如Ajax等实现数据通信和持久化,丰富了系统的功能和体验。Vue以MVVM中的ViewModel为核心,采用双向数据绑定技术保证了M层和V层数据的一致性,并且它属于轻量级框架,让开发过程简洁高效。Vue采用独特的数据驱动方式,改变了之前的DOM视图手动更新的方式,只要数据发生改变,就会触发视图自动变化。此外Vue让视图组件化,一整个网页被拆分为不同的区块,每个区块是一个组件。网络被多个组件拼接嵌套组成,这样实现了代码更好的可维护性和可重用性。Vue adopts MVVM architecture, namely View (view), ViewModel (logic), Model (data), as shown in Figure 15. In the MVVM framework, the view layer and the data layer do not exchange data directly, but through the ViewModel layer. Vue uses two-way data binding technology, ViewModel is responsible for monitoring user data, and then notifying the view layer when changes occur. When the user operates the view layer through the ViewModel, it will also notify the corresponding data for persistence operation. The MVVM architecture provides a hierarchical architecture abstraction for front-end pages. It can also combine other js libraries such as Ajax to realize data communication and persistence, enriching the functions and experience of the system. Vue takes ViewModel in MVVM as the core, and adopts two-way data binding technology to ensure the consistency of M-layer and V-layer data, and it is a lightweight framework, which makes the development process simple and efficient. Vue adopts a unique data-driven approach, which changes the way the previous DOM view is manually updated. As long as the data changes, the view will automatically change. In addition, Vue makes the view componentized, a whole web page is divided into different blocks, each block is a component. The network is composed of multiple components spliced and nested, which achieves better maintainability and reusability of the code.

Vue框架有许多特性。首先它是一个轻量级的前端框架,可以对模板中的表达式和计算属性自动跟踪计算,使用了MVVM架构以及拥有丰富的组件系统,接口使用多样化。其次它实现了数据的双向绑定,使用模板和指令在文档对象模型进行数据操作,让DOM实现了自动实时渲染。Vue拥有丰富的指令系统,在开发中页面中的事件几乎都可以使用Vue中的指令描述完成。指令可以结合变量的值发生变化,并相应地结合到DOM的应用上。Vue还拥有强大的组件功能,对原始的HTML中元素进行拓展。它通过封装实现了代码重用。同时有组件间继承式的通信方式,父子组件在属性参数中传递消息,从父组件到子组件数据单向传递,子组件通过消息响应令父组件更新数据。这样组件的开发就和html和javascript有密切的关系,用户可以在组件中选择需要的进行整合,加快了开发过程,减少了代码量,同时组件的开发支持热重载。Vue使用了Vue-router插件,这个插件可以构建只有一个页面的应用。路由插件设置了用户对网页浏览的路径,把用户对路径的访问映射到自定义组件上,相较于传统的使用超级链接的方式,这种设置实现了单页面应用The Vue framework has many features. First of all, it is a lightweight front-end framework that can automatically track and calculate expressions and computed properties in templates. It uses the MVVM architecture and has a rich component system with diversified interfaces. Secondly, it implements two-way binding of data, uses templates and instructions to perform data operations in the document object model, and enables DOM to achieve automatic real-time rendering. Vue has a rich instruction system, and almost all events in the developing page can be completed using the instruction description in Vue. Directives can be combined with variable values to change and are bound to DOM applications accordingly. Vue also has a powerful component function, extending the elements in the original HTML. It enables code reuse through encapsulation. At the same time, there is an inherited communication method between components. The parent and child components transmit messages in attribute parameters, and the data is unidirectionally transmitted from the parent component to the child component. The child component responds to the message to update the data of the parent component. In this way, the development of components is closely related to html and javascript. Users can choose the components they need to integrate, which speeds up the development process and reduces the amount of code. At the same time, the development of components supports hot reloading. Vue uses the Vue-router plugin, which can build applications with only one page. The routing plug-in sets the user's path to web browsing, and maps the user's access to the path to a custom component. Compared with the traditional way of using hyperlinks, this setting realizes a single-page application

用户访问的时候Vue显示视图,用户再次向服务器发出上传图片的请求。服务器接收客户端解析并解析,flask把接收的图片保存到upload目录下,之后调用yolov5的相关函数实现图像识别,最后回传给Vue对视图进行更新。When the user accesses, Vue displays the view, and the user sends a request to the server to upload the image again. The server receives the client parsing and parsing, flask saves the received image to the upload directory, then calls the related functions of yolov5 to realize image recognition, and finally returns it to Vue to update the view.

对训练得到的模型进行了Web端部署,使用了Flask框架作为前端框架,Vue框架作为后端框架,通过训练好的权重文件对图片进行检测。完成了在web端上传云图进行检测的功能,达到了实时检测的效果。The trained model is deployed on the Web side, using the Flask framework as the front-end framework and the Vue framework as the back-end framework, to detect images through the trained weight files. The function of uploading cloud images for detection on the web side is completed, and the effect of real-time detection is achieved.

本发明提供的卫星云图多通道图像融合方法,针对红外通道(波长10.5~12.5微米)和可见光通道(波长0.4~0.78微米)对不同天气现象的特征,进行两个通道图像的融合:a)使用开源opencv库统计可见光通道云图中存在的无效的信息并设置阈值进行过滤。丢弃无效信息过多的图片并完全保留无效信息较少的图片,对处于中间区域的图片进行融合;b)对红外云图和可见光云图分别进行拉普拉斯运算,在高斯图像金字塔的基础上建立拉普拉斯图像金字塔。之后提出了一种新的融合策略。根据a)中的阈值设置两种云图融合的比例和相对位置,对各层进行基于位置的像素级别的融合,再对图片进行线性填充得到融合后的结果。The multi-channel image fusion method for satellite cloud images provided by the present invention, for the characteristics of different weather phenomena in the infrared channel (wavelength 10.5-12.5 microns) and visible light channel (wavelength 0.4-0.78 microns), the fusion of two channel images is performed: a) using The open source opencv library counts invalid information in the visible light channel cloud image and sets a threshold for filtering. Discard the pictures with too much invalid information and completely retain the pictures with less invalid information, and fuse the pictures in the middle area; b) Laplacian operation is performed on the infrared cloud image and the visible light cloud image respectively, and established on the basis of the Gaussian image pyramid Laplacian Image Pyramid. A new fusion strategy is then proposed. According to the threshold in a), set the ratio and relative position of the two cloud image fusion, perform position-based pixel-level fusion for each layer, and then perform linear filling on the image to obtain the fusion result.

在图像融合的基础上,采用YOLO算法对卫星云图进行目标检测建模,用以识别冷锋、暖锋、台风、气旋、强对流和激流云系共计典型的6种天气现象。从原始卫星云图数据(HDF5格式)中提取出各个通道的云图图片,进行可见光云图与红外云图的融合。接着制作COCO数据集格式的训练数据集,进行模型训练,并对训练模型进行测试。在本实施例使用的环境中,YOLOv5模型可以达到30FPS左右的图片检测速度和95%以上的检测精度,很好地满足了卫星云图检测速度快和精确度高的要求。On the basis of image fusion, the YOLO algorithm is used to detect and model satellite cloud images to identify six typical weather phenomena, including cold fronts, warm fronts, typhoons, cyclones, strong convection and torrent cloud systems. The cloud images of each channel are extracted from the original satellite cloud image data (HDF5 format), and the visible light cloud image and the infrared cloud image are fused. Then create a training dataset in COCO dataset format, perform model training, and test the trained model. In the environment used in this embodiment, the YOLOv5 model can achieve a picture detection speed of about 30FPS and a detection accuracy of more than 95%, which well meets the requirements of satellite cloud image detection speed and accuracy.

本发明还对训练得到的模型进行了Web端部署,使用了Flask框架作为前端框架,Vue框架作为后端框架,通过训练好的权重文件对图片进行检测。完成了在web端上传云图进行检测的功能,达到了实时检测的效果。The invention also deploys the trained model on the Web side, uses the Flask framework as the front-end framework, and the Vue framework as the back-end framework, and detects pictures through the trained weight file. The function of uploading cloud images for detection on the web side is completed, and the effect of real-time detection is achieved.

尽管本发明的实施方案已公开如上,但其并不仅仅限于说明书和实施方式中所列运用,它完全可以被适用于各种适合本发明的领域,对于熟悉本领域的人员而言,可容易地实现另外的修改,因此在不背离权利要求及等同范围所限定的一般概念下,本发明并不限于特定的细节和这里示出与描述的图例。Although the embodiment of the present invention has been disclosed as above, it is not limited to the application listed in the description and the embodiment, and it can be applied to various fields suitable for the present invention. For those skilled in the art, it can be easily Therefore, the invention is not limited to the specific details and illustrations shown and described herein without departing from the general concept defined by the appended claims and the scope of equivalents.

Claims (9)

1. A meteorological satellite cloud target detection method based on yolk is characterized by comprising the following steps:
extracting a plurality of infrared cloud pictures and a plurality of visible light cloud pictures from original satellite cloud picture data acquired by a meteorological satellite;
the infrared cloud pictures and the visible light cloud pictures are in one-to-one correspondence;
counting invalid information in the visible light cloud pictures, and dividing the visible light cloud pictures into a plurality of pieces according to the proportion of the invalid information in the visible light cloud pictures: a first visible light cloud picture, a second visible light cloud picture and a third visible light cloud picture;
wherein the invalid information proportion psi of the first visible light cloud picture 1 Satisfy psi 1 <ψ min
The invalid information of the second visible light cloud picture accounts for psi 2 Satisfy psi min ≤ψ 2 ≤ψ max
The ratio psi of invalid information of the third visible light cloud picture 3 Satisfy psi 3 >ψ max
In the formula, /) min For a lower threshold of invalid information, # max An invalid information threshold upper limit;
step three, fusing the second visible light cloud picture with the infrared cloud picture corresponding to the second visible light cloud picture to obtain a fused cloud picture; and
forming a cloud atlas to be detected by the infrared cloud atlas, the fused cloud atlas and the first visible light cloud atlas corresponding to the third visible light cloud atlas;
and step four, performing target detection on the cloud pictures in the detected cloud picture set by adopting a Yolo algorithm, and identifying typical weather phenomena in the cloud pictures.
2. The method for detecting the cloud target of the meteorological satellite based on the Yolo of claim 1, wherein in the second step, an open source opencv library system is used for reading all the pixel points of the visible cloud image, and the number of the useless pixel points in the visible cloud image is judged to be the proportion of the total pixel points, so that the invalid information proportion in the visible cloud image is obtained.
3. The method for detecting cloud target of meteorological satellite based on Yolo according to claim 2, characterized in that psi min =25%,ψ max =75%。
4. The method for detecting the targets by the cloud images of the meteorological satellite based on the yolk according to the claim 2 or the claim 3, wherein in the third step, the second visible light cloud image is fused with the corresponding infrared cloud image, and the method comprises the following steps:
step 1, zooming the second visible light cloud picture and the infrared cloud picture to be fused into the same size;
step 2, after the second visible light cloud picture and the infrared cloud picture are respectively subjected to multi-scale expression by adopting a Laplace pyramid, the second visible light cloud picture and the infrared cloud picture are subjected to layered fusion;
and when fusion is carried out on each layer, the region where the useful pixel points in the second visible light cloud picture are located is fused with other regions in the infrared cloud picture according to the position information, so that a fused cloud picture is obtained.
5. The method for detecting the cloud target of the meteorological satellite based on the yolk according to claim 4, further comprising before the fourth step: and manufacturing a training data set in a COCO data set format according to the satellite cloud picture data, training the Yolo algorithm model, and testing the speed and the detection precision of the training model to obtain the Yolo algorithm meteorological cloud picture detection model.
6. The method for detecting the targets of the cloud images of the meteorological satellites based on the yolk according to claim 5, further comprising the steps of carrying out Web-side deployment on the yolk algorithm cloud image detection model, wherein a flash frame is used as a front-end frame, and an Vue frame is used as a back-end frame; the cloud picture is uploaded at the web end to be detected, and the effect of real-time detection is achieved.
7. The method for detecting the target of the cloud images of the meteorological satellite based on the yolk according to claim 6, wherein in the fourth step, the yolk 3 or yolk 5 algorithm is adopted to detect the target of the cloud images in the detected cloud image set.
8. The method for detecting cloud target based on Yolo weather satellite images as claimed in claim 7, wherein in the fourth step, the Yolov5 algorithm is adopted to perform target detection on the cloud images in the detected cloud image set.
9. The yolk-based weather satellite cloud target detection method of claim 8, wherein the typical weather phenomenon comprises: the cold front, warm front, typhoon, cyclone, strong convection and torrent clouds are 6 weather phenomena.
CN202110783150.4A 2021-07-12 2021-07-12 Cloud map target detection method for meteorological satellite based on yolk Active CN113487529B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110783150.4A CN113487529B (en) 2021-07-12 2021-07-12 Cloud map target detection method for meteorological satellite based on yolk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110783150.4A CN113487529B (en) 2021-07-12 2021-07-12 Cloud map target detection method for meteorological satellite based on yolk

Publications (2)

Publication Number Publication Date
CN113487529A CN113487529A (en) 2021-10-08
CN113487529B true CN113487529B (en) 2022-07-26

Family

ID=77938093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110783150.4A Active CN113487529B (en) 2021-07-12 2021-07-12 Cloud map target detection method for meteorological satellite based on yolk

Country Status (1)

Country Link
CN (1) CN113487529B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114565056B (en) * 2022-03-15 2022-09-20 中科三清科技有限公司 Machine learning-based cold-front identification method and device, storage medium and terminal
CN115329493B (en) * 2022-08-17 2023-07-14 兰州理工大学 Impeller machinery fault detection method based on digital twin model of centrifugal pump
CN116342448B (en) * 2023-03-28 2023-09-29 北京华云星地通科技有限公司 Full-disc visible light fitting method, system, equipment and medium
CN117274243B (en) * 2023-11-17 2024-01-26 山东大学 A lightweight meteorological disaster detection method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102646272A (en) * 2012-02-23 2012-08-22 南京信息工程大学 Fusion method of wavelet meteorological satellite cloud image based on combination of local variance and weighting
CN106023177A (en) * 2016-05-14 2016-10-12 吉林大学 Thunderstorm cloud cluster identification method and system for meteorological satellite cloud picture
CN110175959A (en) * 2019-05-20 2019-08-27 南京信息工程大学 A kind of typhoon cloud atlas Enhancement Method
CN111784619A (en) * 2020-07-03 2020-10-16 电子科技大学 A fusion method of infrared and visible light images

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013141974A1 (en) * 2012-02-08 2013-09-26 Convergent Life Sciences, Inc. System and method for using medical image fusion
CN103839243B (en) * 2014-02-19 2017-01-11 浙江师范大学 Multi-channel satellite cloud picture fusion method based on Shearlet conversion
KR101580585B1 (en) * 2014-12-02 2015-12-28 서울시립대학교 산학협력단 Method for data fusion of panchromatic and thermal-infrared images and Apparatus Thereof
CN105338262B (en) * 2015-10-09 2018-09-21 浙江大华技术股份有限公司 A kind of graphic images processing method and processing device
CN108073865B (en) * 2016-11-18 2021-10-19 南京信息工程大学 A Method for Recognition of Aircraft Wake Clouds Based on Satellite Data
CN106780392B (en) * 2016-12-27 2020-10-02 浙江大华技术股份有限公司 Image fusion method and device
EP3682193A4 (en) * 2017-09-13 2021-06-02 Project Concern International SYSTEM AND METHOD FOR IDENTIFICATION AND EVALUATION OF TOPOGRAPHICAL CHARACTERISTICS USING SATELLITE DATA
CN108983219B (en) * 2018-08-17 2020-04-07 北京航空航天大学 Fusion method and system for image information and radar information of traffic scene
KR102142934B1 (en) * 2018-08-31 2020-08-11 인천대학교 산학협력단 Apparatus and Method for Fusing Using Weighted Least Squares Filter and Sparse Respresentation
CN109166131B (en) * 2018-09-29 2021-06-29 西安工业大学 Segmentation and evaluation method of anti-halation image for automotive night vision based on fusion of infrared and visible light
CN111915546B (en) * 2020-08-04 2024-07-26 西安科技大学 Infrared and visible light image fusion method, system, computer equipment and application
CN112288663A (en) * 2020-09-24 2021-01-29 山东师范大学 A kind of infrared and visible light image fusion method and system
CN112233074B (en) * 2020-09-30 2024-12-24 国网山西省电力公司大同供电公司 A method for detecting power faults based on visible light and infrared fusion images
CN112907493B (en) * 2020-12-01 2024-07-23 航天时代飞鸿技术有限公司 Multi-source battlefield image rapid mosaic fusion algorithm under unmanned aerial vehicle bee colony collaborative reconnaissance
CN112819740B (en) * 2021-02-02 2023-05-12 南京邮电大学 Medical image fusion method based on multi-component low-rank dictionary learning

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102646272A (en) * 2012-02-23 2012-08-22 南京信息工程大学 Fusion method of wavelet meteorological satellite cloud image based on combination of local variance and weighting
CN106023177A (en) * 2016-05-14 2016-10-12 吉林大学 Thunderstorm cloud cluster identification method and system for meteorological satellite cloud picture
CN110175959A (en) * 2019-05-20 2019-08-27 南京信息工程大学 A kind of typhoon cloud atlas Enhancement Method
CN111784619A (en) * 2020-07-03 2020-10-16 电子科技大学 A fusion method of infrared and visible light images

Also Published As

Publication number Publication date
CN113487529A (en) 2021-10-08

Similar Documents

Publication Publication Date Title
CN113487529B (en) Cloud map target detection method for meteorological satellite based on yolk
CN111507271B (en) A method for intelligent detection and identification of airborne optoelectronic video targets
CN114119979B (en) Fine-grained image classification method based on segmentation mask and self-attention neural network
CN111738111A (en) A Road Extraction Method Based on Multi-branch Cascaded Hole Spatial Pyramid for High Resolution Remote Sensing Images
CN109886066A (en) A fast target detection method based on multi-scale and multi-layer feature fusion
CN112488015B (en) Intelligent building site-oriented target detection method and system
CN116453121B (en) Training method and device for lane line recognition model
CN118691815A (en) A high-quality automatic instance segmentation method for remote sensing images based on fine-tuning of the SAM large model
CN114419372B (en) Multi-scale point cloud classification method and system
CN115619719A (en) A detection method of pine wood nematode disease diseased wood based on improved Yolo v3 network model
CN116403127A (en) A method, device, and storage medium for object detection in aerial images taken by drones
CN109815931A (en) A method, device, device and storage medium for video object recognition
CN116363532A (en) Traffic target detection method for UAV images based on attention mechanism and reparameterization
CN116188402A (en) Insulator defect identification method based on improved SSD algorithm
CN117671509A (en) Remote sensing target detection method and device, electronic equipment and storage medium
CN116486075A (en) Multi-scale Strong Fusion Semantic Segmentation Method for Remote Sensing Image Feature Extraction Based on HRNet
Wang et al. YOLO V4 with hybrid dilated convolution attention module for object detection in the aerial dataset
Li et al. Dept: depth estimation by parameter transfer for single still images
Jiao et al. YOLO series algorithms in object detection of unmanned aerial vehicles: a survey
CN119600436A (en) Method, equipment, medium and product for detecting small target of remote sensing image
US11790228B2 (en) Methods and systems for performing tasks on media using attribute specific joint learning
CN116469014B (en) Small sample satellite radar image sailboard identification and segmentation method based on optimized Mask R-CNN
CN117315286A (en) Method and device for distilling SAM image encoder, electronic device and storage medium
CN117556294A (en) Data classification method, device, computer equipment and storage medium
Xiang et al. A Precipitation Nowcasting Mechanism for Real‐World Data Based on Machine Learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant