Novel method for quickly and efficiently detecting contour lines of meteorological facsimile diagram
Technical Field
The invention belongs to the technical field of meteorological facsimile image data processing, and particularly relates to a method for detecting a contour line of a countermeasure network generated based on deep learning.
Background
The weather facsimile picture is a weather picture which is usually used for visually presenting weather information, and is essentially a weather image and a file which are transmitted and received by a special facsimile machine and are used in the field of ship navigation. The method is mainly applied to the navigation field, and the weather facsimile graph can provide various weather data at the same time in a certain area. For scientific researchers, the research such as meteorological prediction, ocean motion mathematical modeling and terrain evolution can be carried out by using the meteorological parameters and numerical values of the reaction. The method has the advantages that sea surface weather can be detected in real time for navigation personnel, and the moving track of sea surface weather disasters can be displayed or predicted, so that risks caused by severe weather are avoided, and safe and effective navigation is carried out. In addition, in military application, the sea surface humidity and the storm are large, so that the high-precision military detection equipment is greatly interfered, and in addition, the military equipment is mostly monitored from high altitude, so the interference of cloud layers is also very important. From the last century to the present, no matter civil, military or academic research, the meteorological facsimile graph is more and more emphasized, and meanwhile, the requirements on the data extraction speed and accuracy of the meteorological facsimile graph are higher and higher. The contour lines represent various planes with the same parameters in the meteorological facsimile diagram, such as a climbing surface, an isothermal surface and an isobaric surface, and the extraction of the contour lines has great significance for the numerical processing.
There are many types of weather facsimile diagrams, and weather facsimile diagrams suitable for marine use include: ground maps (AS, FS), altitude maps (AU, FU), satellite clouds (VS, IR), sea wave maps (AW, FW), sea current maps (SO, FO), sea temperature maps (CO, FO), ice state maps (ST, FI) and tropical cyclone alarm maps (WT). The used weather fax diagrams can be divided into two analysis diagrams (A) and a forecast diagram (F) according to the code, wherein the analysis diagrams are divided into a ground Analysis (AS), a high altitude Analysis (AU) and a sea wave Analysis (AW), and the forecast diagram comprises a ground forecast diagram (FS), a high altitude forecast diagram (FU), an important weather Forecast (FB), a medium term Forecast (FE) and a sea wave Forecast (FW).
During the period, a plurality of people carry out intensive research on the meteorological fax, wherein the more effective methods comprise intersection point detection in the fax based on multi-region feature point pairing, an equipotential vorticity line identification method based on vector product, a traversal algorithm for extracting contour lines from an elevation grid and an algorithm for searching and searching for contour line starting points by interval tree search, and the algorithms comprise a part of work for researching contour line extraction and a complete contour line extraction method. In the years, the deep learning technology is rapidly developed, and both the calculation power, the network structure and the optimization method are improved in response, but the deep learning technology is not applied to the field in the image with high complexity and huge information quantity based on the weather facsimile image, and a plurality of different versions are derived in the years for generating the confrontation network and are respectively applied to various different professional fields.
Disclosure of Invention
The invention provides a novel method for detecting contour lines of a weather fax image, which is used for generating a countermeasure network based on deep learning and is rapid and efficient, aiming at the problems that the conventional digital image processing algorithm is complicated in redundancy and cannot rapidly process the weather fax image with complicated data.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a new method for quickly and efficiently detecting the contour line of a weather facsimile chart comprises the following steps,
(1) establishing a training data set: forming a series of paired images { (x, y) } by using an unprocessed original image x of the weather fax image and a preprocessed picture y only containing isolines, forming a training data set, and dividing the training data set into a training set, a verification set and a test set;
(2) establishing a network structure of the model: the network structure is based on a pix2pix network and comprises a generator G and a discriminator D; sending the paired data sets established in the step (1) to a generator for training, inputting an unprocessed original image of the weather fax image into the generator, outputting the weather fax image only containing contour lines, and then inputting the output image and the original image together into a discriminator; the other set of input of the discriminator is unprocessed original images of the meteorological fax images and preprocessed real images; finally, the discriminator maps the input image into a label, the scalar represents the probability that the input image is a real image, and the network parameters of the generator are optimized after the scalar is reversely transmitted to the generator;
(3) composition of the loss function: the loss function comprises three parts, wherein one part is a loss function corresponding to the generator, the other part is a loss function corresponding to the discriminator, and the other part is an L1 loss function; the three loss functions are combined and set as the target to optimize the network in (2).
Further, when the unprocessed weather fax image original image is spliced with the weather fax image only containing the contour line, the left side is the unprocessed weather fax image original image, and the right side is the processed weather fax image.
Furthermore, the processing confrontation state of the generator and the discriminator is characterized in that the training process is as follows, the generator makes the generated image more real as much as possible, and the discriminator is used for judging whether the image is true or false; over time, the generator and the arbiter compete against each other, and finally, two networks reach a dynamic balance: the image generated by the generator is close to a real image, and the discriminator cannot judge whether the image is true or false; finally, obtaining a trained generator model:
further, the generator is based on an Encoder-Decoder structure improved Unet structure, and jumper wires between layers are increased. The discriminator adds PatchGAN structure in the binary discriminator, and calculates the average value as the final probability after the diagnosis of each Patch is discriminated.
Further, the formula of the pix2pix to resist the loss function of the generated network is:
wherein L iscGANThe formula for (G, D) is:
LL1(G) the formula of (1) is: l isL1(G)=Ex,y,z[||y-G(x,z)||1]
Here, x is an input image, z is a random noise vector, y is a condition (real image), G (z | y) represents a picture generated with noise z under the condition of the real picture y, D (x | y) represents a discrimination score for the input image under the condition of the real picture y, and D (x, G (z | y)) represents discrimination as to whether or not an image generated by the generator and the real image match.
Further, the L1 function represents the difference between the real picture y and the picture generated by the G network, so as to constrain the difference between the two, and ensure the commonality of the input and output, and the λ parameter is selected to be 100.
The L1 function is expressed as
y
(i)Representing a preprocessed contour image
The contour map generated by the generator is represented, and the minimization of the sum of the absolute differences of the contour map and the contour map is obtained.
Drawings
FIG. 1 is a block diagram of a network architecture of generators and discriminators in accordance with the present invention;
FIG. 2 is a detailed block diagram of a generator generated by the present invention;
FIG. 3 is a diagram of the PatchGAN structure in the arbiter generated by the present invention;
FIG. 4 is a data set picture pair used by the present invention;
FIG. 5 is a diagram of a contour detection map generated by the present invention and ultimately generated across a pix2pix network.
Detailed Description
The present invention will be further described with reference to the accompanying drawings.
The invention provides a new method for quickly and efficiently detecting the contour line of a meteorological facsimile diagram, which mainly comprises the following three aspects: establishing a data set, constructing a network structure of a model and forming a loss function.
(1) Establishing a training data set: firstly, downloading weather fax images of various time periods and regions at official websites of a China Central weather station (CMA) and a Japanese weather station (JMH), then naming the images by ascending numbers, totaling 4030 images, firstly carrying out primary processing on the original images by utilizing a traditional template matching algorithm, then carrying out manual rescreening, and further refining the images reaching the processing standards, and calling the images as the preprocessed images. And then, storing the preprocessed pictures and the original pictures in a one-to-one correspondence manner to form 4030 pair (8060) of pictures as a special data set for the meteorological facsimile picture.
The pictures are scaled equally, the size of the pictures is set to be 256 × 256, the size of the pictures is 512 × 256 after splicing, and the format of the pictures is converted into RGB three channels.
Randomly dividing the processed 4030 pair of data sets into a training set, a verification set and a test set, wherein the picture quantity ratio is 6: 2: 2, where there are 2418 pairs of training set pictures, the validation set 805 pair and the test set 807 pair.
(2) Network structure of the model:
on the basis of pix2pix, a mapping from the unprocessed weather fax image original x to the contour image y is learned.
The network structure comprises a generator part and a discriminator part, and a training data set consists of paired images in (1) { (x)i,yi) In which xiOriginal drawing, y, representing unprocessed weather faxiRepresenting the contour map after preprocessing, 2418 sends the training data set to the generator for training. The generator G is used for converting the unprocessed original weather fax map into a contour map only containing contour lines, and the judgment result of the discriminator is 1 as much as possible. Finally, the contour map generated by the generator is respectively summed with xi、yiAre input together to the discriminator. The discriminator is used for receiving a real image or an image generated by the generator G, and has the main functions of distinguishing a 'true' image from a 'false' image as far as possible, setting the image judgment result input by the generator as 0 as far as possible, and judging the real image in the data set as 1. The discriminator maps the input picture to a value that represents the probability that the input image is a true image, with closer to 1 indicating a greater likelihood that the input image is a true image.
These two parts constitute a supervised learning mode, as shown in fig. 1. The final objective function is as follows:
wherein G (z | y) is the output image of the generator, D (x, G (z | y)) and D (x | y) are the output results of the decider, and the generator is opposite and uniform with the object of the decider.
In the training process, an Adam optimizer and a minibochcSGD gradient descent algorithm are adopted, the batch size is set to be 4, the learning rate is set to be 0.0001, 20epoch training is carried out, and under the environment of ubuntu16.04, the NVDIA GTX1070 video card shares 43 minutes. In the training process, the generator and the discriminator adopt an alternative training mode
In the whole process, the generator makes the generated image more real as much as possible, and the function of the discriminator is to judge whether the image is true or false. Over time, the generator and the arbiter continually compete, and eventually both networks reach the nash equilibrium point: the contour map generated by the generator is close to the characteristic distribution of a real contour image in the data set, and the discriminator can better identify the truth of the image.
(3) Composition of the loss function:
in order to make the fit degree between the contour map converted from the original weather fax image and the preprocessed contour real image higher, an L1 loss function is added to the loss function, and the L1 loss function is as follows:
LL1(G)=Ex,y,z[||y-G(x,z)||1]
y
(i)representing a preprocessed contour image
The contour map generated by the generator is represented, and the minimization of the sum of the absolute differences of the contour map and the contour map is obtained.
The final loss function for Pix2Pix is
Wherein the lambda parameter is selected to be 100
Therefore, a new method for quickly and efficiently detecting the contour line of the weather fax image is realized and verified. The invention provides a contour line extraction system for a weather fax image based on a pix2pix countermeasure generation network, and solves the problems that the redundancy of the traditional digital image processing algorithm is complex, and the weather fax image with complex data cannot be rapidly processed.
The above description is only of the preferred embodiments of the present invention, and it should be noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the invention and these are intended to be within the scope of the invention.