Water level recognition method, device, electronic device and storage medium
By extracting the image to be identified from the water ruler video stream and performing object detection and scale recognition, the problem of low accuracy and automation of existing water level monitoring methods is solved, and a higher water level height recognition accuracy is achieved.
Patent Information
- Application Number
- CN202210895717.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-07-26
AI Technical Summary
The existing water level monitoring methods have safety problems, high labor intensity and low degree of automation, high cost of automatic water level gauge, easy to be affected by the environment, and difficult to install, and traditional image recognition methods have large errors.
By extracting the image to be identified from the water ruler video stream, target detection is performed to obtain the image area above the horizontal plane, identify the scale information above the horizontal plane in the water ruler image, determine the initial water level height information based on the scale information, and set the initial water level according to the measurement error. Adjust the height information.
Improves the accuracy of water level height recognition, eliminating measurement errors when the water level is between two scales or the closest scale to the horizontal plane is not recognized.
Smart Images

Figure CN115393700B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a water level recognition method, device, electronic device and storage medium. Background Art
[0002] Water level is a basic hydrological element of rivers, lakes and reservoirs. Real-time water level is an important reference for flood control departments in flood disaster prevention, river basin flood control, and urban flood control command decision-making. At the same time, water level monitoring data is also an important indicator for water resource environmental supervision, development and utilization. In addition to manual observation readings, rivers and lakes are also monitored by automatic water level gauges. Automatic water level gauge monitoring mainly includes float type, pressure type, bubble type, ultrasonic type, radar type, and traditional image recognition methods are used to monitor water levels. These methods have many defects, such as manual monitoring, safety issues, high labor intensity and low degree of automation; various automatic water level gauges are costly, easily affected by the environment, difficult to install, and have high maintenance costs. Traditional image recognition methods have large errors due to inaccurate scale recognition and other reasons. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a water level recognition method, a water level recognition device, an electronic device and a computer-readable storage medium, which can improve the accuracy of water level recognition.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a method for identifying water level height is provided, including: extracting an image to be identified from a collected water gauge video stream; performing target detection on the image to be identified to obtain an image area above the horizontal plane, and acquiring the image area as a water gauge image; identifying scale information above the horizontal plane in the water gauge image, and determining initial water level height information of the horizontal plane based on the scale information, wherein the scale information includes adjacent scales, and the adjacent scales are scales closest to the horizontal plane; determining the pixel height of the adjacent scale from the horizontal plane, using the determined pixel height as the adjacent pixel height, and determining the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale; adjusting the initial water level height information according to the measurement error to obtain water level height information.
[0006] According to one aspect of an embodiment of the present application, a water level recognition device is provided, including: an extraction module, used to extract an image to be recognized from a collected water gauge video stream; a target detection module, used to perform target detection on the image to be recognized, obtain an image area above the horizontal plane, and acquire the image area as a water gauge image; a recognition module, used to recognize scale information above the horizontal plane in the water gauge image, and determine initial water level height information of the horizontal plane based on the scale information, the scale information includes adjacent scales, and the adjacent scales are the scales closest to the horizontal plane; a first determination module, used to determine the pixel height of the adjacent scale from the horizontal plane, use the determined pixel height as the adjacent pixel height, and determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale; an adjustment module, used to adjust the initial water level height information according to the measurement error to obtain water level height information.
[0007] According to one aspect of an embodiment of the present application, an electronic device is provided, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the above water level height identification method is implemented.
[0008] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the water level height identification method provided above.
[0009] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the water level height identification method provided in the above various optional embodiments.
[0010] The technical solution provided in the embodiments of the present application determines the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height of the adjacent scale to the horizontal plane to the average pixel height of the water gauge scale, and adjusts the initial water level height information according to the measurement error to obtain the water level height information. In this way, the measurement error of the water level height can be eliminated when the water level of the horizontal plane is between two scales of the water gauge or when the scale closest to the horizontal plane is not identified as an adjacent scale, thereby improving the recognition accuracy of the water level height.
[0011] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0013] Figure 1 is a schematic diagram of an implementation environment involved in the present invention shown in an exemplary embodiment of the present application;
[0014] Figure 2 is a schematic diagram of an implementation environment involved in the present invention shown in another exemplary embodiment of the present application;
[0015] Figure 3 is a flow chart of a water level height identification method shown in an exemplary embodiment of the present application;
[0016] Figure 4 is Figure 3 A schematic flow chart of a method for identifying a water level height is shown in an exemplary embodiment proposed on the basis of the illustrated embodiment;
[0017] Figure 5 is Figure 4 A schematic flow chart of a method for identifying a water level height is shown in an exemplary embodiment proposed on the basis of the illustrated embodiment;
[0018] Figure 6 is Figure 5 A schematic flow chart of a method for identifying a water level height is shown in an exemplary embodiment proposed on the basis of the illustrated embodiment;
[0019] Figure 7 is Figure 6 A schematic flow chart of a method for identifying a water level height is shown in an exemplary embodiment proposed on the basis of the illustrated embodiment;
[0020] Figure 8 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of an exemplary embodiment;
[0021] Fig. 9 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of an exemplary embodiment;
[0022] Fig.10 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of another exemplary embodiment;
[0023] Fig.11is a schematic diagram showing a method for identifying a water level height according to an exemplary embodiment of the present application;
[0024] Fig.12 is a schematic diagram showing a method for identifying a water level height according to an exemplary embodiment of the present application;
[0025] Fig.13 is a block diagram of a water level recognition device shown in an exemplary embodiment of the present application;
[0026] Fig.14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0028] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0029] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0030] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.
[0031] It is understandable that in the specific implementation of the present application, related data such as water level images and images to be identified are involved. When the above embodiments of the present application are applied to specific products or technologies, it is necessary to obtain the permission or consent of the relevant agencies, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0032] First, some terms involved in this application are explained:
[0033] Water gauge: Water gauge is widely used in soft soil foundation treatment, port terminals and other projects to observe changes in groundwater level and ocean tidal level.
[0034] Water depth: the distance from the water surface to the river bottom.
[0035] Absolute datum: The characteristic sea level elevation at a certain location is used as the zero-point leveling datum.
[0036] Station base: The elevation of a specific point is used as a reference to calculate the zero point of the water level.
[0037] Water level: Water level refers to the elevation of the free water surface relative to a certain base surface. The base surface used to calculate the water level can be an absolute base surface, and the Yellow Sea base surface is commonly used. A station base surface can also be used.
[0038] It should be noted that artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0039] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0040] Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to using cameras and computers to replace human eyes to identify and measure targets, and further perform image processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0041] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0042] The water level height identification method and device, electronic device, and computer-readable storage medium proposed in the embodiments of the present application involve artificial intelligence technology and computer vision technology, and these embodiments will be described in detail below.
[0043] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of the present invention shown in an exemplary embodiment of the present application. Figure 1 As shown, the implementation environment involved in the present invention at least includes a water gauge 13 installed in the water body, an image acquisition device 12 and a terminal device 11, wherein the water gauge 13 is used to measure the water level of the water body, and the water gauge 13 can be an electronic water gauge (including water gauges using ultrasonic or radar measurement technologies, which are relatively expensive), a stainless steel water gauge, a stainless steel combined water gauge, a polymer water gauge, an aluminum plate reflective water gauge, an enamel water gauge, etc., which are not specifically limited here. The image acquisition device 12 is used to collect water body images containing information of the water gauge 13, and send the collected water body images to the terminal device 11 through a data communication link, so that the terminal device 11 analyzes the water body images and obtains the water level of the water body.
[0044] Exemplarily, the terminal device 11 is used to identify the scale information above the horizontal plane in the water gauge image, determine the initial water level height information of the horizontal plane based on the scale information, the scale information includes the adjacent scale closest to the horizontal plane; determine the adjacent pixel height of the adjacent scale from the horizontal plane; determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale; adjust the initial water level height information according to the measurement error to obtain the water level height information.
[0045] The terminal device 11 may be a smart phone, tablet computer, PC (Personal Computer), intelligent voice interaction device, smart home appliance, vehicle-mounted terminal, aircraft or other electronic device, and is not limited here. The server 30 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, and is not limited here.
[0046] Figure 2 FIG. 1 is a schematic diagram of an implementation environment of the present invention shown in another exemplary embodiment of the present application. Figure 2 As shown, the implementation environment involved in the present invention at least includes a water gauge 23 installed in a water body, a central image acquisition device 22, an edge image acquisition device 23 and a terminal device 21, wherein the central image acquisition device 22 is communicatively connected to the edge image acquisition device 23, and the central image acquisition device 22 is communicatively connected to the terminal device 21. The central image acquisition device 22 and the edge image acquisition device 23 are used to photograph the water body containing information of the water gauge 23 from different angles or directions to obtain water body images at different angles. The edge image acquisition device 23 transmits the collected water body image to the central image acquisition device 22 through a communication link, and the central image acquisition device 22 again sends the collected water body image and the water body image received from the edge image acquisition device 23 to the terminal device 21. It can be understood that this embodiment does not limit the number of image acquisition devices, which can be flexibly changed according to the actual application scenario.
[0047] In this embodiment, the water gauge 23 is used to measure the water level of the water body. The water gauge 23 can be an electronic water gauge, a stainless steel water gauge, a stainless steel combination water gauge, a polymer water gauge, an aluminum plate reflective water gauge, an enamel water gauge, etc., which are not specifically limited here. The central image acquisition device 22 and the edge image acquisition device 23 are used to acquire water body images at different angles containing information of the water gauge 23, and send the acquired water body images to the terminal device 21 through a data communication link, so that the terminal device 21 analyzes the water body images and obtains the water level of the water body.
[0048] This embodiment collects water body images containing information of the water gauge 23 from different angles by setting a central image acquisition device 22 and an edge image acquisition device 23, thereby improving the accuracy of measuring the water level height of the water body.
[0049] In recent years, with the development of technologies such as edge devices and data warehouses, water conservancy departments have accumulated a large amount of video or image data of rivers, gates and other locations. The opening and closing degree of gates and the prevention and control of river flooding all depend on the identification and monitoring of water levels.
[0050] The existing water level recognition methods are mainly divided into traditional methods and data methods. Traditional water level recognition is further divided into manual recognition and sensor recognition. Manual recognition relies on staff to observe, identify and record the water gauge and water level on site, while sensor recognition mainly relies on remote sensing and recognition of water gauges and other equipment with built-in water level sensing hardware. Data-driven recognition methods mainly use artificial intelligence technologies such as target detection, image segmentation, OCR (Optical Character Recognition), image processing, etc., combined with edge devices such as cameras, to process, identify, monitor and report water gauge or water level images to cloud storage at a certain frequency on the edge side, assisting staff to implement gate opening and closing and flood discharge and flood control strategies in a timely manner. Target detection, also known as target extraction, is an image segmentation method based on target geometry and statistical features.
[0051] After long-term research, the inventor of this application found that the existing water level recognition method has the following disadvantages:
[0052] Manual statistical methods rely on the experience of staff, consume a lot of working time, and cannot be guaranteed to be safe in extreme weather conditions;
[0053] The hardware method of sensor recognition is difficult to operate and maintain. It often has problems such as low recognition accuracy and reduced timeliness in harsh environments. It still relies on a lot of manpower and material resources for maintenance to be used for a long time.
[0054] Generally, artificial intelligence methods such as one- or two-stage image segmentation, OCR or target detection cannot recognize small scales above the water surface. The error is generally around 5 cm, and it is unable to meet more precise recognition requirements such as 2 cm.
[0055] At least based on the above-mentioned defects, the present application provides a three-stage water level recognition method based on image segmentation, target detection and scale processing. A refined water level recognition model is constructed through technologies such as target detection and scale sparsity processing, overcoming the problems of traditional methods consuming manpower and material resources and excessive image processing recognition errors.
[0056] See also Figure 3 , Figure 3 is a flow chart of a water level recognition method shown in an exemplary embodiment of the present application. Figure 3 As shown, the water level recognition method provided in this embodiment includes steps S101 to S105, and the detailed description is as follows:
[0057] Step S101: extracting the image to be identified from the collected water level gauge video stream.
[0058] The image acquisition device acquires a plurality of water gauge video streams of images to be identified that contain water gauge information, records the acquisition time corresponding to each image, and selects a target image to be identified that corresponds to the acquisition time to be analyzed from the plurality of images. In this embodiment, the video stream is an image sequence of a water body that includes water gauge information acquired by the image acquisition device, for example, a river, stream, lake, etc. that includes water gauge, which is not specifically limited here.
[0059] Step S102: performing target detection on the image to be recognized, obtaining an image area above the horizontal plane, and acquiring the image area as a water gauge image.
[0060] Since the image to be identified includes information irrelevant to the water level identification, this information may interfere with the water level identification process. Therefore, this embodiment performs target detection on the image to be identified to obtain the image area above the horizontal plane, and the image area above the horizontal plane includes water gauge information.
[0061] Exemplarily, this embodiment can perform target detection on the image to be identified based on machine learning to obtain the image area above the horizontal plane. For example, pre-train the deeplabv3+ image segmentation model, input the image to be identified into the trained deeplabv3+ image segmentation model, and output the image area above the horizontal plane. Exemplarily, the labelme annotation tool is used to depict the water gauge contours of multiple images to be identified containing water gauge information, and save them as training samples to train the image segmentation model. The Deeplabv3+ algorithm uses resnet as the classification network, and introduces more scale information through DCNN (Dynamic Convolution Neural Network) with void convolution and pyramid pooling. By training multiple labeled training images, an accurate deeplabv3+ image segmentation model is constructed.
[0062] Step S103: Identify the scale information above the horizontal plane in the water gauge image, and determine the initial water level height information of the horizontal plane based on the scale information.
[0063] Water gauges are various scales set up on the shore to observe the rise and fall of water levels. Water gauges are widely used in soft soil foundation treatment, port terminals and other projects to observe changes in groundwater levels and ocean tidal levels. They have the characteristics of stable readings, anti-interference, and long life. There are usually multiple scales printed on the surface of the water gauge, and each scale corresponds to a character mark. The accuracy of the water gauge is generally measured in centimeters (the minimum scale is 1cm), and water conservancy is generally based on 1 meter as a section. The water gauge image is an image obtained by an image acquisition device to collect images of rivers, etc. including water gauge information.
[0064] Exemplarily, since the scale information below the horizontal plane is usually obscured, and the scale information below the horizontal plane is not needed to determine the initial water level height information of the horizontal plane, this embodiment only identifies the scale information above the horizontal plane. This embodiment does not limit the method of identifying the scale information above the horizontal plane in the water gauge image, for example, the scale information above the horizontal plane in the water gauge image is identified by manual identification or sensor identification. Exemplarily, the scale information above the horizontal plane in the water gauge image identified by this embodiment includes the position information of the scale and the character identification information corresponding to each scale.
[0065] Before the preliminary identification of the water level, the scale information of the water gauge image needs to be identified. This embodiment can identify the scale information of the water gauge image based on machine learning. For example, the YOLOv5 algorithm is used to train a pre-built scale recognition model, and the water gauge image is input into the trained scale recognition model to output the scale information. The YOLOv5 algorithm is a single-stage target detection algorithm. The algorithm adds some new improvement ideas on the basis of YOLOv4, which greatly improves its speed and accuracy. The main improvement ideas are as follows: Input: In the model training stage, some improvement ideas are proposed, mainly including Mosaic data enhancement, adaptive anchor frame calculation, and adaptive image scaling; Baseline network: Integrate some new ideas in other detection algorithms, mainly including: Focus structure and CSP structure; Neck network: The target detection network often inserts some layers between BackBone and the last Head output layer.
[0066] Exemplarily, if the height of adjacent pixels is greater than the average pixel height of the water gauge scale, it is determined that the water gauge scale recognition model has not recognized the scale closest to the horizontal plane, and there is a large recognition error. Therefore, a notification message is sent to the service platform so that the service platform adjusts the model parameters of the water gauge scale recognition model based on the notification message.
[0067] In this embodiment, the scale information includes the adjacent scale closest to the horizontal plane. The adjacent scale is the scale closest to the horizontal plane. Specifically, after identifying multiple scales above the horizontal plane, the scale closest to the horizontal plane is screened out from the multiple scales and identified as the adjacent scale. Exemplarily, the adjacent scale is determined based on the character representation corresponding to each scale. For example, a total of four scales are identified, namely the first scale, the second scale, the third scale and the fourth scale, wherein the character identifier corresponding to the first scale is 20, the character identifier corresponding to the second scale is 25, the character identifier corresponding to the third scale is 30, and the character identifier corresponding to the fourth scale is 35. Based on the character identifiers corresponding to these four scales, it can be determined that the adjacent scale is the first scale.
[0068] In this embodiment, the initial water level height information of the horizontal plane determined based on the scale information is very likely to have errors. On the one hand, the horizontal plane may not be exactly flush with the scale of the water gauge in actual application scenarios. In this case, the height between the horizontal plane and the first identified scale above the horizontal plane will cause recognition errors. In fact, the larger the scale of the water gauge, the greater the error of the initial water level height information obtained based on the scale information. In addition, under normal circumstances, the scale above the horizontal plane is not easy to be recognized compared to other scales, which may also cause recognition errors.
[0069] The initial water level information of the horizontal plane is determined based on the scale information. Exemplarily, the scale information includes character identifiers corresponding to adjacent scales, and the character identifiers corresponding to the adjacent scales are used as the initial water level information. Exemplarily, if the character identifiers corresponding to the adjacent scales can be identified, the character identifiers corresponding to the adjacent scales are used as the initial water level information.
[0070] Step S104: determine the pixel height of the adjacent scale from the horizontal plane, use the determined pixel height as the adjacent pixel height, and determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale.
[0071] In this embodiment, the adjacent pixel height represents the pixel distance between the adjacent scale and the horizontal plane in the water gauge image. In this embodiment, the adjacent pixel height can be determined in a variety of ways, such as manually measuring or calculating the pixel height of the adjacent scale from the horizontal plane based on a constructed coordinate system, which is not specifically limited here. Exemplarily, the pixel where the adjacent scale is located is first determined, and then the pixel where the horizontal plane and the water gauge intersect in the water gauge image is determined. The pixel height of the adjacent scale from the horizontal plane can be obtained by multiplying the number of pixels between the above two pixels by the height of the unit pixel.
[0072] Exemplarily, if the water gauge is marked with scales of multiple precisions, in order to reduce the error in identifying the water level height, the average pixel height of the water gauge scale refers to the scale with the smallest precision of the water gauge. For example, if the water gauge is marked with scales of two precisions, with scale accuracies of 1 decimeter and 1 meter respectively, then the average pixel height of the water gauge scale is 1 decimeter.
[0073] In fact, when determining the initial water level height information based on the scale information, the actual height corresponding to the adjacent pixel height is mistakenly regarded as a part of the water level height. Therefore, this embodiment determines the measurement error corresponding to the initial water level height information based on the adjacent pixel height. This embodiment can determine the measurement error by calculating the actual height corresponding to the adjacent pixel height.
[0074] Exemplarily, this embodiment can use the proportional method to determine the actual height corresponding to the height of adjacent pixels, arrange image acquisition devices and markers at the measurement position of the water body to be measured, the image acquisition device performs image acquisition on the marker, obtains a water level gauge image with the marker, and calculates the coordinate position and spatial geometric dimensions of the marker in the image and other parameters, divides the actual spatial distance of the marker by the pixel distance in the water level gauge image to obtain the water level gauge scale, and multiplies the water level gauge scale by the adjacent pixel height to obtain the measurement error.
[0075] Exemplarily, this embodiment first calculates the ratio of the adjacent pixel height to the average pixel height of the water gauge scale, and then determines the measurement error corresponding to the initial water level height information based on the ratio. Exemplarily, the product of the ratio of the adjacent pixel height to the average pixel height of the water gauge scale and the actual height corresponding to the unit scale is taken as the measurement error.
[0076] Step S105: adjusting the initial water level information according to the measurement error to obtain water level information.
[0077] In this embodiment, the real water level information can be obtained by subtracting the measurement error from the initial water level included in the initial water level information.
[0078] The water level recognition method provided in this embodiment determines the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height of the adjacent scale to the horizontal plane to the average pixel height of the water gauge scale, and adjusts the initial water level height information according to the measurement error to obtain the water level height information. In this way, the measurement error of the water level height can be eliminated when the water level of the horizontal plane is between two scales of the water gauge or when the scale closest to the horizontal plane is not recognized as an adjacent scale, thereby improving the recognition accuracy of the water level height.
[0079] Considering that the image to be identified may be affected by noise during the formation, transmission and reception process, the noise may reduce the image quality. The noise may cause the gray value of the image to change evenly and continuously to change suddenly, forming a false edge or contour. In order to eliminate the noise of the image to be identified, this embodiment uses Figure 3 An exemplary embodiment proposed on the basis of the illustrated embodiment shows a method for identifying water level height.
[0080] For example, see Figure 4 , Figure 4 is Figure 3 A schematic flow chart of a water level recognition method is shown in an exemplary embodiment based on the embodiment shown in FIG. Figure 4 As shown, the water level recognition method provided in this embodiment also includes steps S201-S202, and the detailed description is as follows:
[0081] Step S201: Determine the adjacent pixel region corresponding to each pixel in the image to be identified.
[0082] In this embodiment, the adjacent pixel region includes a preset number of surrounding pixels of the corresponding pixel. In this embodiment, the adjacent pixel region of the corresponding pixel is determined by determining a preset number of pixels that are closest to the corresponding pixel.
[0083] In this embodiment, the value of the preset number can be determined according to the actual application scenario, and no limitation is made here. For example, the preset number is 8, and the preset number of surrounding pixels of the pixel includes the eight pixels closest to the corresponding pixel.
[0084] In this embodiment, the number of pixels included in the adjacent pixel regions corresponding to each pixel may be the same or different, which is not specifically limited here.
[0085] Step S202: Calculate the average pixel value of the pixels contained in the adjacent pixel area, and replace the pixel values of the corresponding pixels with the average pixel value, so as to use the obtained processed image as the image to be identified for target detection.
[0086] This embodiment can reduce, suppress or eliminate the noise in the image to be recognized through the above method.
[0087] For example, the image to be identified is subjected to Gaussian filtering. Gaussian filtering is a linear filter that takes the weighted average of pixels within the filter window as the transformation result, which can make the image smooth and effectively suppress noise. The Gaussian filter needs to obtain the template coefficient by discretizing the Gaussian function, thereby generating a filter template and traversing the image window for processing.
[0088] For a template with a window size of 2k+l, the output value calculation formula is as follows:
[0089]
[0090] Where i and j are the horizontal and vertical coordinates of the pixel coordinates in the image to be identified, and σ is the standard deviation of the pixel. After Gaussian filtering, the white noise of the image to be identified that follows the normal distribution will be removed, and the next step of identification can be performed more accurately.
[0091] For example, see Figure 5 , Figure 5 is Figure 4 A schematic flow chart of a water level recognition method is shown in an exemplary embodiment based on the embodiment shown in FIG. Figure 5 As shown, the water level recognition method provided in this embodiment also includes steps 301 to S302, and the detailed description is as follows:
[0092] Step S301: grayscale the processed image to obtain a corresponding grayscale image.
[0093] In this embodiment, the processed image is Figure 4 The image to be identified in the denoising process of the embodiment shown. The process of converting a color image into a grayscale image is called grayscale processing of the image.
[0094] This embodiment can use a variety of grayscale processing methods to grayscale the processed image to obtain a corresponding grayscale image, such as component method, maximum method, average method, weighted average method, etc., which are not specifically limited here. The component method is to use the brightness of the three components of the pixel in the color image as the grayscale values of the three grayscale images, and a grayscale image can be selected as the grayscale processing result of the image according to application needs. The maximum method is to use the maximum value of the three-component brightness in the color image as the grayscale value of the grayscale image. The average method is to average the three-component brightness in the color image to obtain a grayscale value. The weighted average method is to weighted average the three components with different weights according to importance and other indicators.
[0095] Step S302: performing a grayscale linear transformation on the grayscale image based on a preset linear transformation formula to obtain a corresponding linear grayscale image, so as to use the linear grayscale image as an image to be identified for target detection.
[0096] Since the grayscale image obtained after direct grayscale processing may have unclear features, it is necessary to perform grayscale enhancement (ie, grayscale transformation) on the grayscale image. In this embodiment, linear grayscale transformation is performed on the grayscale image again to obtain an enhanced grayscale image.
[0097] Grayscale linear transformation is to use the linear transformation formula to establish a grayscale mapping relationship to adjust the grayscale of the grayscale image, so as to achieve the purpose of image enhancement.
[0098] The linear formula is:
[0099] f(c)=a*c+b
[0100] Among them, f(c) is the grayscale value of the pixel point of the grayscale image after linear transformation, c is the grayscale value of the corresponding pixel point of the original grayscale image before linear transformation, a is the slope of linear transformation, and b is the intercept of linear transformation.
[0101] The linear transformation formula of grayscale linear transformation will change with the change of slope and intercept. Different grayscale linear transformations are performed on the same grayscale image based on different linear formulas. Different parameters correspond to different linear formulas, and the degree of improvement on the image is also different. Different parameters are linear slope and intercept. The implementation of the present invention needs to find an image with the best image enhancement effect after grayscale linear transformation. It is necessary to continuously traverse the intercept and slope in the linear formula, and substitute different parameters into the linear formula, and then obtain a linear grayscale image according to the linear formula.
[0102] In this embodiment, the value range of the intercept in the linear transformation formula is determined by the grayscale mean value of the grayscale image.
[0103] The inventors of the present application have discovered that, in the prior art, when performing a grayscale linear transformation on an image, a pre-set slope value interval and intercept value interval are traversed to obtain the corresponding slope and intercept to form a linear transformation formula, and then a linear transformation is performed on the image based on the linear transformation formula. Usually, the value ranges of the slope and intercept are too large, resulting in problems such as too many traversals and too much calculation. The present application solves the problem of performing a grayscale linear transformation on the image by narrowing the value range of the intercept, that is, the value range of the intercept in the linear transformation formula is determined by the grayscale mean of the grayscale image. In this way, not only can computing power resources be saved and the efficiency of linear grayscale transformation be improved, but the image brightness can also be made clearly visible and consistent with the observation characteristics of the human eye.
[0104] Specifically: first obtain the proportion of the number of pixels of each gray level in the grayscale image, multiply the proportion of the number of pixels of each gray level by the corresponding gray level to obtain the gray level proportion, calculate the sum of multiple gray level proportions, and then obtain the gray level mean.
[0105] When setting the linear slope, since it is desired to keep the grayscale value range of the grayscale image before and after the grayscale linear transformation and the linear grayscale image within a normal range, the maximum value range of the intercept is [-255, 255]. However, there are many useless ranges in the maximum value range. When the grayscale value obtained by adding and subtracting most grayscale values from the intercept is not within the range of [0, 255], the value of the intercept is no longer considered. Therefore, this embodiment scales the range of the intercept according to the grayscale mean value of the grayscale image before the linear grayscale transformation.
[0106] In this embodiment, the intercept value range in the linear formula of the grayscale linear transformation is: [-255+μ, 255-μ], where μ is the grayscale mean of the grayscale image.
[0107] The embodiment of the present invention utilizes the grayscale mean of the grayscale image to narrow the value range of the intercept in the linear formula of the grayscale linear transformation, which is already relatively small. A plurality of linear grayscale images are obtained by traversing the intercepts within the value range, and a grayscale enhanced image is selected from the plurality of linear grayscale images according to the characteristics of the grayscale histogram of the linear grayscale image, thereby achieving the purpose of reducing the number of traversals and improving the calculation speed.
[0108] For example, see Figure 6 , Figure 6 is Figure 5 A schematic flow chart of a water level recognition method is shown in an exemplary embodiment based on the embodiment shown in FIG. Figure 6 As shown, the water level recognition method provided in this embodiment also includes steps 401 to S403, and the detailed description is as follows:
[0109] Step 401: Count the histogram distribution information of each gray level in the linear gray image.
[0110] The histogram distribution information of each gray level is to count the frequency of occurrence of all pixels in the digital image according to the size of the gray value.
[0111] Step 402: Determine the cumulative grayscale probability distribution function corresponding to the histogram distribution information.
[0112] In this embodiment, assuming that the number of pixels of the linear grayscale image is n, there are l grayscale levels in total, n_k represents the number of pixels with grayscale level r_k, then the probability of the kth grayscale level appearing is as follows:
[0113]
[0114] Therefore, the cumulative grayscale probability distribution function corresponding to the histogram distribution information is determined as follows:
[0115]
[0116] Step 403: using the cumulative grayscale probability distribution function as a transformation formula to perform histogram equalization on the image to be identified, so as to use the obtained corrected image as the image to be identified for target detection.
[0117] In this embodiment, the corrected image can be obtained by substituting the pixel value of each pixel of the linear grayscale image into the following cumulative grayscale probability distribution function:
[0118]
[0119] After the image is subjected to histogram equalization, the grayscale spacing of the image can be widened or the grayscale distribution can be uniform, thereby increasing the contrast, making the image details clear, and thus enhancing the image. Therefore, this embodiment performs histogram equalization on the image to be identified after grayscale transformation, which provides a good basis for the subsequent analysis of the water ruler and scale capture.
[0120] For example, see Figure 7 , Figure 7 is Figure 6 A schematic flow chart of a water level recognition method is shown in an exemplary embodiment based on the embodiment shown in FIG. Figure 7 As shown, the water level recognition method further includes steps 501 to S503, and the detailed description is as follows:
[0121] Step 501: Obtain the gradient amplitude of each pixel in the corrected image.
[0122] This embodiment uses a finite difference calculation method of first-order partial derivatives to calculate the gradient amplitude of the pixel grayscale of each pixel in the corrected image. For example, the partial derivatives of the corrected image in the horizontal and vertical directions can be approximately calculated by a two-dimensional first-order finite difference method, represented by Gx and Gy respectively, and the specific calculation method is as follows:
[0123]
[0124]
[0125] The magnitude and azimuth of its pixel gradient can be calculated using the following formula:
[0126]
[0127] θ(x, y) = arctan(G x / G y )
[0128] Among them, A(x, y) represents the gradient amplitude, which reflects the edge strength of the corrected image, and θ(x, y) represents the direction angle of the gradient, which reflects the direction of the edge.
[0129] Step 502: Perform non-maximum suppression on each gradient magnitude, and determine a non-maximum suppression image based on the obtained gradient magnitudes.
[0130] In this embodiment, the gradient amplitude of each pixel in the corrected image is compared with the gradient amplitude of its corresponding adjacent pixel along the gradient line. If the comparison result is that the gradient amplitude of the pixel in the corrected image is greater than the gradient amplitude of the adjacent pixel, the gradient amplitude of the pixel is retained; if the comparison result is that the gradient amplitude of the pixel in the corrected image is not greater than the gradient amplitude of the adjacent pixel, the gradient amplitude of the pixel is set to 0, and a non-maximum suppression image is generated according to the comparison result.
[0131] It should be understood that the gradient amplitude on the non-maximum suppressed image corresponds one-to-one to the pixels in the corrected image. After the above processing, on the non-maximum suppressed image, the gradient amplitude of the pixel whose gradient amplitude is less than the gradient amplitude of the adjacent pixel is set to 0, and the gradient amplitude of the pixel whose gradient amplitude is greater than the gradient amplitude of the adjacent pixel is retained.
[0132] S503: Detect edge information of the corrected image based on the non-maximum suppression image, so as to perform target detection on the corrected image based on the edge information.
[0133] In this step, since the obtained non-maximum suppression image has the edge information of each subject in the image, it is necessary to screen the useful edge information. Exemplarily, the gradient amplitude of the pixel in the non-maximum suppression image is compared with the preset threshold; if the gradient amplitude of the pixel in the non-maximum suppression image is less than the preset threshold, the pixel grayscale of each pixel in the corrected image corresponding to the pixel is set to 0; if the gradient amplitude of the pixel in the non-maximum suppression image is greater than or equal to the preset threshold, the pixel grayscale of each pixel in the corrected image is kept unchanged to obtain the edge information of the corrected image, so as to perform target detection on the corrected image based on the edge information.
[0134] For example, see Figure 8 , Figure 8 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of an exemplary embodiment, as shown in FIG. Figure 8 As shown, step S104 includes step S601-step S602, and the detailed description is as follows:
[0135] Step S601: Calculate the ratio of the adjacent pixel height to the average pixel height, and determine the ratio as the proportion of the adjacent pixel height to the average pixel height of the water gauge.
[0136] In actual application scenarios, the ratio of the adjacent pixel height to the average pixel height of the water gauge scale may be greater than 1, equal to 1 or less than 1. If the ratio of the adjacent pixel height to the average pixel height of the water gauge scale is equal to 1, it means that there is no measurement error in the initial water level height information. If the ratio of the adjacent pixel height to the average pixel height of the water gauge scale is greater than 1, it means that when the scale information of the water gauge image is identified, the scale closest to the horizontal plane is not identified; if the ratio of the adjacent pixel height to the average pixel height of the water gauge scale is less than 1, it means that the scale closest to the horizontal plane has been identified, and the horizontal plane is located between the adjacent scale and the scale closest to the horizontal plane below the horizontal plane. If the scale information identification situation is the former, the error is relatively too large. If it is the latter, the error is relatively small. Therefore, this embodiment can determine whether there is an error in the water level height information obtained by preliminary measurement of the water level height based on the scale information and the degree of the error based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale.
[0137] Step S602: Calculate the product between the ratio and the actual average height corresponding to the water gauge scale, and determine the calculated product value as the measurement error corresponding to the initial water level height information.
[0138] In this embodiment, the product of the ratio of the adjacent pixel height to the average pixel height of the water gauge scale and the actual average height corresponding to the water gauge scale is the real height of the adjacent scale from the horizontal plane.
[0139] In this embodiment, the unit scales in both the actual average height corresponding to the water ruler scale and the average pixel height of the water ruler scale refer to the smallest unit scale marked on the water ruler. The actual average height corresponding to the water ruler scale is an attribute parameter of the water ruler, which can be obtained directly or based on the scale information of the water ruler, and is not specifically limited here.
[0140] For example, see Fig. 9 , Fig. 9 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of an exemplary embodiment, as shown in FIG. Fig. 9 As shown, step S103 includes steps S701 to S703, and the detailed description is as follows:
[0141] Step S701: Determine the number of scales between non-adjacent scales and adjacent scales.
[0142] In this embodiment, the scale information also includes a character identifier for each scale. Usually, the character identifier of the scale is a number, and the character identifier of the scale indicates that if the water level reaches the scale, the height of the scale is the height of the current water level. For example, the scale information above the water gauge image includes a first scale and a second scale, wherein the character identifier corresponding to the non-adjacent scale is 20, and the character identifier corresponding to the second scale is 25.
[0143] This embodiment takes into account that in actual application scenarios, in the process of recognizing the water gauge image and obtaining the scale information, the character identifiers corresponding to the adjacent scales may not be fully recognized due to various reasons, for example, the character identifiers corresponding to the adjacent scales are covered by soil or the recognition effect of the scale recognition model is so poor that the character identifiers corresponding to the adjacent scales cannot be recognized, etc., and no specific limitation is made here. In this case, if the character identifiers corresponding to other scales except the adjacent scales can be recognized, the initial water level height information of the horizontal plane based on the character identifiers of the adjacent scales and other scales can also be obtained.
[0144] In this embodiment, the scale information also includes character identifiers corresponding to non-adjacent scales, and the distance between the non-adjacent scale and the horizontal plane is greater than the distance between the adjacent scale and the horizontal plane. In this embodiment, if the character identifier corresponding to the adjacent scale is not identified, but the character identifiers corresponding to multiple other scales are identified, the scale closest to the adjacent scale among the scales with the corresponding character identifiers identified is used as the non-adjacent scale. The number of scales between the non-adjacent scale and the adjacent scale is determined, wherein the number of scales includes the non-adjacent scale.
[0145] Step S702: Calculate the product of the number of scales and the actual height of the unit scale.
[0146] In this embodiment, the product of the number of scales and the actual height of the unit scale is the distance between the non-adjacent scale and the adjacent scale.
[0147] Step S703: Determine the difference between the character identifier of the non-adjacent scale and the calculated product value, and use the obtained difference as initial water level height information.
[0148] In fact, the difference between the character identifier of the non-adjacent scale and the calculated product value is equivalent to the scale value corresponding to the adjacent scale. In this way, the fault tolerance of the water level recognition method provided in the present application is improved.
[0149] For example, see Fig.10 , Fig.10 yes Figure 3 Step S103 in the illustrated embodiment is a flow chart of another exemplary embodiment, as shown in FIG. Fig.10 As shown, step S101 includes step S801-step S802, and the detailed description is as follows:
[0150] Step S801: Calculate the product of the actual average height corresponding to the unit scale of the water gauge and the total number of scales.
[0151] In actual application scenarios, if a water gauge without character identification is used to measure the water level or if the character identification corresponding to the scale is not identified when the scale information is identified, the initial water level information can be determined by the method provided in this embodiment.
[0152] In this embodiment, the scale information also includes the total number of scales above the horizontal plane. The product of the actual average height corresponding to a unit scale of the water gauge and the total number of scales is the remaining actual height of the water gauge above the adjacent scale.
[0153] Step S802: taking the third difference between the total length of the water gauge and the calculated product value as initial water level height information.
[0154] The third difference between the total length of the water gauge and the calculated product value is the remaining actual height of the water gauge below the adjacent scale. This embodiment uses this part of the height as the initial water level height information.
[0155] participate Fig.11 , Fig.11 is a schematic diagram of an exemplary embodiment of the present application showing a method for identifying a water level height, such as Fig.11 As shown, the water level recognition method provided in this embodiment includes steps S901 to S906, and the detailed description is as follows:
[0156] Step S901: Video stream input.
[0157] In this embodiment, the video stream is an image sequence of a water body including water gauge information acquired by an image acquisition device, for example, a river, stream, lake, etc. including a water gauge, which is not specifically limited here.
[0158] Step S902: image preprocessing.
[0159] In this embodiment, the image preprocessing includes performing linear smoothing filtering, grayscale linear transformation, histogram correction and binarization processing on the image to be identified, so as to facilitate the subsequent accurate identification of the scale information of the water gauge image after preprocessing.
[0160] Step S903: water gauge identification.
[0161] In this embodiment, target detection is performed on the image to be identified to locate the water gauge. Since the image to be identified includes information that is irrelevant to the recognition of the water level height, this information may interfere with the water level height recognition process. Therefore, in this embodiment, target detection is performed on the image to be identified to obtain the image area above the horizontal plane, and the image area above the horizontal plane includes the water gauge information.
[0162] This embodiment can perform target detection on the image to be identified based on machine learning to obtain the image area above the horizontal plane. For example, pre-train the deeplabv3+ image segmentation model, input the image to be identified into the trained deeplabv3+ image segmentation model, and output the image area above the horizontal plane. Exemplarily, the labelme annotation tool is used to depict the outline of the water gauge for multiple training images containing water gauges, and save them as training samples. The Deeplabv3+ algorithm uses resnet as the classification network, and introduces more scale information through DCNN with hole convolution and pyramid pooling. By training multiple labeled training images, an accurate deeplabv3+ image segmentation model is constructed.
[0163] Step S904: preliminary identification of water level.
[0164] In this embodiment, the preliminary identification of the water level is to perform a preliminary measurement of the water level in the water gauge image. Before the preliminary identification of the water level, the scale information of the water gauge image needs to be identified. This embodiment can identify the scale information of the water gauge image based on machine learning. For example, the scale recognition model is trained using the YOLOv5 algorithm, and the water gauge image is input into the trained scale recognition model to output the scale information. The YOLOv5 algorithm is a single-stage target detection algorithm. The algorithm adds some new improvement ideas on the basis of YOLOv4, which greatly improves its speed and accuracy. The main improvement ideas are as follows: Input: In the model training stage, some improvement ideas are proposed, mainly including Mosaic data enhancement, adaptive anchor frame calculation, and adaptive image scaling; Baseline network: Integrate some new ideas in other detection algorithms, mainly including: Focus structure and CSP structure; Neck network: The target detection network often inserts some layers between the BackBone and the last Head output layer.
[0165] This embodiment can determine the preliminary measurement method of the water level in the water gauge image according to the scale recognition situation. For example, if the character identifier corresponding to the adjacent scale is recognized, the character identifier corresponding to the adjacent scale is used as the result that the water level cannot be recognized; for example, if the character identifier corresponding to the adjacent scale cannot be recognized, but the character identifier corresponding to other scales is recognized, the distance between the other scales and the horizontal plane is greater than the distance between the adjacent scale and the horizontal plane. In this case, by first determining the number of scales between the non-adjacent scale and the adjacent scale; calculating the product of the number of scales and the actual height of the unit scale; determining the difference between the character identifier of the non-adjacent scale and the calculated product value, the obtained difference is used as the initial water level height information.
[0166] For example, if a water gauge without character identification is used to measure the water level, or if the character identification corresponding to the scale is not identified when identifying the scale information, the initial water level information can be determined by the method provided in this embodiment: first, the product of the actual height corresponding to the unit scale of the water gauge and the total number of scales is calculated. The third difference between the total length of the water gauge and the calculated product value is used as the initial water level information.
[0167] Step S905: Refined water level processing.
[0168] The recognition result obtained through the preliminary recognition of the water level in step S904 may have a large error. For example, if the horizontal plane is between the adjacent scale and the scale below the horizontal plane, it is very easy to ignore the height between the horizontal plane and the adjacent scale in this case, resulting in recognition error; or inaccurate recognition of the scale information of the water gauge image.
[0169] This embodiment refines the initial water level height information in the following manner. For example, the ratio of the adjacent pixel height to the average pixel height of the water gauge scale is calculated, and the ratio is determined as the ratio of the adjacent pixel height to the average pixel height of the water gauge scale. The product between the ratio and the actual height corresponding to the unit scale of the water gauge is calculated, and the calculated product value is determined as the measurement error corresponding to the initial water level height information, and the initial digital height information is adjusted based on the measurement error.
[0170] Step S906: water level identification.
[0171] In this embodiment, the final water level height can be obtained by subtracting the measurement error from the initial digital height information.
[0172] See also Fig.12 , Fig.12 is a schematic diagram of an exemplary embodiment of the present application showing a method for identifying a water level height, such as Fig.12 As shown, the water level recognition method provided in this embodiment includes steps S1 to S6, and the detailed description is as follows:
[0173] Step S1: Calculate the average pixel height of the scale.
[0174] In this embodiment, the average pixel height of the scales can be obtained by dividing the total length of the water ruler by the total number of scales of the water ruler.
[0175] Step S2: Calculate the height of the first scale pixel on the water surface.
[0176] Step S3: Compare the size relationship between the first scale pixel height above the horizontal plane and the average pixel height.
[0177] Step S4: If the pixel height of the first scale mark above the horizontal plane is greater than the average pixel height of the scale marks, subtract the average pixel height from the pixel height of the first scale mark above the horizontal plane, and then calculate the actual height between the first scale mark above the horizontal plane and the horizontal plane in proportion.
[0178] In this embodiment, if the pixel height of the first scale above the horizontal plane is greater than the average pixel height of the scale, it means that when the scale of the water ruler is identified, the scale closest to the horizontal plane cannot be identified. Therefore, when calculating the actual height between the first scale above the horizontal plane and the horizontal plane, the average pixel height is first subtracted, and then the actual height between the first scale above the horizontal plane and the horizontal plane is calculated proportionally. Specifically, the ratio of the adjacent pixel height to the average pixel height of the water ruler scale is calculated, and the ratio is determined as the ratio of the adjacent pixel height to the average pixel height of the water ruler scale; the product between the ratio and the actual height corresponding to the unit scale of the water ruler is calculated, and the calculated product value plus the height of the unit scale is determined as the measurement error corresponding to the initial water level height information.
[0179] Step S5: adjusting the initial water level height information based on the actual height between the first scale mark above the horizontal plane and the horizontal plane.
[0180] Step S6: If the pixel height of the first scale mark above the horizontal plane is less than the average pixel height of the scale marks, the actual height between the first scale mark above the horizontal plane and the horizontal plane is calculated proportionally.
[0181] participate Fig.13 , Fig.13 is a block diagram of a water level recognition device shown in an exemplary embodiment of the present application. Fig.13 As shown, the water level recognition device 2000 includes an extraction module 2001 , a target detection module 2002 , a recognition module 2003 , a first determination module 2004 and an adjustment module 2005 .
[0182] Among them, the extraction module 2001 is used to extract the image to be identified from the collected water gauge video stream; the target detection module 2002 is used to perform target detection on the image to be identified, obtain the image area above the horizontal plane, and obtain the image area as the water gauge image; the recognition module 2003 is used to identify the scale information above the horizontal plane in the water gauge image, and determine the initial water level height information of the horizontal plane based on the scale information, the scale information includes the adjacent scale, and the adjacent scale is the scale closest to the horizontal plane; the first determination module 2004 is used to determine the pixel height of the adjacent scale from the horizontal plane, use the determined pixel height as the adjacent pixel height, and determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale; the adjustment module 2005 is used to adjust the initial water level height information according to the measurement error to obtain the water level height information.
[0183] In another exemplary embodiment, the water level height identification device 2000 also includes a second determination module and a calculation module. The second determination module is used to determine the adjacent pixel area corresponding to each pixel in the image to be identified, and the adjacent pixel area includes a preset number of surrounding pixels of the corresponding pixel; the calculation module is used to calculate the average pixel value of the pixels contained in the adjacent pixel area, and replace the average pixel value with the pixel value of the corresponding pixel, so as to use the obtained processed image as the image to be identified for target detection.
[0184] In another exemplary embodiment, the water level height identification device 2000 also includes a grayscale processing module and a grayscale linear transformation module. The grayscale processing module is used to perform grayscale processing on the processed image to obtain a corresponding grayscale image; the grayscale linear transformation module is used to perform grayscale linear transformation on the grayscale image based on a preset linear transformation formula to obtain a corresponding linear grayscale image, so as to use the linear grayscale image as an image to be identified for target detection, wherein the value range of the intercept in the linear transformation formula is determined by the grayscale mean of the grayscale image.
[0185] In another exemplary embodiment, the water level recognition device 2000 further includes a statistical module, an equalization module and a third determination module, wherein the statistical module is used to count the histogram distribution information of each gray level in the linear gray image; the third determination module is used to determine the cumulative gray probability distribution function corresponding to the histogram distribution information; the equalization module is used to use the cumulative gray probability distribution function as a transformation formula to perform histogram equalization on the image to be recognized, so as to use the corrected image obtained as the image to be recognized for target detection.
[0186] In another exemplary embodiment, the water level height identification device 2000 also includes a second calculation module, a suppression module, and a fourth determination module, wherein the second calculation module is used to calculate the gradient amplitude of the corrected image by means of first-order partial derivative finite difference; the suppression module is used to perform non-maximum suppression on the gradient amplitude to obtain the suppressed gradient amplitude; the fourth determination module is used to determine the edge pixel points of the corrected image based on the suppressed gradient amplitude and the gradient amplitude before suppression, so as to perform target detection on the corrected image based on the edge pixel points.
[0187] In another exemplary embodiment, the identification module 2003 includes a first calculation unit and a second calculation unit. The first calculation unit is used to calculate the ratio of the adjacent pixel height to the average pixel height, and determine the ratio as the proportion of the adjacent pixel height to the average pixel height; the second calculation unit is used to calculate the product between the ratio and the actual average height corresponding to the water level scale, and determine the calculated product value as the measurement error corresponding to the initial water level height information.
[0188] In another exemplary embodiment, the identification module 2003 includes a first determination unit, a third calculation unit and a second determination unit. The first determination unit is used to determine the number of scales between non-adjacent scales and adjacent scales; the third calculation unit is used to calculate the product of the number of scales and the actual height of the unit scale; the second determination unit is used to determine the difference between the character identifier of the non-adjacent scale and the calculated product value, and use the obtained difference as the initial water level height information.
[0189] In another exemplary embodiment, the identification module 2003 includes a third calculation unit and a height acquisition unit, wherein the third calculation unit is used to calculate the product of the actual average height corresponding to the water gauge scale and the total number of scales; the height acquisition unit is used to use the third difference between the total length of the water gauge and the calculated product value as the initial water level height information.
[0190] It should be noted that the device provided in the above embodiment and the method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here.
[0191] In another exemplary embodiment, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the game account recommendation method as described above is implemented. In this embodiment, the electronic device includes but is not limited to a mobile phone, a computer, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, etc.
[0192] Fig.14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0193] It should be noted that Fig.14 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0194] like Fig.14 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 1003, such as executing the information recommendation method in the above embodiment. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002 and the RAM 1003 are connected to each other through the bus 1004. The input / output (I / O) interface 1005 is also connected to the bus 1004.
[0195] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0196] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.
[0197] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0198] It is understandable that in the specific implementation of this application, related data such as user information*** is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0199] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0200] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0201] Another aspect of the present application further provides a computer-readable storage medium having computer-readable instructions stored thereon, which, when executed by a processor, implements a game account recommendation method as in any of the previous embodiments.
[0202] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the game account recommendation method provided in each of the above embodiments.
[0203] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0204] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0205] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0206] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0207] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A method for identifying water level, characterized in that: include: Extract the image to be identified from the collected water gauge video stream; Determine an adjacent pixel region corresponding to each pixel in the image to be identified, wherein the adjacent pixel region includes a preset number of surrounding pixels of the corresponding pixel; Calculating an average pixel value of pixels contained in the adjacent pixel region, and replacing pixel values of corresponding pixels with the average pixel value to obtain a processed image; Performing grayscale processing on the processed image to obtain a corresponding grayscale image; Obtaining the proportion of the number of pixels of each gray level in the grayscale image, multiplying the proportion of pixels of each gray level by the corresponding gray level to obtain the grayscale proportion, calculating the sum of multiple grayscale proportions, and obtaining the grayscale mean of the grayscale image; Performing a grayscale linear transformation on the grayscale image based on a preset linear transformation formula to obtain a corresponding linear grayscale image, so as to use the linear grayscale image as an image to be identified for target detection, wherein a value range of an intercept in the linear transformation formula is determined by the grayscale mean value; Performing target detection on the image to be identified to obtain an image area above the horizontal plane, and acquiring the image area as a water gauge image; Identify the scale information above the horizontal plane in the water gauge image, and determine the initial water level height information of the horizontal plane based on the scale information, wherein the scale information includes adjacent scales, and the adjacent scales are scales closest to the horizontal plane; Determine the pixel height of the adjacent scale from the horizontal plane, use the determined pixel height as the adjacent pixel height, and determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale; The initial water level height information is adjusted according to the measurement error to obtain water level height information.
2. The method according to claim 1, characterized in that The method further comprises: Counting the histogram distribution information of each gray level in the linear gray image; Determine a cumulative grayscale probability distribution function corresponding to the histogram distribution information; The cumulative grayscale probability distribution function is used as a transformation formula to perform histogram equalization on the image to be identified, so that the obtained corrected image is used as the image to be identified for target detection.
3. The method according to claim 2, characterized in that The method further comprises: Obtaining the gradient amplitude of each pixel in the corrected image; Performing non-maximum suppression on the gradient magnitude of each pixel, and determining a non-maximum suppression image based on the obtained gradient magnitude; The edge information of the modified image is detected based on the non-maximum suppression image, so as to perform target detection on the modified image based on the edge information.
4. The method according to claim 1, characterized in that: The determining of the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water gauge scale includes: Calculating a ratio of the adjacent pixel height to the average pixel height, and determining the ratio as a proportion of the adjacent pixel height to the average pixel height; The product between the ratio and the actual average height corresponding to the water gauge scale is calculated, and the calculated product value is determined as the measurement error corresponding to the initial water level height information.
5. The method according to claim 1, characterized in that The scale information also includes a character identifier of a non-adjacent scale, and the distance between the non-adjacent scale and the horizontal plane is greater than the distance between the adjacent scale and the horizontal plane; the initial water level height information of the horizontal plane determined based on the scale information includes: Determine the number of scales between the non-adjacent scale and the adjacent scale; Calculate the product of the number of scales and the actual height of the unit scale; The difference between the character identifier of the non-adjacent scale and the calculated product value is determined, and the obtained difference is used as the initial water level height information.
6. The method according to claim 1, characterized in that The scale information also includes the total number of scales above the horizontal plane; the initial water level height information of the horizontal plane determined based on the scale information includes: Calculate the product of the actual average height corresponding to the water gauge scale and the total number of scales; The third difference between the total length of the water gauge and the calculated product value is used as the initial water level height information.
7. The method according to claim 1, characterized in that The step of identifying the scale information above the horizontal plane in the water gauge image comprises: Inputting the water gauge image into a pre-trained water gauge scale recognition model to obtain scale information output by the water gauge scale recognition model; The method further comprises: If the adjacent pixel height is greater than the average pixel height, a notification message is sent to a service platform so that the service platform adjusts the model parameters of the water gauge scale recognition model based on the notification message.
8. A water level recognition device, characterized in that: include: An extraction module is used to extract the image to be identified from the collected water gauge video stream; A second determination module is used to determine an adjacent pixel region corresponding to each pixel in the image to be identified, wherein the adjacent pixel region includes a preset number of surrounding pixels of the corresponding pixel; A calculation module, used for calculating an average pixel value of pixels contained in the adjacent pixel area, and replacing the pixel value of the corresponding pixel with the average pixel value to obtain a processed image; A grayscale processing module, used for performing grayscale processing on the processed image to obtain a corresponding grayscale image; A grayscale linear transformation module, used to perform grayscale linear transformation on the grayscale image based on a preset linear transformation formula to obtain a corresponding linear grayscale image, so as to use the linear grayscale image as an image to be identified for target detection, wherein the value range of the intercept in the linear transformation formula is determined by the grayscale mean value of the grayscale image; a target detection module, used to perform target detection on the image to be identified to obtain an image area above the horizontal plane, and obtain the image area as the water gauge image; A recognition module, used for recognizing the scale information above the horizontal plane in the water gauge image, and determining the initial water level height information of the horizontal plane based on the scale information, wherein the scale information includes an adjacent scale, and the adjacent scale is the scale closest to the horizontal plane; A first determination module is used to determine the pixel height of the adjacent scale from the horizontal plane, use the determined pixel height as the adjacent pixel height, and determine the measurement error corresponding to the initial water level height information based on the ratio of the adjacent pixel height to the average pixel height of the water ruler scale; The adjustment module is used to adjust the initial water level height information according to the measurement error to obtain the water level height information.
9. An electronic device, characterized in that: include: a memory storing computer-readable instructions; A processor reads the computer-readable instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
11. A computer program product, characterized in that comprising computer instructions stored in a computer-readable storage medium; The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, so that the computer device executes the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Water line determination method and device, storage medium and electronic device
CN110909640A