Disclosure of Invention
An object of the present invention is to provide a water level identification method based on a virtual water gauge, which can improve the accuracy of water level identification by obtaining the current water level of a natural water area through water area identification. Another object of the present invention is to provide a water level recognition system based on a virtual water gauge. It is a further object of this invention to provide such a computer apparatus. It is a further object of this invention to provide such a readable medium.
In order to achieve the above object, the present invention discloses a water level identification method based on a virtual water gauge, including:
selecting two initial points of known actual positions in a natural water area and image coordinates of the two initial points in a water area image corresponding to the natural water area;
identifying a water area region in the water area image through a water area segmentation model;
and determining the water surface elevation of the current water surface of the natural water area according to the water area, the actual positions of the two initial points and the image coordinates.
Preferably, the two initial points are two points of the top elevation and the initial water surface elevation of the actual water gauge in the natural water area.
Preferably, the method further comprises the step of forming the water area segmentation model.
Preferably, the forming the water area segmentation model specifically includes:
forming an image water area segmentation network model;
and training a plurality of water area images through an image segmentation algorithm according to the network model to obtain the water area segmentation model.
Preferably, the determining the water surface elevation of the current water surface of the natural water area according to the actual position of the water area and the image coordinates of the two initial points in the natural water area and the water area image respectively specifically includes:
obtaining the water level position coordinates of the current water surface in the water area image according to the water area and the image coordinates of the two initial points in the water area image;
and obtaining the water surface elevation according to the actual positions of the two initial points in the natural water area, the image coordinates of the water area image and the water level position coordinates of the current water surface.
Preferably, the method further comprises the step of forming a virtual water gauge image on the water area image.
Preferably, the forming of the virtual water gauge image on the water area image specifically includes:
obtaining the pixel size of a virtual water gauge according to the water surface elevation and the water area;
obtaining the initial position and the end position of the virtual water gauge through inverse perspective transformation;
and forming the virtual water gauge according to the starting position, the ending position and the pixel size and displaying the water surface elevation.
The invention also discloses a water level identification system based on the virtual water gauge, which comprises the following components:
the initial parameter module is used for selecting two initial points of known actual positions in the natural water area;
the water area identification module is used for identifying a water area in the water area image corresponding to the natural water area through a water area segmentation model;
and the water level identification module is used for determining the water surface elevation of the current water surface of the natural water area according to the actual position of the water area and the two initial points in the natural water area and the image coordinates of the water area image.
The invention also discloses a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor,
the processor, when executing the program, implements the method as described above.
The invention also discloses a computer-readable medium, having stored thereon a computer program,
which when executed by a processor implements the method as described above.
The method comprises the steps of selecting two initial points of known actual positions in the natural waters and image coordinates of the two initial points in a water area image, identifying the water area in the water area image through a water area segmentation model based on depth learning, and determining the water surface elevation of the current water surface through the water area and the image coordinates of the two initial points. The method and the device have the advantages that the water area in the water area image is identified, the actual water gauge does not need to be subjected to image identification, the method and the device are suitable for water level identification under different water gauge models and complex environments, when the water gauge in the water area image cannot be identified due to the fact that the actual water gauge has stains, spots, damage or various scale colors, accurate virtual water gauges can be generated, accuracy of water level identification is improved, the traditional human eye judgment reading is replaced, labor input is reduced, and working efficiency is improved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
According to one aspect of the invention, the embodiment discloses a water level identification method based on a virtual water gauge. As shown in fig. 1, in this embodiment, the water level identification method includes:
s100: two initial points from known actual positions in natural waters and image coordinates of the two initial points in a water area image corresponding to the natural water area are selected.
S200: and identifying a water area region in the water area image through a water area segmentation model.
S300: and determining the water surface elevation of the current water surface of the natural water area according to the water area, the actual positions of the two initial points and the image coordinates.
The method comprises the steps of selecting two initial points of known actual positions in the natural waters and image coordinates of the two initial points in a water area image, identifying the water area in the water area image through a water area segmentation model based on depth learning, and determining the water surface elevation of the current water surface through the water area and the image coordinates of the two initial points. The method and the device have the advantages that the water area in the water area image is identified, the actual water gauge does not need to be subjected to image identification, the method and the device are suitable for water level identification under different water gauge models and complex environments, when the water gauge in the water area image cannot be identified due to the fact that the actual water gauge has stains, spots, damage or various scale colors, accurate virtual water gauges can be generated, accuracy of water level identification is improved, the traditional human eye judgment reading is replaced, labor input is reduced, and working efficiency is improved.
In a specific example, when monitoring a natural water area, the image acquisition device may acquire a monitoring video or a monitoring image of the natural water area, extract video or image data acquired by the image acquisition device to form a water area image, and analyze the water area image to obtain coordinate positions of two selected initial points on the water area image. It can be understood that the position and the angle of the image acquisition device do not change during the monitoring process, so that the coordinate positions of the two initial points in the natural water area on the water area image do not change correspondingly. When the position or the angle of the image acquisition equipment changes, the coordinate positions of two preselected initial points on the water area image need to be determined again.
In a preferred embodiment, the two initial points are two points of a top elevation and an initial surface elevation of an actual water gauge in the natural water area. By selecting two points of the top elevation and the initial water surface elevation of the actual water gauge as initial points, on one hand, the pixel size of the virtual water gauge can be determined according to the actual distance of the two initial points in the natural water area and the image distance on the water area image, and therefore the virtual water gauge can be generated on the water area image.
In a preferred embodiment, the method further comprises the step of forming the water-area segmentation model. The water area segmentation model is formed through a deep learning technology, the water area region on the water area image can be accurately identified through continuous iteration and optimization of the water area segmentation model, and the current water level of the water surface can be further determined according to the range of the water area region so as to realize real-time monitoring on the natural water area.
In a preferred embodiment, as shown in fig. 2, the forming the water area segmentation model may specifically include:
s210: and forming an image water area segmentation network model. In a preferred embodiment, multi-scale context information can be explored by taking multi-sampling rate expansion convolution, multi-receive field convolution or pooling on an input feature map (feature) by a spatial pyramid module. The clear water area boundary is captured by gradually recovering the spatial information through an encoder decoding (encoder-decoder), and a depth separable convolution (xception) algorithm is used in a water area segmentation task to obtain a powerful and fast network model. In other embodiments, other deep learning algorithms may be used to form the image-water area segmentation network model, which is not limited by the present invention.
S220: and training a plurality of water area images through an image segmentation algorithm according to the network model to obtain the water area segmentation model. Specifically, in a preferred embodiment, a depllabv 3+ image segmentation algorithm may be adopted to train a data set formed by a plurality of water area images in a natural scene, an initial learning rate lr is set to 1e-7, a momentum is set to 0.9, and a water area segmentation model is obtained after 300 epochs are iterated. In other embodiments, the water area segmentation model may be obtained by training a plurality of water area images through other image segmentation algorithms, which is not limited by the present invention.
In a preferred embodiment, as shown in fig. 3, the step S300 may specifically include:
s310: and obtaining the water level position coordinates of the current water surface in the water area image according to the water area and the image coordinates of the two initial points in the water area image.
S320: and obtaining the water surface elevation according to the actual positions of the two initial points in the natural water area, the image coordinates of the water area image and the water level position coordinates of the current water surface.
Specifically, in a preferred embodiment, the two initial points are the top elevation Hg and the initial water surface elevation Hc of the actual water gauge, respectively, wherein the coordinate of the top elevation Hg on the water area image is (x)1,y1) The coordinate of the initial water surface elevation Hc on the water area image is (x)2,y2)。
The water area can be Mask matrix obtained by a water area segmentation model, and water level position coordinate y of the current water level on the water area image is obtained by calculation according to the Mask matrix and two initial pointsnow,ynowBy performing y on Mask matrixnow=Mask[:,(x1+x2)/2]The min () algorithm is calculated. Further, the water surface elevation Hw of the current water surface in the natural water area is obtained through two initial actual positions in the natural water area, and the Hw can be calculated through the following formula: hw ═ Hg- [ (Hg-Hc)/(y)2-y1)]*(ynow-y1). According to the invention, the current water level is obtained by identifying the water area region of the water area image, so that the natural water area can be monitored according to the current water level condition, the identification accuracy of the monitored water area image under the condition of poor identification condition is improved, the water level change video image identification monitoring capability is better exerted, and the abnormity is found more timely and accurately. The labor monitoring resource investment is reduced, and the overall flood prevention capacity and the work efficiency are improved.
In a preferred embodiment, the method further includes a step S400 of forming a virtual water gauge image on the water area image, as shown in fig. 4. Through forming virtual water gauge image on the waters image can be when the water gauge is damaged or light is not enough to lead to the actual water gauge to see clearly, make the user can monitor current water level according to virtual water gauge, can monitor the waters water level more directly perceived, conveniently.
In a preferred embodiment, as shown in fig. 5, the S400 may specifically include:
s410: and obtaining the pixel size of the virtual water gauge according to the water surface elevation and the water area. Specifically, the position range of the virtual water gauge to be displayed may be determined according to a Mask matrix of the water area obtained by the water area segmentation model, for example, in one embodiment, the virtual water gauge extends from at least within the water area to a top elevation Hg of the actual water gauge, and in other embodiments, the pixel size of the formed virtual water gauge may also be flexibly selected according to actual requirements, so as to determine the position of the formed virtual water gauge.
S420: and obtaining the initial position and the final position of the virtual water gauge through inverse perspective transformation. Obtaining the initial position (x) of the virtual water gauge through inverse perspective transformation according to the determined pixel size of the virtual water gauge1’,y1') and termination position (x)2’,y2'), for example, the start location may be a point at which the top elevation of the actual water gauge is at or beside the corresponding point on the image of the water area, and the end location may be a point at which the current water level is at or beside the corresponding point on the image of the water area.
S430: and forming the virtual water gauge according to the starting position, the ending position and the pixel size and displaying the water surface elevation. Specifically, a virtual water gauge is formed on the water area image from the start position to the end position according to the pixel size of the virtual water gauge. Form virtual water gauge through the reverse perspective transform, can make the virtual water gauge of formation more three-dimensional, form the virtual water gauge that has space display effect, promote display effect and user experience.
Based on the same principle, the embodiment also discloses a water level identification system based on the virtual water gauge. As shown in fig. 6, in the present embodiment, the system includes an initial parameter module 11, a water area identification module 12, and a water level identification module 13.
The initial parameter module 11 is configured to select two initial points of known actual positions in a natural water area. The water area identification module 12 is configured to identify a water area region in the water area image corresponding to the natural water area through a water area segmentation model. The water level identification module 13 is configured to determine a water surface elevation of the current water surface of the natural water area according to the actual position of the water area and the two initial points in the natural water area and the image coordinates of the water area image.
The method comprises the steps of selecting two initial points of known actual positions in the natural waters and image coordinates of the two initial points in a water area image, identifying the water area in the water area image through a water area segmentation model based on depth learning, and determining the water surface elevation of the current water surface through the water area and the image coordinates of the two initial points. The method and the device have the advantages that the water area in the water area image is identified, the actual water gauge does not need to be subjected to image identification, the method and the device are suitable for water level identification under different water gauge models and complex environments, when the water gauge in the water area image cannot be identified due to the fact that the actual water gauge has stains, spots, damage or various scale colors, accurate virtual water gauges can be generated, accuracy of water level identification is improved, the traditional human eye judgment reading is replaced, labor input is reduced, and working efficiency is improved.
In a specific example, when monitoring a natural water area, the image acquisition device may acquire a monitoring video or a monitoring image of the natural water area, extract video or image data acquired by the image acquisition device to form a water area image, and analyze the water area image to obtain coordinate positions of two selected initial points on the water area image. It can be understood that the position and the angle of the image acquisition device do not change during the monitoring process, so that the coordinate positions of the two initial points in the natural water area on the water area image do not change correspondingly. When the position or the angle of the image acquisition equipment changes, the coordinate positions of two preselected initial points on the water area image need to be determined again.
In a preferred embodiment, the two initial points are two points of a top elevation and an initial surface elevation of an actual water gauge in the natural water area. By selecting two points of the top elevation and the initial water surface elevation of the actual water gauge as initial points, on one hand, the pixel size of the virtual water gauge can be determined according to the actual distance of the two initial points in the natural water area and the image distance on the water area image, and therefore the virtual water gauge can be generated on the water area image.
In a preferred embodiment, as shown in fig. 7, the system further comprises a model construction module 14 for forming a water segmentation model. The water area segmentation model is formed through a deep learning technology, the water area region on the water area image can be accurately identified through continuous iteration and optimization of the water area segmentation model, and the current water level of the water surface can be further determined according to the range of the water area region so as to realize real-time monitoring on the natural water area.
In a preferred embodiment, the model construction module 14 is specifically configured to form an image water area segmentation network model, and train a plurality of water area images according to the network model by using an image segmentation algorithm to obtain the water area segmentation model.
In a preferred embodiment, multi-scale context information can be explored by taking multi-sampling rate expansion convolution, multi-receive field convolution or pooling on an input feature map (feature) by a spatial pyramid module. The clear water area boundary is captured by gradually recovering the spatial information through an encoder decoding (encoder-decoder), and a depth separable convolution (xception) algorithm is used in a water area segmentation task to obtain a powerful and fast network model. In other embodiments, other deep learning algorithms may be used to form the image-water area segmentation network model, which is not limited by the present invention.
In a preferred embodiment, a data set formed by a plurality of water area images in a natural scene can be trained by adopting a depllabv 3+ image segmentation algorithm, an initial learning rate lr is set to be 1e-7, momentum is set to be 0.9, and a water area segmentation model is obtained after 300 epochs are iterated. In other embodiments, the water area segmentation model may be obtained by training a plurality of water area images through other image segmentation algorithms, which is not limited by the present invention.
In a preferred embodiment, the water level identification module 13 is further configured to obtain a water level position coordinate of the current water surface in the water area image according to the water area and the image coordinates of the two initial points in the water area image, and obtain the water level elevation according to the actual position of the two initial points in the natural water area, the image coordinates of the water area image, and the water level position coordinate of the current water surface.
Specifically, in a preferred embodiment, the two initial points are the top elevation Hg and the initial water surface elevation Hc of the actual water gauge, respectively, wherein the coordinate of the top elevation Hg on the water area image is (x)1,y1) The coordinate of the initial water surface elevation Hc on the water area image is (x)2,y2)。
The water area can be Mask matrix obtained by a water area segmentation model, and water level position coordinate y of the current water level on the water area image is obtained by calculation according to the Mask matrix and two initial pointsnow,ynowBy performing y on Mask matrixnow=Mask[:,(x1+x2)/2]The min () algorithm is calculated. Further, the water surface elevation Hw of the current water surface in the natural water area is obtained through two initial actual positions in the natural water area, and the Hw can be calculated through the following formula: hw ═ Hg- [ (Hg-Hc)/(y)2-y1)]*(ynow-y1). According to the invention, the current water level is obtained by identifying the water area region of the water area image, so that the natural water area can be monitored according to the current water level condition, the identification accuracy of the monitored water area image under the condition of poor identification condition is improved, the water level change video image identification monitoring capability is better exerted, and the abnormity is found more timely and accurately. The labor monitoring resource investment is reduced, and the overall flood prevention capacity and the work efficiency are improved.
In a preferred embodiment, as shown in fig. 8, the system further includes a virtual water gauge module 15 that forms a virtual water gauge image on the water area image. Through forming virtual water gauge image on the waters image can be when the water gauge is damaged or light is not enough to lead to the actual water gauge to see clearly, make the user can monitor current water level according to virtual water gauge, can monitor the waters water level more directly perceived, conveniently.
In a preferred embodiment, the virtual water gauge module 15 is specifically configured to obtain a pixel size of a virtual water gauge according to the water surface elevation and the water area, obtain a start position and an end position of the virtual water gauge through inverse perspective transformation, form the virtual water gauge according to the start position, the end position, and the pixel size, and display the water surface elevation.
Specifically, the position range of the virtual water gauge to be displayed may be determined according to a Mask matrix of the water area obtained by the water area segmentation model, for example, in one embodiment, the virtual water gauge extends from at least within the water area to a top elevation Hg of the actual water gauge, and in other embodiments, the pixel size of the formed virtual water gauge may also be flexibly selected according to actual requirements, so as to determine the position of the formed virtual water gauge.
Further, the initial position (x) of the virtual water gauge is obtained through inverse perspective transformation according to the determined pixel size of the virtual water gauge1’,y1') and termination position (x)2’,y2'), for example, the start location may be a point at which the top elevation of the actual water gauge is at or beside the corresponding point on the image of the water area, and the end location may be a point at which the current water level is at or beside the corresponding point on the image of the water area.
Further, a virtual water gauge is formed on the water area image from the start position to the end position according to the pixel size of the virtual water gauge. Form virtual water gauge through the reverse perspective transform, can make the virtual water gauge of formation more three-dimensional, form the virtual water gauge that has space display effect, promote display effect and user experience.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
In a typical example, the computer device specifically comprises a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method performed by the client as described above when executing the program, or the processor implementing the method performed by the server as described above when executing the program.
Referring now to FIG. 9, shown is a schematic diagram of a computer device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 9, the computer apparatus 600 includes a Central Processing Unit (CPU)601 which can perform various appropriate works and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM)) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output section 607 including a Cathode Ray Tube (CRT), a liquid crystal feedback (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 606 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.