Waterfront line extraction method, device, equipment, storage medium and product

CN121640006BActive Publication Date: 2026-11-03CHINA MOBILE M2M +1
View PDF 2 Cites -1 Cited by

Patent Information

Application Number
CN202511802441.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-11-03
Estimated Expiration
2045-12-02

Smart Images

  • Figure CN121640006B_ABST
    Figure CN121640006B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a waterfront line extraction method, device, equipment, storage medium and product. The method comprises sampling a to-be-processed image to obtain a plurality of first image regions; performing waterfront line extraction on each first image region, determining at least one second image region according to the waterfront line extraction result of each first image region; and obtaining a target waterfront line existing in the to-be-processed image according to the waterfront line extraction result of each first image region and the waterfront line extraction result of the second image region. According to the embodiments of the present application, the first image region is sampled to perform rough screening of the waterfront line, and then the second image region is determined based on the extraction result to complete the detail completion, thereby saving the redundant reasoning task of full segmentation of the image. Meanwhile, combined with the asynchronous cooperation and resource dynamic allocation mechanism, the key area reasoning is focused, which not only improves the resource utilization rate and reasoning proportion, but also ensures the integrity of the waterfront line extraction, and significantly improves the large image reasoning efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, equipment, storage medium and product for shoreline extraction. Background Technology

[0002] Traditional deep learning methods for large-scale image inference often employ a full image segmentation followed by inference when handling large-scale target binary classification and detection tasks such as shoreline extraction. This results in excessive redundant tasks and a process that is mostly serial or partially parallel, making it impossible to dynamically allocate resources. Consequently, the model's inference ratio is low, resource utilization is insufficient, and the efficiency of large-scale image processing is limited. Summary of the Invention

[0003] This invention provides a method, apparatus, equipment, storage medium, and product for shoreline extraction, which can solve the technical problem of low processing efficiency in current shoreline extraction techniques.

[0004] In a first aspect, embodiments of the present invention provide a method for shoreline extraction, the method comprising: The image to be processed is sampled to obtain multiple first image regions of the image to be processed; The shoreline is extracted from each of the first image regions, and the shoreline extraction result of each of the first image regions is determined. Based on the shoreline extraction results of each first image region, at least one second image region is determined in the image to be processed. Based on the shoreline extraction results of the first image region and the shoreline extraction results of the second image region, the target shoreline existing in the image to be processed is obtained.

[0005] In one feasible implementation, the step of determining at least one second image region in the image to be processed based on the shoreline extraction results of each of the first image regions includes: Based on the shoreline extraction results of each first image region, a third image region containing a shoreline is selected from the plurality of first image regions; Based on the shoreline extraction results of the third image region, the shoreline direction analysis is performed to determine the extension direction of the shoreline in the third image region. Based on the direction of the extension of the shoreline in the third image region, at least one second image region is determined in the image to be processed.

[0006] In one feasible implementation, the step of analyzing the shoreline direction based on the shoreline extraction results of the third image region to determine the extension direction of the shoreline in the third image region includes: The third image region is divided into regions to obtain multiple edge regions existing in the third image region; Based on the shoreline extraction results of the third image region, the number of pixels belonging to the water body category in each edge region is counted. The direction of the shoreline extension in the third image region is determined based on the number of pixels belonging to the water body category in each edge region.

[0007] In one feasible implementation, the step of determining at least one second image region in the image to be processed based on the extension direction of the shoreline in the third image region includes: Based on the extension direction of the shoreline in the third image region, a valid image region adjacent to the third image region is determined in the image to be processed. Based on the sampling size of the third image region, the image is segmented in the effective image region to obtain the second image region.

[0008] In one feasible implementation, the step of extracting the shoreline of each of the first image regions and determining the shoreline extraction result of each of the first image regions includes: The image data of each first image region and the regional location information of each first image region are bound together to obtain the task processing data of each first image region; The task processing data of each of the first image regions is synchronously written to the data reading queue; Based on at least one inference process, the task processing data of each first image region in the data reading queue is used to extract the shoreline, thereby obtaining the shoreline extraction result of each first image region.

[0009] In one feasible implementation, after the step of extracting the shoreline of each of the first image regions and determining the shoreline extraction result of each of the first image regions, the method further includes: Read the shoreline extraction results of each of the first image regions from the data storage queue; Based on the splicing sub-thread and the regional location information of each first image region, the waterfront extraction results of each first image region are spliced ​​into the image to be processed to obtain the local waterfront of the image to be processed, wherein the target waterfront of the image to be processed includes the local waterfront.

[0010] Secondly, embodiments of the present invention provide a shoreline extraction device, the device comprising: The sampling module is used to sample the image to be processed to obtain multiple first image regions of the image to be processed; The extraction module is used to extract the shoreline of each of the first image regions and determine the shoreline extraction result of each of the first image regions; The processing module is used to determine at least one second image region in the image to be processed based on the shoreline extraction results of each first image region. The processing module is further configured to obtain the target shoreline in the image to be processed based on the shoreline extraction results of the first image regions and the shoreline extraction results of the second image regions.

[0011] Thirdly, embodiments of the present invention provide a shoreline extraction device, the device comprising: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the shoreline extraction method as described in the first aspect.

[0012] Fourthly, embodiments of the present invention provide a computer storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the shoreline extraction method of the first aspect is implemented.

[0013] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the shoreline extraction method as described in the first aspect.

[0014] The shoreline extraction method, apparatus, equipment, storage medium, and product of this invention first sample and obtain a first image region for coarse shoreline screening, and then determine a second image region based on the extraction results to complete the details, eliminating the redundant inference task of full image segmentation; at the same time, with the asynchronous collaboration and dynamic resource allocation mechanism, the model focuses on key area inference, which not only improves resource utilization and inference ratio, but also ensures the integrity of shoreline extraction, and achieves a significant improvement in the efficiency of large image inference. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a schematic flowchart of an embodiment of a shoreline extraction method provided by the present invention; Figure 2 This is a schematic diagram of the data flow of the shoreline extraction method provided in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the asynchronous reasoning process of the shoreline extraction method provided in Embodiment 1 of the present invention; Figure 4 This is a schematic flowchart of a second embodiment of a shoreline extraction method provided by the present invention; Figure 5 This is a schematic diagram of the overall process of the shoreline extraction method provided in Embodiment 2 of the present invention; Figure 6 This is a schematic diagram of the structure of a shoreline extraction device provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a shoreline extraction device provided in an embodiment of the present invention. Detailed Implementation

[0017] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.

[0018] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0019] Traditional deep learning image inference acceleration methods include the following steps: First, large images are read or segmented in parallel; second, smaller images are inferred in parallel; third, the large image is stitched together after all inference tasks are completed. In practice, the first two steps are parallelized, but the overall process is sequential; or the overall process is parallel, but the first two steps are sequential. When the image to be inferred is too large, the waiting time for the first and third steps is too long, resulting in the model's inference time accounting for a small percentage of the overall inference process. Furthermore, commonly used parallel processing methods are typically single-machine, multi-GPU configurations, making it difficult to accelerate inference for the same target image in multi-machine, multi-GPU scenarios. Additionally, there are no task allocation optimization strategies specifically for large target binary classification detection.

[0020] To address the problems of the prior art, embodiments of this application provide a method, apparatus, device, storage medium, and product for shoreline extraction. The shoreline extraction method provided in this application embodiment will be described first below.

[0021] Figure 1 A schematic flowchart of a shoreline extraction method according to an embodiment of this application is shown. Figure 1 As shown, the method may include steps 210-240: Step 210: Sample the image to be processed to obtain multiple first image regions of the image to be processed.

[0022] The execution entity in this embodiment can be a shoreline extraction device, which is a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone. The shoreline extraction device can sample the image to be processed and extract the shoreline from the sampled area. Based on the extraction results, it determines the area to be extracted in the image to be processed. Combining the extraction results of the sampled area and the secondary determined area, the target shoreline in the image to be processed is obtained.

[0023] The image to be processed refers to a digital image containing shoreline targets, specifically satellite remote sensing imagery, UAV aerial imagery, or water conservancy monitoring imagery, containing the boundary features between water and land areas. The first image region is a sub-region obtained from the image to be processed through sampling, serving as the initial unit for preliminary shoreline screening, and its spatial distribution covers the entire area of ​​the image to be processed.

[0024] After obtaining the image to be processed, preset sampling parameters are acquired, including but not limited to the size of the first image region and the sampling step size; a two-dimensional grid is established based on the pixel coordinates of the image to be processed, sub-regions are selected from the grid and pixel data is extracted to ensure that the sub-regions are not repeated and uniformly cover the entire area of ​​the image to be processed, and finally multiple first image regions are obtained.

[0025] Alternatively, when sampling, a checkerboard sampling method can be used: the image to be processed is divided into grids in the width and height directions with a fixed large step size (e.g., 1000 pixels), and only the image patch in the center area of ​​each grid is read, thereby obtaining multiple first image regions distributed in a checkerboard pattern.

[0026] In addition to the methods mentioned above, random sampling can also be used. The specific process of random sampling can be as follows: randomly generate a coordinate point in the image to be processed as the center, read a fixed-size image block centered on the point, and reasonably allocate the number of samples in each region to ensure the uniformity of spatial distribution.

[0027] To improve the overall efficiency of subsequent shoreline extraction, the shoreline extraction equipment can be equipped with a distributed scheduling framework. This framework can be used to deploy shoreline recognition models and use them as model computing nodes to form a model resource pool. At the same time, the three steps of image reading, inference, and stitching can run in parallel. Each step can achieve data interaction through a message queue. Differentiated task allocation optimization can be performed for shoreline extraction scenarios of large or small water areas, and finally, large-image shoreline inference results are output.

[0028] Step 220: Extract the shoreline of each of the first image regions and determine the shoreline extraction result of each of the first image regions.

[0029] The shoreline recognition result is structured data output after processing the image region, including but not limited to binary classification judgment of whether a shoreline exists, and the coordinate distribution of shoreline pixels when a shoreline exists.

[0030] To improve processing efficiency, optionally, after obtaining the first image region, shoreline extraction can be performed on multiple first image regions. The specific extraction methods may include, but are not limited to, the following two: by using a deployed deep learning model service, the first image region is asynchronously sent to a remote server for inference, and the returned shoreline extraction results are received; or a pre-trained semantic segmentation model is directly loaded locally on the model computing node to perform real-time inference on the first image region to output the shoreline extraction results, and multiple model computing nodes can be used for parallel processing to further improve the speed.

[0031] In one feasible implementation, step 220 may include steps A11-A13: Step A11: Bind the image data of each first image region and the regional location information of each first image region to obtain the task processing data of each first image region.

[0032] Step A12: Synchronously write the task processing data of each first image region to the data reading queue.

[0033] Step A13: Extract the shoreline from the task processing data of each first image region in the data reading queue according to at least one inference process, and obtain the shoreline extraction result of each first image region.

[0034] Image data refers to the pixel matrix information of the first image region, which can be an RGB three-channel pixel matrix or a single-channel grayscale pixel matrix; region location information refers to the spatial location data of the first image region in the image to be processed, which is used for global stitching and result positioning.

[0035] Task processing data is a unified data unit formed by structurally encapsulating the image data of the first image region, the region location information, and the complete path of the original image of the image to be processed. It can support direct parsing and calling by the inference process. For ease of understanding, Table 1 is used to illustrate the specific composition of task processing data.

[0036] Table 1 The data read queue is a thread-safe, blocking middleware used to cache data for task processing. Following a first-in, first-out (FIFO) principle, it can reconcile the difference between the image data preparation speed and the inference process processing speed. The inference process is an independent processing unit deployed on the model computation node, specifically responsible for image preprocessing, model inference, and result structuring. It can run individually or in multiple parallel processes.

[0037] In some embodiments, to adapt to multi-level, multi-GPU scenarios and further optimize resource utilization, a process pool strategy is used to control the number of concurrent processes during asynchronous processing. A distributed scheduling framework (such as Ray or Kubernetes) is utilized to more easily deploy deep learning models asynchronously on different nodes, forming model computing nodes. Unified control of all model computing nodes enables the initialization of the model resource pool, thereby providing the capability for multi-machine, multi-GPU model deployment.

[0038] Deep learning models typically rely on complex environments for compilation, requiring GPU drivers, deep learning framework packages, image reading toolkits, and more. Docker, as an efficient containerization technology, can package applications and their dependencies into lightweight, independent containers, ensuring consistent application performance in any environment. Therefore, it is used in this implementation to build the model's runtime environment.

[0039] The model resource pool can be established using, but is not limited to, the following two methods: 1. Package and compile the Ray framework and deep learning third-party dependencies into a Docker image, migrate this image to all model compute nodes, start the images on different nodes and build a Ray cluster, and finally start all nodes' models on the master node to load them and wait for image input data to be read from the message queue. 2. Build all model compute nodes into a Kubernetes cluster, package the deep learning model runtime image, and start Kubernetes tasks on different nodes of the cluster to deploy the model. The startup process on a single model compute node is as follows: first load the model, then keep the model resident in GPU memory and wait for data to be input via polling.

[0040] The initialization and data transfer process of the model resource pool is as follows: Figure 2 As shown: After initialization, the model resides in the GPU memory. It obtains task processing data through the data reading queue in the data transmission message queue. After inference is completed, the results are stored in the data storage queue, realizing asynchronous data interaction and efficient inference.

[0041] In deep learning image inference, one can read each sliding window of data before performing model inference, or read sliding window data in multiple threads, store it locally, and then perform inference. Furthermore, the results of multi-process inference must be completed before being stitched together. However, the above methods will cause idle waiting time during data reading.

[0042] Therefore, in this embodiment, a message queue is used to transmit model input and output data. The image data, region location information, and original image path of the image to be processed of all first image regions are structurally bound to form task processing data that supports direct parsing of the inference process. The task processing data of all first image regions are synchronously written into the data reading queue in grid index order.

[0043] Each inference process in the model resource pool automatically retrieves task processing data from the data reading queue, preprocesses it, inputs it into the model to complete the shoreline extraction, and then stores the shoreline extraction result of the first image region into the data storage queue in the message queue.

[0044] Optionally, when starting the shoreline extraction task of the image to be processed, the data reading thread pool, model resource pool, and asynchronous image stitching module can be started simultaneously to further optimize the execution efficiency of steps A11-A13. The data reading thread pool focuses on completing the data binding, generating task processing data, and queue writing operations, and stores the structured task processing data in the data reading queue in advance. After the models of each model computing node in the model resource pool are deployed, the task processing data of the first image region stored in the data reading queue in advance is immediately read and inference is performed. At the same time, the shoreline extraction results of each first image region are stored in the data storage queue. The exclusive data flow of the queue avoids other processes from processing the same data at the same time. The image stitching module reads the data from the data storage queue immediately after each shoreline extraction result is generated and starts the stitching operation synchronously, which greatly reduces the waiting time caused by data transmission.

[0045] In this implementation, by using a collaborative mode with a message queue, we avoid waiting for all data to be read before running the model and concatenating the data, and also reduce the time loss of reading the data again after it is stored in memory, thus greatly improving the efficiency of process connection.

[0046] In one possible implementation, step B11-B12 may be included after step 220: Step B11: Read the shoreline extraction results of each first image region from the data storage queue.

[0047] Step B12: Based on the stitching sub-thread and the regional location information of each first image region, the waterfront extraction results of each first image region are stitched into the image to be processed to obtain the local waterfront of the image to be processed, wherein the target waterfront of the image to be processed includes the local waterfront.

[0048] The data storage queue is a thread-safe blocking middleware used to cache the results of shoreline extraction. It follows the first-in-first-out rule and can coordinate the output speed of the inference process with the processing speed of the splicing process to ensure that the data is ordered and without loss.

[0049] The stitching sub-thread is a parallel processing unit independent of the main thread in the image stitching module. It has functions for mapping waterfront pixel coordinates, aligning regional spaces, and performing local stitching. Its execution does not block other processes. The local waterfront is the result of extracting the waterfront from the first image region, covering only the sampling range of the first image region, and is a fundamental component of the target waterfront.

[0050] After the stitching sub-thread starts, the results can be stitched as follows: The stitching sub-thread continuously monitors the data storage queue; when there is shoreline recognition data to be read in the queue, the shoreline extraction results of each first image region are read sequentially according to the first-in-first-out rule; the stitching sub-thread parses the regional location information of each first image region to determine its spatial coordinate range in the image to be processed; the global coordinates of the shoreline pixels of each image region are mapped to the virtual canvas of the image to be processed according to their spatial range; for overlapping pixel regions of multiple first image regions, a pixel union strategy is adopted to ensure that the shoreline is continuous without breaks; pixels in non-overlapping regions are directly filled, ultimately forming a local shoreline that only covers the sampling range of the first image region.

[0051] Optionally, the local shoreline can be associated with and stored with the identification information of the image to be processed (such as the full path of the original image) to clarify that the local shoreline is a component of the target shoreline, providing a spatial framework and basic data for the subsequent supplementary stitching of the second image region.

[0052] In this embodiment, the shoreline extraction results of the first image region are read asynchronously, and the local shoreline stitching is completed by combining the regional location information. This does not block the subsequent task process, and lays the foundation for the complete extraction of the target shoreline.

[0053] Step 230: Based on the shoreline extraction results of each first image region, determine at least one second image region in the image to be processed.

[0054] The second image region is a sub-region in the image to be processed, used to complete the details of the shoreline, which is spatially related to and has the same size as the first image region.

[0055] After obtaining the shoreline extraction results of the first image region, the first image region containing the shoreline is selected, its shoreline spatial distribution characteristics are analyzed, the adjacent regions that are not covered by sampling in the direction of shoreline extension are located, and the adjacent regions are cropped according to the size of the first image region to obtain the second image region.

[0056] Step 240: Based on the shoreline extraction results of each first image region and the shoreline extraction results of the second image region, the target shoreline in the image to be processed is obtained.

[0057] After obtaining the second image region, the shoreline is extracted in parallel for multiple second image regions to obtain the shoreline extraction result for each second image region.

[0058] In some embodiments, after the inference process obtains the extraction result of the second image region, it stores it in the data storage queue. The stitching sub-thread then combines the location information of the second image region to stitch the result into the existing local shoreline. After all the first and second image regions have been stitched and fused, the gaps between the regions are filled by linear interpolation, and finally the complete target shoreline of the image to be processed is output.

[0059] For ease of understanding, let's take... Figure 3 The asynchronous inference process proposed in this embodiment is illustrated with an example: Due to the multi-threaded, multi-process message queue interaction involved in data reading and model inference, stop flags and blocking mechanisms need to be added sequentially in the process to terminate the overall inference: 1. After the image reading thread pool completes data reading, add a blocking mechanism to the data reading thread pool, waiting for all image reading threads to finish. 2. Add a stop flag to the data reading queue. Nodes in the model resource pool will automatically release resources and terminate the inference process after reading the stop flag. 3. Add a blocking mechanism to the model inference process pool, waiting for all inference processes to finish. 4. Add a stop flag to the data storage queue. After the image stitching module reads the data, it stores the results and releases resources, terminating the stitching sub-thread. Simultaneously, the blocking and termination queues of the image stitching module need to be linked with the above process to ensure the orderly release of resources at each stage.

[0060] This embodiment first samples and obtains a first image region for coarse screening of the shoreline, and then determines a second image region based on its extraction results to complete the details, eliminating the redundant reasoning task of full image segmentation; at the same time, with the asynchronous collaboration and dynamic resource allocation mechanism, the model focuses on reasoning in key areas, which not only improves resource utilization and reasoning ratio, but also ensures the integrity of shoreline extraction, and achieves a significant improvement in the efficiency of large image reasoning.

[0061] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 4 The shoreline extraction method may include step 230, which may include steps 310-330: Step 310: Based on the shoreline extraction results of each first image region, select a third image region containing a shoreline from the plurality of first image regions.

[0062] The results of shoreline extraction from all first image regions are traversed. Based on the binary classification judgment of whether or not a shoreline exists, the first image regions containing the shoreline are selected and marked as the third image regions.

[0063] Step 320: Based on the shoreline extraction results of the third image region, perform shoreline direction analysis to determine the extension direction of the shoreline in the third image region.

[0064] The waterfront extraction results of the third image region are analyzed to determine the coordinate distribution of its waterfront pixels. Based on this coordinate distribution, the spatial distribution characteristics of the waterfront are analyzed to locate the main direction of the waterfront in the third image region, and then the extension direction of the waterfront is obtained. This extension direction is used to guide the positioning of the subsequent waterfront detail completion area.

[0065] Optionally, when analyzing spatial distribution characteristics, the proportion of water pixels at the edges can be used for judgment: calculate the proportion of water pixels at the left and right edges of the third image region; if the ratio exceeds a preset threshold (e.g., left edge water pixel count / right edge water pixel count > 2), then the shoreline is determined to be vertical and the extension direction is horizontal; alternatively, the direction vector can be calculated by contour fitting: extract the shoreline contour points, fit the principal direction vector through linear regression, and classify the extension direction according to the vector angle (e.g., angles within ±30° are considered horizontal extensions). Besides the above methods, other methods can also be used, and this embodiment does not limit them.

[0066] Step 330: Determine at least one second image region in the image to be processed based on the extension direction of the shoreline in the third image region.

[0067] Optionally, the adjacent areas not covered by sampling along the extension direction of the shoreline of the third image region are located, and the adjacent areas are cropped according to the size of the third image region to obtain the second image region.

[0068] In addition to the above methods, the second image region can also be determined by methods including but not limited to the following: statistically analyze the coverage of all third image regions in the image to be processed, filter blank areas not covered by the first image region along the extension direction of the shoreline, prioritize the blank area adjacent to the highest pixel density of the shoreline of the third image region, and crop the second image region according to the size of the third image region.

[0069] In one feasible implementation, step 320 may include steps C11-C13: Step C11: Divide the third image region into multiple edge regions.

[0070] Step C12: Based on the shoreline extraction results of the third image region, count the number of pixels belonging to the water body category in each edge region.

[0071] Step C13: Determine the extension direction of the shoreline in the third image region based on the number of pixels belonging to the water body category in each edge region.

[0072] Edge regions are sub-regions obtained by dividing the third image region according to its boundary orientation. They are used to focus on analyzing the distribution characteristics of the shoreline at the region boundary. The number of pixels of water body category is the total number of pixels of all water body categories within a single edge region, which is the core quantitative indicator reflecting the water distribution density of that edge region. Water body category pixels refer to the pixels that are identified as water bodies after shoreline extraction.

[0073] Optionally, a geometric segmentation algorithm can be used to divide the third image region into four edge regions: upper edge region, lower edge region, left edge region, and right edge region. The width of each edge region is set to a fixed value (e.g., 30 pixels), and extraction is performed from the image boundary inward. From the waterfront extraction results of the third image region, a pixel-level classification matrix is ​​obtained. The matrix size is consistent with that of the third image region, and the elements are classification labels for water bodies or non-water bodies. Based on the coordinate range of each edge region, all pixels within the corresponding coordinate range are selected from the classification matrix. The selected pixels are traversed, and the total number of pixels classified as water bodies is counted, thus obtaining the number of pixels belonging to the water body category in the left, right, upper, and lower edge regions.

[0074] In some embodiments, the ratio of the number of water body category pixels in the opposite edge regions is compared: the number of pixels belonging to the water body category in the left edge region and the right edge region are compared: if the number of pixels in the left edge / the number of pixels in the right edge > a preset ratio threshold (e.g., 2), it indicates that the water body has a significant difference in horizontal distribution in the left and right directions, and the shoreline is determined to be vertical, and the extension direction is horizontal to the right; if the number of pixels in the right edge / the number of pixels in the left edge > a preset ratio threshold (e.g., 2), the shoreline is determined to be vertical, and the extension direction is horizontal to the left.

[0075] Compare the number of pixels belonging to the water body category in the upper and lower edge regions: If the number of pixels at the upper edge / the number of pixels at the lower edge > the preset ratio threshold, it indicates that the water body has a significant difference in vertical distribution, and the shoreline is determined to be horizontal, with the extension direction being vertically downward; if the number of pixels at the lower edge / the number of pixels at the upper edge > the preset ratio threshold, the shoreline is determined to be horizontal, with the extension direction being vertically upward.

[0076] If all of the above ratios are less than or equal to the preset ratio threshold, it indicates that the water distribution is relatively uniform. The ratio can be further refined by combining the water pixel density in the edge area, or the extension direction can be determined to be oblique.

[0077] In this embodiment, the direction of shoreline extension is accurately determined by automated region division and pixel statistics, reducing computational redundancy and improving processing efficiency.

[0078] In one feasible implementation, step 330 may include steps D11-D12: Step D11: Based on the extension direction of the shoreline in the third image region, determine the effective image region adjacent to the third image region in the image to be processed.

[0079] Step D12: According to the sampling size of the third image region, the image is segmented in the effective image region to obtain the second image region.

[0080] Optionally, the location information of the third image region is obtained, and the effective image region is determined in the image to be processed by combining the location information of the region with the extension direction of the shoreline in the third image region. The effective image region must be directly adjacent to the third image region, distributed along the extension direction, not covered by the first image region, and within the boundary of the image to be processed throughout.

[0081] Using the sampling size of the third image region as a fixed block size, precise image slicing is performed in the effective image region to obtain the second image region; wherein, one side boundary of the second image region must be seamlessly adjacent to one side boundary of the third image region containing the shoreline to ensure the continuity of the shoreline completion.

[0082] In this embodiment, based on the regional location information of the third image region and the extension direction of the shoreline, the effective image region is accurately located and cut into blocks according to a uniform sampling size to obtain a second image region that is seamlessly connected with the third image region. This provides a precise target for shoreline detail completion and ensures the continuity of subsequent extraction and stitching.

[0083] To facilitate understanding, the process of the shoreline extraction method proposed in this embodiment will now be explained using checkerboard sampling, as shown below. Figure 5 As shown, the specific process may include the following steps: 1. Perform chessboard cropping on the image to be processed to obtain global block images, and send the corresponding inference tasks through the image reading thread pool and model resource pool. 2. Post-process the waterfront extraction results (i.e., inference results) of each first image region to identify the first image region with a waterfront, and obtain the extension direction and plot index of the waterfront in that region. 3. Based on the results of step 2, read the block images (i.e., second image regions) formed by supplementary cropping of the waterfront for the second time and send them for inference tasks. After inference by the model resource pool, the fusion result obtains the target waterfront of the image to be processed.

[0084] By adding a second step of data reading and reasoning process to the model resource pool, the waterfront extraction is finally achieved. This skips redundant tasks, minimizes redundant tasks, avoids invalid reasoning on pure background and pure water area segments, and greatly increases the efficiency of the entire waterfront extraction process.

[0085] This embodiment selects a third image region containing the waterline and accurately analyzes its waterline extension direction, providing a core basis for the accurate positioning of the subsequent second image region. This achieves intelligent optimization of the waterline extraction task, significantly reduces computational redundancy, and improves processing efficiency and accuracy.

[0086] like Figure 6 As shown, this application provides a shoreline extraction device 200, which may include a sampling module 201, an extraction module 202, and a processing module 203; The sampling module 201 is used to sample the image to be processed to obtain multiple first image regions of the image to be processed; Extraction module 202 is used to extract the shoreline of each of the first image regions and determine the shoreline extraction result of each of the first image regions; Processing module 203 is used to determine at least one second image region in the image to be processed based on the shoreline extraction results of each first image region; The processing module 203 is further configured to obtain the target shoreline in the image to be processed based on the shoreline extraction results of each first image region and the shoreline extraction results of the second image region.

[0087] Optionally, the processing module 203 is further configured to: Based on the shoreline extraction results of each first image region, a third image region containing a shoreline is selected from the plurality of first image regions; Based on the shoreline extraction results of the third image region, the shoreline direction analysis is performed to determine the extension direction of the shoreline in the third image region. Based on the direction of the extension of the shoreline in the third image region, at least one second image region is determined in the image to be processed.

[0088] Optionally, the processing module 203 is further configured to: The third image region is divided into regions to obtain multiple edge regions existing in the third image region; Based on the shoreline extraction results of the third image region, the number of pixels belonging to the water body category in each edge region is counted. The direction of the shoreline extension in the third image region is determined based on the number of pixels belonging to the water body category in each edge region.

[0089] Optionally, the processing module 203 is further configured to: Based on the extension direction of the shoreline in the third image region, a valid image region adjacent to the third image region is determined in the image to be processed. Based on the sampling size of the third image region, the image is segmented in the effective image region to obtain the second image region.

[0090] Optionally, the extraction module 202 is further configured to: The image data of each first image region and the regional location information of each first image region are bound together to obtain the task processing data of each first image region; The task processing data of each of the first image regions is synchronously written to the data reading queue; Based on at least one inference process, the task processing data of each first image region in the data reading queue is used to extract the shoreline, thereby obtaining the shoreline extraction result of each first image region.

[0091] Optionally, the extraction module 202 is further configured to: Read the shoreline extraction results of each of the first image regions from the data storage queue; Based on the splicing sub-thread and the regional location information of each first image region, the waterfront extraction results of each first image region are spliced ​​into the image to be processed to obtain the local waterfront of the image to be processed, wherein the target waterfront of the image to be processed includes the local waterfront.

[0092] Figure 7 A schematic diagram of the hardware structure of the shoreline extraction device provided in an embodiment of the present invention is shown.

[0093] The shoreline extraction device may include a processor 301 and a memory 302 storing computer program instructions.

[0094] Specifically, the processor 301 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.

[0095] Memory 302 may include mass storage for data or instructions. For example, and not limitingly, memory 302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 302 may include removable or non-removable (or fixed) media, or memory 302 may be non-volatile solid-state memory. Memory 302 may be internal or external to the integrated gateway disaster recovery device.

[0096] In one instance, memory 302 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0097] Memory 302 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.

[0098] The processor 301 reads and executes computer program instructions stored in the memory 302 to achieve... Figure 1 The method for extracting the shoreline in the illustrated embodiment.

[0099] In one example, the shoreline extraction device may also include a communication interface 303 and a bus 304. For example, Figure 7 As shown, the processor 301, memory 302, and communication interface 303 are connected through bus 304 and complete communication with each other.

[0100] The communication interface 303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.

[0101] Bus 304 includes hardware, software, or both, that couples components of the shoreline extraction device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 304 may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.

[0102] This shoreline extraction device can achieve a combination of shoreline extraction methods. Figures 1-5 The method described is for shoreline extraction.

[0103] Furthermore, in conjunction with the shoreline extraction methods described in the above embodiments, this invention can be implemented using a computer storage medium. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the shoreline extraction methods described in the above embodiments.

[0104] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the methods for shoreline extraction described in the above embodiments.

[0105] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.

[0106] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0107] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0108] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0109] The above description is merely a specific embodiment of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.

Claims

1. A method for extracting shoreline, characterized in that, The method includes: The image to be processed is sampled to obtain multiple first image regions of the image to be processed; The shoreline is extracted from each of the first image regions, and the shoreline extraction result of each of the first image regions is determined. Based on the shoreline extraction results of each of the first image regions, at least one second image region is determined in the image to be processed. Based on the shoreline extraction results of each of the first image regions and the second image regions, the target shoreline in the image to be processed is obtained; The step of determining at least one second image region in the image to be processed based on the shoreline extraction results of each of the first image regions includes: Based on the shoreline extraction results of each of the first image regions, a third image region containing a shoreline is selected from multiple first image regions. Based on the shoreline extraction results of the third image region, the shoreline direction analysis is performed to determine the extension direction of the shoreline in the third image region. Based on the extension direction of the shoreline in the third image region, at least one second image region is determined in the image to be processed; The step of analyzing the shoreline direction based on the shoreline extraction results of the third image region to determine the extension direction of the shoreline in the third image region includes: The third image region is divided into regions to obtain multiple edge regions existing in the third image region; Based on the shoreline extraction results of the third image region, the number of pixels belonging to the water body category in each edge region is counted. The direction of the shoreline extension in the third image region is determined based on the number of pixels belonging to the water body category in each of the edge regions.

2. The method according to claim 1, characterized in that, The step of determining at least one second image region in the image to be processed based on the extension direction of the shoreline in the third image region includes: Based on the extension direction of the shoreline in the third image region, a valid image region adjacent to the third image region is determined in the image to be processed. Based on the sampling size of the third image region, the image is segmented in the effective image region to obtain the second image region.

3. The method according to claim 1 or 2, characterized in that, The step of extracting the shoreline of each of the first image regions and determining the shoreline extraction result of each of the first image regions includes: The image data of each first image region and the regional location information of each first image region are bound together to obtain the task processing data of each first image region. The task processing data for each of the first image regions is synchronously written to the data reading queue; Based on at least one inference process, the task processing data of each of the first image regions in the data reading queue is used to extract the shoreline, thereby obtaining the shoreline extraction result of each of the first image regions.

4. The method according to claim 1 or 2, characterized in that, After the step of extracting the shoreline of each of the first image regions and determining the shoreline extraction result of each of the first image regions, the method further includes: Read the shoreline extraction results of each of the first image regions from the data storage queue; Based on the splicing sub-thread and the regional location information of each of the first image regions, the waterfront extraction results of each of the first image regions are spliced ​​into the image to be processed to obtain the local waterfront of the image to be processed, wherein the target waterfront of the image to be processed includes the local waterfront.

5. A shoreline extraction device, characterized in that, The device includes: The sampling module is used to sample the image to be processed to obtain multiple first image regions of the image to be processed; The extraction module is used to extract the shoreline of each of the first image regions and determine the shoreline extraction result of each of the first image regions; The processing module is used to determine at least one second image region in the image to be processed based on the shoreline extraction results of each of the first image regions. The processing module is further configured to obtain the target shoreline in the image to be processed based on the shoreline extraction results of each of the first image regions and the shoreline extraction results of the second image regions. The processing module is specifically used to: filter out a third image region containing a shoreline from multiple first image regions based on the shoreline extraction results of each first image region; perform shoreline direction analysis based on the shoreline extraction results of the third image region to determine the extension direction of the shoreline in the third image region; and determine at least one second image region in the image to be processed based on the extension direction of the shoreline in the third image region. The processing module is specifically used to divide the third image region into multiple edge regions; based on the shoreline extraction results of the third image region, count the number of pixels belonging to the water body category in each edge region; and determine the extension direction of the shoreline in the third image region based on the number of pixels belonging to the water body category in each edge region.

6. A shoreline extraction device, characterized in that, The shoreline extraction device includes a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the shoreline extraction method as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the shoreline extraction method as described in any one of claims 1-4.

8. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the shoreline extraction method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Shoreline identification processing method and system based on artificial intelligence

    CN119600442A

  • Shoreline extraction method and shoreline-extracting system

    JP2005346665A