Method, device, electronic device and storage medium for extracting land blocks from images
By performing semantic segmentation and edge detection on the image, and combining the contour information for cutting processing, the problem of inaccurate extraction of plots in the image is solved and higher accuracy is achieved.
Patent Information
- Application Number
- CN202110314810.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-03-24
AI Technical Summary
When extracting plots in an image, the existing technology has a problem of insufficient accuracy due to the compact distribution of plots.
By performing semantic segmentation and edge detection on the image to be processed, the semantic area and contour information of the plot are obtained, and cutting processing is performed based on the contour information to obtain the semantic cutting area, thereby extracting the plot image.
It effectively distinguishes the boundaries between different plots and improves the accuracy of plot extraction.
Smart Images

Figure CN112884764B
Abstract
Description
Technical Field
[0001] The present application relates to image processing technology, and in particular to a method, device, electronic device and storage medium for extracting land blocks from an image. Background Art
[0002] With the continuous development of image processing technology, using image processing technology for analysis is one of the key research directions in the application field.
[0003] In the related art, when extracting land plots from images, the method usually used is to extract features from the image, identify the image area that meets the features based on the extracted image features, and extract the land plots from it. However, in actual scenes, the land plots are often compactly distributed, and the extraction method using the related art cannot extract accurate land plots from the image based on this feature. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for extracting land parcels from an image, which can extract more accurate land parcel images.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application embodiment provides a method for extracting land blocks in an image, including:
[0007] Performing semantic segmentation processing on the image to be processed containing the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel;
[0008] Performing edge detection on the land parcel in the image to be processed to obtain contour information of the land parcel;
[0009] Based on the contour information of the land parcel, a semantic region corresponding to the land parcel is cut to obtain a semantic cut region corresponding to the land parcel;
[0010] Determine the region position of the semantic cutting region in the semantic segmentation image;
[0011] An image corresponding to the regional position is extracted from the image to be processed to obtain a plot image corresponding to the plot.
[0012] The present application embodiment provides a device for extracting land blocks in an image, including:
[0013] A semantic segmentation module, used to perform semantic segmentation processing on the image to be processed containing the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel;
[0014] An edge detection module is used to perform edge detection on the land parcel in the image to be processed to obtain contour information of the land parcel;
[0015] A semantic cutting module, used for cutting the semantic area corresponding to the land parcel based on the contour information of the land parcel, to obtain the semantic cutting area corresponding to the land parcel;
[0016] A determination module, used to determine the region position of the semantic cutting region in the semantic segmentation image;
[0017] The image extraction module is used to extract the image corresponding to the regional position of the image to be processed to obtain a plot image corresponding to the plot.
[0018] In the above scheme, the edge detection module is also used to perform edge detection on the plots in the image to be processed through an edge detection model to obtain a corresponding edge detection image; determine the contour position of the plot contour corresponding to the plot in the edge detection image, and use the contour position as the contour information.
[0019] In the above scheme, the device for detecting a plot of land in an image also includes: an edge detection model training module, used to obtain edge detection image samples, the edge detection image samples carry contour labels, and the contour labels are used to indicate contour information of the plot of land in the edge detection image samples; performing edge detection on the edge detection image samples through the edge detection model to obtain predicted contour information of the plot of land in the edge detection image samples; and updating the model parameters of the edge detection model based on the difference between the predicted contour information and the contour label.
[0020] In the above scheme, the semantic cutting module is also used to determine the contour area corresponding to the plot in the semantic segmentation image based on the contour information of the plot; and remove the contour area from the semantic area to achieve cutting processing of the semantic area corresponding to the plot.
[0021] In the above scheme, the semantic segmentation image is a binary image, the pixel value corresponding to the semantic area in the semantic segmentation image is a first pixel value, and the pixel value corresponding to the non-semantic area in the semantic segmentation image is a second pixel value; the semantic cutting module is also used to assign the pixel value corresponding to the contour area to the second pixel value; determine the target pixel point in the semantic area whose pixel value is the second pixel value; remove the target pixel point from the semantic area to achieve cutting processing of the semantic area corresponding to the plot.
[0022] In the above scheme, the size of the semantic segmentation image is the same as the size of the image to be processed, and the device for the land block in the image also includes: a coordinate system establishment module, used to establish a first pixel coordinate system in the image to be processed, and to establish a second pixel coordinate system in the semantic segmentation image, and there is a coordinate mapping relationship between the first pixel coordinate system and the second pixel coordinate system; wherein, the first pixel coordinate system and the second pixel coordinate system are used to realize image extraction corresponding to the regional position of the image to be processed.
[0023] In the above scheme, the determination module is also used to determine the pixel coordinates of the semantic cutting area in the second pixel coordinate system, and use the pixel coordinates as the regional position of the semantic cutting area in the semantic segmentation image; the image extraction corresponding to the regional position of the image to be processed includes: based on the coordinate mapping relationship, determining the target pixel coordinates of mapping the pixel coordinates from the second pixel coordinate system to the first pixel coordinate system; performing image extraction corresponding to the target pixel coordinates on the image to be processed, so as to realize image extraction corresponding to the regional position of the image to be processed.
[0024] In the above scheme, the semantic segmentation processing is implemented through a semantic segmentation model, and the device for the land plot in the image also includes: a semantic segmentation model training module, which is used to construct a sample image pair, and the sample image pair includes a sample original image containing the land plot, and a sample semantic segmentation image corresponding to the sample original image; through the semantic segmentation model, the sample original image is subjected to semantic segmentation processing to obtain a corresponding predicted semantic segmentation image; based on the difference between the predicted semantic segmentation image and the sample semantic segmentation image, the model parameters of the semantic segmentation model are updated.
[0025] In the above scheme, the semantic cutting area includes multiple block areas, the block image includes block images corresponding to each of the block areas, and the device for the block in the image also includes: a classification module, which is used to perform the following processing on each of the block images respectively: cutting the block image to obtain multiple sub-block images; extracting features for each of the sub-block images respectively to obtain corresponding image features; classifying the sub-block images based on the image features to obtain classification results for each of the sub-block images, and the classification results are used to indicate the block category of the corresponding sub-block image; based on the classification results of each of the sub-block images, determining the block category corresponding to the block image.
[0026] An embodiment of the present application provides an electronic device, including:
[0027] A memory for storing executable instructions;
[0028] The processor is used to implement the method for extracting land blocks in an image provided in an embodiment of the present application when executing the executable instructions stored in the memory.
[0029] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute instructions to implement the method for extracting land blocks in an image provided in the embodiment of the present application.
[0030] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the method for extracting land blocks in an image provided by the embodiment of the present application is implemented.
[0031] The embodiments of the present application have the following beneficial effects:
[0032] Compared with the method of using feature extraction to identify plots of land in the prior art, in an embodiment of the present application, semantic segmentation and edge detection are performed on the image to be processed containing the plots of land to obtain semantic areas and contour information corresponding to the plots of land, and the semantic area is further cut based on the contour information to obtain the cut semantic cut area, and based on the regional position of the semantic cut area in the semantic segmentation image, an image of the corresponding regional position is extracted from the image to be processed to obtain a plot image of the plot of land, thereby effectively distinguishing the boundaries between different plots of land, overcoming the defect that the plot extraction method adopted in the prior art is not accurate enough, and improving the accuracy of plot extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is an optional structural diagram of a system for extracting land parcels in an image provided in an embodiment of the present application;
[0034] Figure 2 is an optional structural diagram of an electronic device provided in an embodiment of the present application;
[0035] Figure 3 is an optional flowchart of a method for extracting land parcels in an image provided in an embodiment of the present application;
[0036] Figure 4A is an optional schematic diagram of an image to be processed provided in an embodiment of the present application;
[0037] Figure 4B is an optional schematic diagram of a semantic segmentation image provided in an embodiment of the present application;
[0038] Figure 4C is an optional schematic diagram of an edge detection image provided in an embodiment of the present application;
[0039] Figure 4D is an optional schematic diagram of a semantically segmented image after cutting provided in an embodiment of the present application;
[0040] Figure 5 is an optional flowchart of a method for extracting land parcels in an image provided in an embodiment of the present application;
[0041] Figure 6 is an optional flowchart of a method for extracting land parcels in an image provided in an embodiment of the present application;
[0042] Fig. 7A is an optional schematic diagram of a first pixel coordinate system provided in an embodiment of the present application;
[0043] Figure 7B is an optional schematic diagram of a second pixel coordinate system provided in an embodiment of the present application;
[0044] Figure 8 is an optional schematic diagram of classification processing based on a plant classification model provided in an embodiment of the present application;
[0045] Fig. 9 It is an optional flowchart of the model training process provided in the embodiment of the present application;
[0046] Fig.10 It is an optional flowchart of the method for extracting land plots in an image provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0048] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0049] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0051] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0052] 1) Semantic segmentation refers to labeling each pixel in an image with a corresponding category without distinguishing individuals. In simple terms, it is to divide the visual input data into different semantically interpretable categories.
[0053] 2) Edge detection, the purpose of which is to identify points in a digital image where brightness changes significantly. Significant changes in image attributes usually reflect important events and changes in attributes, including: discontinuities in depth, discontinuities in surface orientation, changes in material properties, and changes in scene lighting.
[0054] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for extracting land parcels from an image, which can extract more accurate land parcel images.
[0055] First, the system for extracting land parcels from an image provided by the embodiment of the present application is described. Figure 1 , Figure 1 It is an optional architecture diagram of the system 100 for extracting land in an image provided by an embodiment of the present application. The terminal 400 is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and a wireless link is used to realize data transmission. In some embodiments, the terminal 400 can be a laptop, a tablet computer, a desktop computer, a smart phone, a dedicated messaging device, a portable gaming device, a smart speaker, a smart watch, etc., but is not limited to this. The server 200 can be an independent physical server, or a server cluster or a 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, and big data and artificial intelligence platforms. The network 300 can be a wide area network or a local area network, or a combination of the two. The terminal 400 and the server 200 can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiments of the present application.
[0056] The terminal 400 is used to obtain the image to be processed including the land parcel, and send the image to be processed to the server 200 .
[0057] The server 200 is used to perform semantic segmentation processing on the image to be processed containing the plot to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the plot, perform edge detection on the plot in the image to be processed to obtain contour information of the plot, perform cutting processing on the semantic area corresponding to the plot based on the contour information of the plot to obtain a semantic cutting area corresponding to the plot, determine the regional position of the semantic cutting area in the semantic segmentation image, perform image extraction corresponding to the regional position on the image to be processed, obtain a plot image corresponding to the plot and return it to the terminal 400.
[0058] The terminal 400 is further configured to receive and output a land parcel image.
[0059] See also Figure 2 , Figure 2 is an optional structural diagram of an electronic device 500 provided in an embodiment of the present application. In practical applications, the electronic device 500 can be implemented as Figure 1 The terminal 400 or the server 200 in the embodiment of the present invention is an electronic device. Figure 1 Taking the server 200 as an example, an electronic device for implementing the method for extracting land blocks in an image according to an embodiment of the present application is described. Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It can be understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .
[0060] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0061] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0062] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0063] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0064] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0065] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0066] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);
[0067] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0068] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0069] In some embodiments, the device for extracting land blocks in an image provided in the embodiments of the present application can be implemented in a software manner. Figure 2The device 555 for extracting land blocks in an image stored in the memory 550 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a semantic segmentation module 5551, an edge detection module 5552, a semantic cutting module 5553, a determination module 5554 and an image extraction module 5555. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0070] In other embodiments, the device for extracting land blocks in an image provided in the embodiments of the present application can be implemented in hardware. As an example, the device for extracting land blocks in an image provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the method for extracting land blocks in an image provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0071] The method for extracting land parcels from an image provided by the embodiment of the present application will be described in combination with the exemplary application and implementation of the server provided by the embodiment of the present application. Figure 3 , Figure 3 is an optional flow chart of a method for extracting land parcels from an image provided in an embodiment of the present application, which is combined with Figure 3 The steps shown are explained.
[0072] Step 101: The server performs semantic segmentation processing on the image to be processed containing the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel.
[0073] Here, the image to be processed can be collected in any manner, for example, it can be collected by high-resolution drone fixed-point aerial photography, satellite photography, or aircraft aerial photography for the county, city, province, or even the whole country, to obtain ground imaging data, and then filter out image distortion through radiation correction, geometric correction, atmospheric correction, etc., and convert it into an RGB image to obtain the image to be processed. In some embodiments, the image to be processed may also be an RGGB image, etc., and the embodiment of the present application does not specifically limit the image format of the image to be processed. Among them, the classification of plots by category may include but is not limited to forestry plots, crop plots, construction plots, etc., and the embodiment of the present application does not specifically limit the category of the plots.
[0074] For example, see Figure 4A , Figure 4A 4 is an optional schematic diagram of an image to be processed provided in an embodiment of the present application. In addition to the land parcel 41, the image to be processed may also contain other image contents, such as forest trees 42, house buildings 43, etc. Among them, Figure 4A The plot 41 shown includes two adjacent sub-plots on the left and right, which are plots of different categories, for example, different crops may be planted in the plots.
[0075] It should be noted that the image to be processed may be collected in advance and stored in an image library, and when it is necessary to extract a plot of land from the image to be processed, the server obtains it from the image library. In some embodiments, the image to be processed may also be sent to the server in real time after being collected, so that the server extracts a plot of land from the image to be processed.
[0076] In actual implementation, after obtaining the image to be processed, the server performs semantic segmentation on the image to be processed to obtain a corresponding semantic segmentation image. Among them, the semantic segmentation image contains semantic areas corresponding to the plots. It should be noted that the semantic segmentation image also includes non-semantic areas corresponding to non-plots. In an embodiment of the present application, after the server performs semantic segmentation on the RGB image to be processed, it binarizes the image to be processed to distinguish between semantic areas and non-semantic areas. Here, the server can assign pixels in the semantic area to a first pixel value and assign pixel values in the non-semantic area to a second pixel value. For example, the first pixel value is 1 and the second pixel value is 0. The pixel point with a pixel value of 1 can be corresponded to white, and the pixel point with a pixel value of 0 can be corresponded to black. For example, see Figure 4B , Figure 4B is an optional schematic diagram of a semantic segmentation image provided in an embodiment of the present application, in which the white area in the figure is the semantic area corresponding to the land parcel, and the black area is the non-semantic area corresponding to the non-land parcel. Figure 4B The semantic region 44 shown corresponds to Figure 4A Plot 41 is shown.
[0077] In some embodiments, the semantic segmentation process is implemented by a semantic segmentation model. Figure 5 , Figure 5 is an optional flow chart of a method for extracting land parcels from an image provided in an embodiment of the present application, based on Figure 3 Before step 101, you may also execute:
[0078] Step 201: The server constructs a sample image pair, wherein the sample image pair includes a sample original image containing a land parcel, and a sample semantic segmentation image corresponding to the sample original image.
[0079] In actual implementation, the server obtains the remote sensing image of the plot, and obtains the sample original image after preprocessing the remote sensing image. Here, preprocessing includes correcting and cropping the remote sensing image. Then, for the sample original image, the area where the plot is located is manually marked to obtain the corresponding sample semantic segmentation image. Manual marking can use open source annotation software, such as labelme, ArcGIS and other annotation software, and use the above labels to segment the remote sensing image to obtain a sample semantic segmentation image including at least one plot. Here, in order to distinguish between different adjacent plots, the boundaries can be left blank during manual marking, or morphological corrosion operations can be performed on each marked plot. By manually marking and cutting plant plots, multiple plots can be accurately segmented.
[0080] Step 202: Perform semantic segmentation processing on the sample original image through the semantic segmentation model to obtain a corresponding predicted semantic segmentation image.
[0081] Here, the semantic segmentation model can be implemented using a neural network model, such as a U-Network (U-Net), a fully convolutional network (FCN), a feature pyramid network (FPN), a deep convolutional encoder-decoder architecture for image segmentation (SegNet, ADeep Convolutional Encoder-Decoder Architecture for Image Segmentation) and a pyramid pooling model (PSPNet, Pyramid Scene Parseing Network), etc. In actual implementation, the server inputs the sample original image into the semantic segmentation model, and performs semantic segmentation processing on the sample original image through the semantic segmentation model to obtain a predicted predicted semantic segmentation image. It should be noted that the semantic segmentation model first performs image encoding on the sample original image, and then predicts the semantic area corresponding to the plot based on the image encoding, and obtains the predicted semantic area corresponding to the plot and the predicted non-semantic area corresponding to the non-plot, and the predicted semantic area and the predicted non-semantic area together constitute the predicted semantic segmentation image.
[0082] Step 203: updating the model parameters of the semantic segmentation model based on the difference between the predicted semantic segmentation image and the sample semantic segmentation image.
[0083] In actual implementation, the server determines the difference between the predicted semantic segmentation image and the sample semantic segmentation image by calculating the value of the loss function corresponding to the semantic segmentation model. When the value of the loss function reaches a first threshold, the server determines the corresponding error signal based on the loss function, back-propagates the error signal in the semantic segmentation model, and updates the model parameters of each layer of the semantic segmentation model during the propagation process.
[0084] Here we explain the back propagation. The training sample is input into the input layer of the neural network model, passes through the hidden layer, and finally reaches the output layer and outputs the result. This is the forward propagation process of the neural network model. Since there is an error between the output result of the neural network model and the actual result, the error between the output result and the actual value is calculated, and the error is back-propagated from the output layer to the hidden layer until it propagates to the input layer. In the process of back propagation, the value of the model parameter is adjusted according to the error; the above process is continuously iterated until convergence. Taking the first loss function as an example, the server determines the first error signal based on the first loss function. The first error signal is back-propagated from the output layer of the neural network model, and the first error signal is back-propagated layer by layer. When the first error signal reaches each layer, the gradient (that is, the partial derivative of the Loss function with respect to the parameters of this layer) is solved in combination with the conducted first error signal, and the parameters of this layer are updated to the corresponding gradient value.
[0085] Step 102: perform edge detection on the land parcel in the image to be processed to obtain contour information of the land parcel.
[0086] In actual implementation, the server performs edge detection on the plots in the image to be processed to obtain contour information of the plots in the image to be processed. In an embodiment of the present application, the server may implement edge detection using the Sobel algorithm, the Laplacian algorithm, the Canny algorithm, and the like. In an embodiment of the present application, after the server performs edge detection on the plots in the image to be processed, it obtains a corresponding edge detection image. In actual implementation, the server uses edge detection to identify the edges of brightness changes in the image to be processed, thereby identifying the boundaries between different compactly distributed sub-blocks. For example, see Figure 4C , Figure 4C is an optional schematic diagram of an edge detection image provided in an embodiment of the present application, and the white area in the diagram is the outline of the plot. Figure 4C The plot outline 45 shown corresponds to Figure 4A As the plot 41 shown contains two sub-blocks planted with different crops, there is a big difference in image brightness between the two sub-blocks. In actual implementation, the server can identify the boundary where the brightness changes in the image through edge detection, thereby identifying the boundary between the two sub-blocks, and obtaining the accurate plot outline of the sub-blocks, so as to distinguish compactly distributed adjacent sub-blocks.
[0087] In an embodiment of the present application, the contour information may be an edge detection image containing the contour of the plot. In some embodiments, the contour information may also be the position of the plot contour in the image to be processed. In actual implementation, after obtaining the edge detection image, the server may extract the contour position of the plot contour from the edge detection image as the corresponding contour information. In some embodiments, the server may also directly detect the contour position of the plot contour corresponding to the plot from the image to be processed through edge detection to obtain the contour information of the plot.
[0088] In some embodiments, based on Figure 3 Step 102 can also be implemented in the following manner: the server performs edge detection on the land parcel in the image to be processed through an edge detection model to obtain a corresponding edge detection image; determines the contour position of the land parcel contour corresponding to the land parcel in the edge detection image, and uses the contour position as the contour information.
[0089] Here, the edge detection model can be implemented using a neural network model, such as holistically nested edge detection (HED) and U-shaped convolutional neural network (U-Net, U-Network). In actual implementation, the server performs edge detection on the plot of land in the image to be processed, and obtains an edge detection image containing the contour information of the plot of land. Here, the contour information can be the contour position of the plot of land in the image to be processed. Here, the contour position can be represented by the pixel coordinates of the pixel points covered by the plot contour.
[0090] In some embodiments, reference Figure 6 , Figure 6 is an optional flow chart of a method for extracting land parcels from an image provided in an embodiment of the present application, based on Figure 3 Before step 102, you may also execute:
[0091] Step 301: The server obtains an edge detection image sample, wherein the edge detection image sample carries a contour tag, and the contour tag is used to indicate contour information of a land parcel in the edge detection image sample.
[0092] It should be noted that steps 301 to 303 may be performed after step 101 and before step 102, or may be performed before step 101. Figure 6Shown is a flow chart when executed before step 101. In actual implementation, the server obtains a remote sensing image of the plot, and then pre-processes the remote sensing image, and obtains an edge detection image sample carrying a contour label by manually annotating the plot contour of the plot. Here, the manual annotation can also be made using the open source annotation software used when training the semantic segmentation model. In an embodiment of the present application, the contour label is the contour position of the plot edge of the plot in the edge detection image sample. In some embodiments, the contour position can be represented by the pixel coordinates of the pixel point corresponding to the edge area of the plot edge in the edge detection image sample.
[0093] Step 302: Perform edge detection on the edge detection image sample using the edge detection model to obtain predicted contour information of the land parcel in the edge detection image sample.
[0094] Step 303: Update the model parameters of the edge detection model based on the difference between the predicted contour information and the contour label.
[0095] In actual implementation, the server inputs the edge detection image sample into the edge detection model, and performs edge detection on the edge detection image sample through the edge detection model to obtain predicted contour information. Then, the server determines the difference between the predicted contour information and the contour label by calculating the value of the loss function corresponding to the edge detection model, and updates the model parameters of the edge detection model based on the difference.
[0096] In some embodiments, the server may also construct a target sample image pair, the target sample image pair including a sample original image containing a land parcel and a sample edge image corresponding to the sample original image. The server performs edge detection on the sample original image through the edge detection model to obtain a corresponding predicted edge image, and updates the model parameters of the edge detection model based on the difference between the predicted edge image and the sample edge image.
[0097] Step 103: based on the contour information of the land parcel, a semantic region corresponding to the land parcel is cut to obtain a semantic cut region corresponding to the land parcel.
[0098] In actual implementation, the server uses the contour information of the plot to cut the semantic area. Specifically, the server can use the contour information to create a corresponding image mask, and then based on the image mask, perform mask processing on the semantic segmentation image to cut the semantic area according to the contour information to obtain the corresponding semantic cutting area.
[0099] In some embodiments, based on Figure 3 , step 103 can also be implemented in the following manner:
[0100] Step 201: The server determines a contour area corresponding to the land parcel in the semantic segmentation image based on the contour information of the land parcel.
[0101] It should be noted that the contour area is an area composed of multiple pixel points corresponding to the contour information in the semantic segmentation image. Here, the contour information is the plot contour of the plot, which can be represented by pixel coordinates. In the embodiment of the present application, the semantic segmentation image has the same size as the image to be processed, and the size here includes the width and height of the image. The contour information of the plot obtained by the server through edge detection of the image to be processed is the position of the plot contour of the plot in the image to be processed. In actual implementation, the server determines that the image area corresponding to the contour information in the semantic segmentation image is the contour area based on the contour information. For example, see Figure 4B and Figure 4C ,in, Figure 4B The white area shown is the contour area of the image to be processed. In the embodiment of the present application, the size of the image to be processed, the semantic segmentation image and the contour detection image are the same. The server will Figure 4B The edge detection image shows the contour area, determining Figure 4C The image region at the same region position in the semantic segmentation image shown is the contour region of the semantic segmentation image.
[0102] Step 202: remove the contour area from the semantic area to cut the semantic area corresponding to the land parcel, and obtain the semantic cutting area corresponding to the land parcel.
[0103] In actual implementation, after determining the contour area in the semantic segmentation image, the server determines the target area covered by the contour area in the semantic area, removes the target area from the semantic area, thereby performing a segmentation process on the semantic area corresponding to the plot and obtaining a corresponding semantic segmentation area. Figure 4D , Figure 4D is an optional schematic diagram of a semantically segmented image after cutting provided in an embodiment of the present application. Figure 4C After the semantic segmentation image shown is cut, the resulting semantic segmentation image is as follows Figure 4D As shown, the white area in the image is the semantic segmentation area of the embodiment of the present application. Figure 4D The semantic cut region 46 shown corresponds to Figure 4A The plot 41 shown includes two adjacent sub-blocks. Here, the semantic cut region 46 is obtained by cutting the semantic region 44 based on the plot outline 45. The semantic region 44 is cut into two sub-blocks by the plot outline 45, so as to accurately identify adjacent sub-blocks with compact distribution.
[0104] In some embodiments, the semantic segmentation image is a binary image, the pixel value corresponding to the semantic area in the semantic segmentation image is a first pixel value, and the pixel value corresponding to the non-semantic area in the semantic segmentation image is a second pixel value. Step 202 can also be implemented in the following manner: the server assigns the pixel value corresponding to the contour area to the second pixel value; determines a target pixel point in the semantic area whose pixel value is the second pixel value; removes the target pixel point from the semantic area to achieve cutting processing of the semantic area corresponding to the plot.
[0105] In actual implementation, the server obtains a binary semantic segmentation image after semantically segmenting the image to be processed. Specifically, the server performs semantic segmentation on the image to be processed in RGB format to obtain a semantic segmentation image containing three RGB channels, wherein the semantic segmentation image includes the semantic area corresponding to the plot and the non-semantic area corresponding to the non-plot. Then, the server binarizes the RGB semantic segmentation image to obtain a binary semantic segmentation image. Here, the server assigns the pixel value of the semantic area to the first pixel value and the non-semantic area to the second pixel value. Then, the server determines the target pixel point in the semantic area whose pixel value is the second pixel value, removes the target pixel point from the semantic area, and obtains the semantic cutting area. It should be understood that the pixel values of the pixels in the semantic cutting area are all the first pixel values, that is, the area formed by all the pixels of the first pixel value in the semantic segmentation image is the semantic cutting area. For example Figure 4D The white area shown is the semantic cut area.
[0106] In some embodiments, the server can also generate a corresponding semantic cutting image based on the semantic segmentation image and the edge detection image. Specifically, the server creates an initial image and assigns the pixel values of all pixels in the initial image to the second pixel value. For example, if the color corresponding to the second pixel value is black, the initial image is a completely black image. Then, based on the edge detection image, the server determines the contour area with the pixel value of the first pixel value in the edge detection image, and determines the semantic area with the pixel value of the first pixel value in the semantic segmentation image. Then, the server maps the semantic area and the contour area to the same image space, determines the overlapping area between the semantic area and the contour area, removes the overlapping area from the semantic area, obtains the semantic cutting area, assigns the pixel points corresponding to the semantic cutting area in the initial image to the first pixel value, and obtains the corresponding semantic cutting image.
[0107] Step 104: determine the region position of the semantic cut region in the semantic segmentation image.
[0108] In actual implementation, the server determines the pixel point set of the semantic cutting area in the semantic segmentation image, obtains the position of each pixel in the pixel point set in the semantic segmentation image, and uses the pixel coordinate set corresponding to the pixel point set as the area position of the semantic cutting area.
[0109] In some embodiments, the size of the semantic segmentation image is the same as the size of the image to be processed. Figure 3 , it can also be executed: the server establishes a first pixel coordinate system in the image to be processed, and establishes a second pixel coordinate system in the semantic segmentation image, and there is a coordinate mapping relationship between the first pixel coordinate system and the second pixel coordinate system; wherein the first pixel coordinate system and the second pixel coordinate system are used to realize image extraction corresponding to the regional position of the image to be processed.
[0110] For example, see Fig. 7A and Figure 7B , Fig. 7A is an optional schematic diagram of a first pixel coordinate system provided in an embodiment of the present application, Figure 7B It is an optional schematic diagram of the second pixel coordinate system provided in an embodiment of the present application. Here, the coordinate origin O of the first pixel coordinate system is the lower left corner vertex of the image to be processed, the x-axis is parallel to the width of the image to be processed, and the y-axis is parallel to the height of the image to be processed. The coordinate origin O' of the second pixel coordinate system is the lower left corner vertex of the image to be processed, the x' axis is parallel to the width of the image to be processed, and the y' axis is parallel to the height of the image to be processed. Here, the first pixel coordinate system is aligned with the second pixel coordinate system, that is to say, the coordinate mapping relationship between the first pixel coordinate system and the second pixel coordinate system is a one-to-one correspondence. In some embodiments, the first pixel coordinate system and the second pixel coordinate system can also be established for different coordinate mapping relationships.
[0111] Step 105 , extracting an image corresponding to the regional position from the image to be processed to obtain a plot image corresponding to the plot.
[0112] In some embodiments, step 104 can also be implemented in the following manner: the server determines the pixel coordinates of the semantic cut region in the second pixel coordinate system, and uses the pixel coordinates as the regional position of the semantic cut region in the semantic segmentation image. Correspondingly, step 105 can also be implemented in the following manner: the server determines the target pixel coordinates of the pixel coordinates mapped from the second pixel coordinate system to the first pixel coordinate system based on the coordinate mapping relationship; and extracts the image corresponding to the target pixel coordinates from the image to be processed, so as to extract the image corresponding to the regional position from the image to be processed.
[0113] In actual implementation, the server obtains the pixel coordinates of the semantic cutting area in the second pixel coordinate system. For example, if the pixel coordinates of a certain pixel point in the semantic cutting area are determined to be (x0, y0), then based on the coordinate mapping relationship, it is mapped to the first pixel coordinate system to obtain the target pixel coordinates (x0', y0'). It should be understood that if the coordinate mapping relationship is a one-to-one correspondence, then x0'=x0, y0'=y0. The server obtains the pixel coordinates of all pixels in the semantic cutting area and maps them to the first pixel coordinate system in turn to obtain the target pixel coordinate set of the semantic cutting area corresponding to the first pixel coordinate system. Based on the target pixel coordinate set, the server extracts the target pixel point set corresponding to the target pixel coordinate set from the image to be processed. The image formed by the extracted target pixel point set is the plot image. At this point, the extraction of the plot image is completed.
[0114] In an embodiment of the present application, by performing semantic segmentation and edge detection on the image to be processed containing the plots, the semantic area and contour information corresponding to the plots are obtained, and the semantic area is further cut based on the contour information to obtain the semantic cut area after cutting, and based on the regional position of the semantic cut area in the semantic segmentation image, the image of the corresponding regional position is extracted from the image to be processed to obtain the plot image of the plot, thereby effectively distinguishing the boundaries between different plots and improving the accuracy of plot extraction.
[0115] In some embodiments, the semantic segmentation region includes a plurality of segmented regions, and the land parcel image includes a segmented image corresponding to each of the segmented regions. Figure 3 , it may also be performed: the server performs the following processing on each of the block images respectively: cutting the block image to obtain a plurality of sub-block images; extracting features of each of the sub-block images respectively to obtain corresponding image features; classifying the sub-block images based on the image features to obtain classification results of each of the sub-block images, wherein the classification results are used to indicate the land parcel category of the corresponding sub-block image; and determining the land parcel category corresponding to the block image based on the classification results of each of the sub-block images.
[0116] See also Figure 8 , Figure 8It is an optional schematic diagram of classification processing based on a classification model provided in an embodiment of the present application. In actual implementation, the server randomly obtains N sampling points in the block image, takes the fixed size size as the preset size, takes each sampling point as the center, offsets size / 2 to the top and size / 2 to the bottom right, as the sampling window, and cuts out a picture of size in the plot-level remote sensing image as a sub-block image. For example, a 25*25 sampling window can be selected for image cutting, and an image of size size is cut for each sampling point in turn with a sampling window of size size, to obtain N sub-block images corresponding to a corresponding block image. It should be noted that the fixed size size needs to be set in advance, determined based on a large amount of experimental data and prior knowledge, and is generally required to cover a small amount of the plot outline so that the sampling window can wrap the entire plot as much as possible.
[0117] In some embodiments, a crop classification model is used to perform feature extraction processing on sub-block images to obtain image features corresponding to each sub-block image; based on the image features, category prediction is performed on the sub-block images, and the image features are mapped to probabilities corresponding to multiple candidate crop categories. The farmland plant category corresponding to the probability that exceeds the probability threshold and has the largest probability value is used as the classification result of the sub-block image, and the crop classification model is used in turn to perform category prediction on N sub-block images to obtain N classification results.
[0118] It should be noted that the classification result is generally the class with the highest probability, and the sum of the probabilities is generally 100%. For example, if the categories of the candidate crops are "corn", "rice" and "others", for a plot of land, the crop classification model is used to perform feature extraction and classification prediction on the N sub-block images corresponding to the current plot, and the probability of predicting the category as "corn" is 20%, the probability of predicting the category as "rice" is 70%, and the probability of predicting the category as "others" is 10%. Since the probability of predicting the category as "rice" is the highest, it can be determined that the plot category in the current sub-block image is "rice".
[0119] In some embodiments, the server counts the number of plots belonging to the same category among the N classification results, determines the plot category with the largest number as the classification result of the plots corresponding to the N sub-block images, and assigns the classification result to the current block image.
[0120] For example, for a segmented image, if 50 sub-block images are cut, the crop classification model is used to perform feature extraction and classification processing on the segmented images respectively, and 40 classification results predicted as "rice", 9 classification results predicted as "corn", and 1 classification result predicted as "cotton" are obtained. Through majority voting, the classification result of the current segmented image is determined to be "rice".
[0121] In an embodiment of the present application, multi-point sampling is performed on the block image at the plot level, and the image of the plot is cut into a preset size to obtain multiple valid sub-block images corresponding to the block image, thereby effectively improving the accuracy of the block image. Category prediction is performed on the multiple sub-block images according to a pre-trained classification model to obtain multiple corresponding classification results, and the category of the plot covered by the block image is determined based on majority voting, taking into account the effects of multiple predictions of the classification model, to determine the optimal recognition result, reduce the probability of recognition errors, and improve the accuracy of plot recognition, thereby improving the accuracy of plot classification and the application value of plot recognition.
[0122] The following will describe an exemplary application of the present invention in a practical application scenario. Fig. 9 , Fig. 9 This is an optional flow chart of the training process of the classification model provided in the embodiment of the present application. Fig. 9 The steps shown are explained.
[0123] Step 901: The server obtains a training image.
[0124] In actual implementation, the server obtains remote sensing images of farmland plots and preprocesses the remote sensing images to obtain training images. Specifically, firstly, ground imaging data is obtained through high-resolution remote sensing satellites, drones, aircraft, etc. to obtain remote sensing images. After obtaining the remote sensing images, the server filters out image distortion through radiation correction, geometric correction, atmospheric correction, etc., and converts them into RGB images. The remote sensing images are cropped to a suitable size through image cropping to obtain the corresponding training images.
[0125] Step 902, obtaining farmland plot labels.
[0126] Here, the farmland plot annotations can be obtained through manual annotation. Specifically, the server calls tools such as labelme, and the annotators use the tools to mark each farmland area in the training image to obtain the farmland plot annotations for subsequent model training. Here, the farmland plot annotations are the contour lines corresponding to the plot outlines of the farmland plots. It should be noted that after obtaining the farmland plot annotations, the server also erodes the surface formed by the labels of each farmland plot in the training image to separate the boundaries of overlapping annotations for subsequent plot segmentation to avoid connecting different plots together.
[0127] Step 903: Convert the farmland plot annotations into edge binary images.
[0128] Step 904: Convert the farmland plot annotations into semantically segmented binary images.
[0129] Step 905: training an edge detection model.
[0130] Step 906: training a semantic segmentation model.
[0131] In actual implementation, the server converts the farmland plot annotations into edge binary images and semantic segmentation binary images, and constructs edge training image pairs of edge detection models based on training images and edge binary images to train edge detection models. Based on training images and semantic segmentation binary images, semantic training image pairs of semantic segmentation models are constructed to train semantic segmentation models. Here, the edge detection model is recorded as EdgeModel, and the semantic segmentation model is recorded as SegModel.
[0132] Next, the server uses the trained edge detection model and semantic segmentation model to extract farmland plots. Fig.10 and Figures 4A-4D , Fig.10 This is an optional flow chart of the method for extracting land parcels from an image provided by an embodiment of the present application. Fig.10 The steps shown are explained.
[0133] Step 1001: The server obtains an image to be processed.
[0134] In actual implementation, the server obtains the remote sensing image to be processed, and preprocesses the remote sensing image to be processed to obtain the corresponding image to be processed. Here, the preprocessing process of the remote sensing image to be processed refers to the preprocessing process of the training image above, which will not be repeated here.
[0135] Step 1002: Perform edge detection on the image to be processed by using an edge detection model to obtain an edge detected image.
[0136] Step 1003: semantically segment the image to be processed using a semantic segmentation model to obtain a semantically segmented image.
[0137] Next, the server inputs the image to be processed into the edge detection model and the semantic segmentation model respectively, performs edge detection on the image to be processed by the edge detection model to obtain the edge detection image ResultA, and performs semantic segmentation on the image to be processed by the semantic segmentation model to obtain the semantic segmentation image ResultB. Here, step 1002 and step 1003 can be executed in parallel or in series. When executed in series, the execution order of step 1002 and step 1003 can be in any order, and the embodiment of the present application does not specifically limit the execution order of the two. It should be noted that in the embodiment of the present application, the edge detection image output by the edge detection model and the semantic segmentation image output by the semantic segmentation model are both binary images, and the sizes of the edge detection image and the semantic segmentation image are the same as the size of the image to be processed. Here, the pixel value of the farmland semantic area corresponding to the farmland plot in the semantic segmentation image is the first pixel value, the pixel value of the non-farmland semantic area is the second pixel value, the pixel value of the contour area corresponding to the contour of the farmland plot in the edge detection image is the first pixel value, and the pixel value of the non-contour area is the second pixel value. Exemplarily, the first pixel value can be 1 and the second pixel value can be 0.
[0138] Step 1004: perform fusion processing on the edge detection image and the semantic segmentation image to obtain a semantic segmentation image.
[0139] In actual implementation, the server constructs an initial image of the same size as the image to be processed. Here, the initial image is a binary image, in which the pixel values of the pixels are all second pixel values. Then, based on the semantic segmentation image and the edge detection image, the server determines the target area whose pixel value in the semantic segmentation image is the first pixel value and whose pixel value in the edge detection image is the second pixel value, assigns the pixel value of the pixel point corresponding to the target area in the initial image to the first pixel value, and generates the corresponding semantic segmentation image. Among them, the semantic segmentation image includes a semantic segmentation area composed of the first pixel value and a non-semantic segmentation area composed of the second pixel value.
[0140] Step 1005 , extracting a farmland plot image from the image to be processed based on the semantic segmentation image.
[0141] In actual implementation, the server extracts a regional image corresponding to the semantic cutting area in the semantic cutting image with a first pixel value from the image to be processed, and the extracted regional image is the farmland plot image corresponding to the farmland plot in the image to be processed.
[0142] In an embodiment of the present application, farmland plots are extracted from the processed image by combining semantic segmentation and edge detection. On the basis of the semantic segmentation image containing the farmland semantic area corresponding to the farmland plot obtained by semantic segmentation, the farmland semantic area is further cut based on the contour information of the farmland plot obtained by edge detection. This avoids the situation where the contour of the farmland plot is included in the semantic area of the farmland plot due to the fact that the contour of the farmland plot is too narrow during semantic segmentation, thereby improving the accuracy of the extracted farmland plot.
[0143] The following is a description of an exemplary structure of the device 555 for extracting land blocks from an image provided by the present application as a software module. In some embodiments, for example, Figure 2 As shown, the software modules stored in the device 555 for extracting land parcels from an image in the memory 540 may include:
[0144] The semantic segmentation module 5551 is used to perform semantic segmentation processing on the image to be processed containing the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel;
[0145] The edge detection module 5552 is used to perform edge detection on the land block in the image to be processed to obtain the contour information of the land block;
[0146] The semantic cutting module 5553 is used to cut the semantic area corresponding to the land parcel based on the contour information of the land parcel to obtain the semantic cutting area corresponding to the land parcel;
[0147] A determination module 5554 is used to determine the region position of the semantic cutting region in the semantic segmentation image;
[0148] The image extraction module 5555 is used to extract the image corresponding to the regional position of the image to be processed to obtain a plot image corresponding to the plot.
[0149] In some embodiments, the edge detection module 5552 is further used to perform edge detection on the plots in the image to be processed through an edge detection model to obtain a corresponding edge detection image; determine the contour position of the plot contour corresponding to the plot in the edge detection image, and use the contour position as the contour information.
[0150] In some embodiments, the device for detecting land parcels in images further includes: an edge detection model training module, used to obtain edge detection image samples, the edge detection image samples carry contour labels, and the contour labels are used to indicate contour information of land parcels in the edge detection image samples; performing edge detection on the edge detection image samples through the edge detection model to obtain predicted contour information of the land parcels in the edge detection image samples; and updating model parameters of the edge detection model based on the difference between the predicted contour information and the contour label.
[0151] In some embodiments, the semantic cutting module 5553 is also used to determine the contour area corresponding to the plot in the semantic segmentation image based on the contour information of the plot; and remove the contour area from the semantic area to achieve cutting processing of the semantic area corresponding to the plot.
[0152] In some embodiments, the semantic segmentation image is a binary image, the pixel value corresponding to the semantic area in the semantic segmentation image is a first pixel value, and the pixel value corresponding to the non-semantic area in the semantic segmentation image is a second pixel value; the semantic cutting module 5553 is also used to assign the pixel value corresponding to the contour area to the second pixel value; determine the target pixel point in the semantic area whose pixel value is the second pixel value; remove the target pixel point from the semantic area to achieve cutting processing of the semantic area corresponding to the plot.
[0153] In some embodiments, the size of the semantic segmentation image is the same as the size of the image to be processed, and the device for the land block in the image also includes: a coordinate system establishment module, used to establish a first pixel coordinate system in the image to be processed, and to establish a second pixel coordinate system in the semantic segmentation image, and there is a coordinate mapping relationship between the first pixel coordinate system and the second pixel coordinate system; wherein, the first pixel coordinate system and the second pixel coordinate system are used to realize image extraction corresponding to the area position of the image to be processed.
[0154] In some embodiments, the determination module 5554 is also used to determine the pixel coordinates of the semantic cutting area in the second pixel coordinate system, and use the pixel coordinates as the regional position of the semantic cutting area in the semantic segmentation image; the image extraction corresponding to the regional position of the image to be processed includes: based on the coordinate mapping relationship, determining the target pixel coordinates of mapping the pixel coordinates from the second pixel coordinate system to the first pixel coordinate system; performing image extraction corresponding to the target pixel coordinates on the image to be processed, so as to realize image extraction corresponding to the regional position of the image to be processed.
[0155] In some embodiments, the semantic segmentation processing is implemented through a semantic segmentation model, and the device for the land block in the image also includes: a semantic segmentation model training module, which is used to construct a sample image pair, and the sample image pair includes a sample original image containing the land block, and a sample semantic segmentation image corresponding to the sample original image; through the semantic segmentation model, the sample original image is semantically segmented to obtain a corresponding predicted semantic segmentation image; based on the difference between the predicted semantic segmentation image and the sample semantic segmentation image, the model parameters of the semantic segmentation model are updated.
[0156] In some embodiments, the semantic cutting area includes multiple block areas, the plot image includes block images corresponding to each of the block areas, and the device for plotting land in the image also includes: a classification module, which is used to perform the following processing on each of the block images: cutting the block image to obtain multiple sub-block images; extracting features for each of the sub-block images to obtain corresponding image features; classifying the sub-block images based on the image features to obtain classification results for each of the sub-block images, and the classification results are used to indicate the plot category of the corresponding sub-block image; based on the classification results of each of the sub-block images, determining the plot category corresponding to the block image.
[0157] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above-mentioned method embodiment, and has similar beneficial effects as the method embodiment, so it will not be repeated.
[0158] An embodiment of the present application provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the method for extracting land blocks in an image provided by the embodiment of the present application is implemented.
[0159] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will be caused to execute the method provided by the present application embodiment, for example, Figure 3 A method for extracting plots in an image is shown.
[0160] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0161] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0162] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0163] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0164] In summary, through the embodiments of the present application, more accurate land plot images can be extracted.
[0165] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A method for extracting land blocks in an image, characterized in that: include: Performing semantic segmentation processing on the image to be processed including the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel, the semantic segmentation image is a binary image, a pixel value corresponding to the semantic area in the semantic segmentation image is a first pixel value, and a pixel value corresponding to a non-semantic area in the semantic segmentation image is a second pixel value; Performing edge detection on the land parcel in the image to be processed, identifying the boundary where the brightness in the image to be processed changes through the edge detection, and obtaining the contour information of the land parcel; Based on the contour information of the plot, a semantic region corresponding to the plot is cut to obtain a semantic cut region corresponding to the plot, wherein the semantic cut region includes a plurality of block regions; Determine the region position of the semantic cutting region in the semantic segmentation image; Extracting an image corresponding to the regional position from the image to be processed to obtain a land plot image corresponding to the land plot, wherein the land plot image includes a block image corresponding to each of the block areas; The segmentation process of the semantic area corresponding to the land parcel based on the contour information of the land parcel includes: Based on the contour information of the land parcel, determining a contour area corresponding to the land parcel in the semantic segmentation image; Assigning the pixel value corresponding to the contour area to the second pixel value; Determine a target pixel point in the semantic area whose pixel value is the second pixel value; The target pixel point is removed from the semantic area to achieve cutting processing of the semantic area corresponding to the plot; Wherein, the method further comprises: The following processing is performed for each of the block images: Cutting the divided image to obtain a plurality of sub-block images; Extracting features from each of the sub-block images to obtain corresponding image features; Classifying the sub-block images based on the image features to obtain classification results for each of the sub-block images, wherein the classification results are used to indicate the land parcel category of the corresponding sub-block image; Based on the classification results of each of the sub-block images, the land block category corresponding to the block image is determined.
2. The method according to claim 1, characterized in that The performing edge detection on the land parcel in the image to be processed to obtain contour information of the land parcel includes: Performing edge detection on the land parcels in the image to be processed by using an edge detection model to obtain a corresponding edge detection image; The contour position of the plot contour corresponding to the plot in the edge detection image is determined, and the contour position is used as the contour information.
3. The method according to claim 2, characterized in that Before performing edge detection on the land blocks in the image to be processed, the method further includes: Acquire an edge detection image sample, wherein the edge detection image sample carries a contour tag, and the contour tag is used to indicate contour information of a plot in the edge detection image sample; Performing edge detection on the edge detection image sample by using the edge detection model to obtain predicted contour information of the land parcel in the edge detection image sample; Based on the difference between the predicted contour information and the contour label, the model parameters of the edge detection model are updated.
4. The method according to claim 1, characterized in that: The size of the semantic segmentation image is the same as the size of the image to be processed, and the method further includes: Establishing a first pixel coordinate system in the image to be processed, and establishing a second pixel coordinate system in the semantic segmentation image, wherein a coordinate mapping relationship exists between the first pixel coordinate system and the second pixel coordinate system; The first pixel coordinate system and the second pixel coordinate system are used to realize image extraction corresponding to the area position of the image to be processed.
5. The method according to claim 4, characterized in that The determining the region position of the semantic cutting region in the semantic segmentation image includes: Determine pixel coordinates of the semantic cutting region in the second pixel coordinate system, and use the pixel coordinates as the region position of the semantic cutting region in the semantic segmentation image; The step of extracting the image corresponding to the regional position from the image to be processed includes: Based on the coordinate mapping relationship, determining target pixel coordinates of the pixel coordinates mapped from the second pixel coordinate system to the first pixel coordinate system; The image to be processed is subjected to image extraction corresponding to the target pixel coordinates, so as to realize image extraction corresponding to the regional position of the image to be processed.
6. The method according to claim 1, characterized in that The semantic segmentation process is implemented by a semantic segmentation model. Before the semantic segmentation process is performed on the image to be processed containing the land parcel, the method further includes: Constructing a sample image pair, wherein the sample image pair includes a sample original image containing a land parcel, and a sample semantic segmentation image corresponding to the sample original image; Using the semantic segmentation model, the sample original image is processed by semantic segmentation to obtain a corresponding predicted semantic segmentation image; Based on the difference between the predicted semantic segmentation image and the sample semantic segmentation image, model parameters of the semantic segmentation model are updated.
7. A device for extracting land blocks in an image, characterized in that: include: A semantic segmentation module is used to perform semantic segmentation processing on the image to be processed containing the land parcel to obtain a corresponding semantic segmentation image, wherein the semantic segmentation image includes a semantic area corresponding to the land parcel, the semantic segmentation image is a binary image, and the pixel value corresponding to the semantic area in the semantic segmentation image is a first pixel value, and the pixel value corresponding to the non-semantic area in the semantic segmentation image is a second pixel value; An edge detection module is used to perform edge detection on the land parcel in the image to be processed, identify the boundary where the brightness in the image to be processed changes through the edge detection, and obtain the contour information of the land parcel; A semantic cutting module, used for cutting the semantic area corresponding to the plot based on the contour information of the plot to obtain the semantic cutting area corresponding to the plot, wherein the semantic cutting area includes a plurality of block areas; Determine the region position of the semantic cutting region in the semantic segmentation image; Extracting an image corresponding to the regional position from the image to be processed to obtain a land plot image corresponding to the land plot, wherein the land plot image includes a block image corresponding to each of the block areas; The segmentation process of the semantic area corresponding to the land parcel based on the contour information of the land parcel includes: Based on the contour information of the land parcel, determining a contour area corresponding to the land parcel in the semantic segmentation image; Assigning the pixel value corresponding to the contour area to the second pixel value; Determine a target pixel point in the semantic area whose pixel value is the second pixel value; The target pixel point is removed from the semantic area to achieve cutting processing of the semantic area corresponding to the plot; The classification module is used to perform the following processing on each of the block images: Cutting the divided image to obtain a plurality of sub-block images; Extracting features from each of the sub-block images to obtain corresponding image features; Classifying the sub-block images based on the image features to obtain classification results for each of the sub-block images, wherein the classification results are used to indicate the land parcel category of the corresponding sub-block image; Based on the classification results of each of the sub-block images, the land block category corresponding to the block image is determined.
8. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, configured to implement the method for extracting land blocks in an image as described in any one of claims 1 to 6 when executing the executable instructions stored in the memory.
9. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to implement the method for extracting land blocks in an image as described in any one of claims 1 to 6 when executed by a processor.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for extracting land blocks in an image as described in any one of claims 1 to 6 is implemented.
