A method for constructing a dataset based on aerial full-factor geographic images

By loading the affine information of the shp annotation file and the full-feature map, generating intersection information and RGB data, the problem of aerial farmland geographic images being difficult to convert into deep learning datasets is solved, efficient data conversion without manual annotation is achieved, and data support for farmland identification and segmentation is provided.

CN115731479BActive Publication Date: 2025-09-09YANGTZE DELTA REGION INST OF UNIV OF ELECTRONICS SCI & TECH OF CHINE (HUZHOU)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211504634.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2025-09-09
Estimated Expiration
2042-11-29

AI Technical Summary

Technical Problem

Existing aerial farmland geographic images and annotation files are difficult to directly convert into deep learning training datasets. The lack of effective data conversion methods leads to high manual annotation costs and low data utilization efficiency.

Method used

By loading the shp annotation file, the shape and attribute information of the geographic features are obtained, the boundary filling distance is calculated, the intersection information is generated, the affine information of the full-feature map is read, the longitude and latitude are converted into raster coordinates, the RGB data of the specified range is read, and images in jpg and png formats are generated, and finally organized into a data set.

Benefits of technology

Without any additional manual labeling costs, aerial full-factor geographic images are converted into deep learning training datasets, fully tapping the data value in professional fields and providing a data foundation for farmland identification and segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115731479B_ABST
    Figure CN115731479B_ABST
Patent Text Reader

Abstract

The present invention provides a method for constructing a dataset based on aerial full-element geographic images, comprising the following steps: loading a shp annotation file, obtaining the shape information shape and attribute information record of each geographic element, and obtaining a geographic element list. Traversing the geographic element list, processing each geographic element and generating an image. Arranging the images in jpg format and the segmentation mask images in png format into two folders, and synchronously compressing the jpg images and png images of each geographic element, thus obtaining a dataset containing color images and grayscale annotations. The present invention proposes a method for constructing a dataset based on aerial full-element geographic images, which converts the business data of a professional field into a dataset that can be used for deep learning training without the cost of additional manual annotation, fully tapping the value of the business data in the professional field, and providing a data basis for the subsequent application of other deep learning models in this field, such as farmland identification and segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision and image processing technology, and in particular to a method for constructing a data set based on aerial full-element geographic images. Background Art

[0002] The raw data for aerial farmland geography consists of a full-feature town map file and a annotation file based on this map. The full-feature town map is a 4-channel tiff format file that contains both latitude and longitude information in addition to the usual RGB information. The annotation file is a shp format file that uses polygonal boxes to indicate the location and range of various geographic features on the map, along with their category information. Currently, these images and annotations are used to view the geographic images and corresponding geographic features through client browsers. Therefore, a method for converting full-feature maps into deep learning training datasets is urgently needed. Summary of the Invention

[0003] In response to the shortcomings of the existing technology, the present invention provides a method for constructing a dataset based on aerial full-factor geographic images, which converts the business data in a professional field into a dataset that can be used for deep learning training without the cost of additional manual labeling. It fully taps the value of the business data in this professional field and provides a data foundation for the subsequent application of other deep learning models in this field, such as farmland identification and segmentation.

[0004] The above technical objectives of the present invention are achieved through the following technical solutions:

[0005] A method for constructing a dataset based on aerial full-factor geographic images, comprising the following steps:

[0006] Step 1: load the shp annotation file, obtain the shape information and attribute information record of each geographic feature, and obtain a geographic feature list;

[0007] Step 2: traverse the geographic element list and record the current geographic element as main;

[0008] Step 3: Read the bbox of main, subtract the right and left boundaries to get the width of the bbox, and subtract the upper and lower boundaries to get the height of the bbox;

[0009] Step 4, calculate the border padding distance, use 10% of the width as the horizontal padding distance width_padding, use 10% of the height as the vertical padding distance height_padding, and fill the border in four directions according to width_padding and height_padding to get the new boundary bbox*;

[0010] Step 5, save the polygon of main in the list lines, and save the class class in the list classes;

[0011] Step 6: traverse the geographic element list, record the current geographic element as sub, and perform the following judgment and processing:

[0012] (1) Whether sub is main, if so, skip and process the next geographic element;

[0013] (2) Does the polygon shape of sub intersect with the boundary of main? If not, skip it. If so, calculate the intersection of the polygon of sub and the boundary of main, add the intersection to lines, and add the class of sub to classes.

[0014] Step 7: Read the affine information geo_transform of the full-factor map header file, and convert the latitude and longitude value boundary bbox* into the grid coordinate boundary boundary according to the affine information;

[0015] Step 8: Read the 4-channel tiff data of the corresponding range from the full-feature map according to the grid coordinate boundary, take the RGB values ​​of the first three channels and save them as a 3-channel jpg format color geographic feature image;

[0016] Step 9: Write geo_transform, boundary, lines, and classes into json and save it as a file. Generate a segmentation mask array matrix based on the json file and save it as a single-channel grayscale image in png format.

[0017] Step 10, repeat steps 2-8 until all geographic elements are traversed;

[0018] Step 11: Organize all the jpg images of geographic features and the png images of segmentation masks into two folders, and perform the same compression operation on the jpg images and png images corresponding to each geographic feature to ensure that the resolution of the jpg images and png images are consistent;

[0019] In step 12, we finally obtain a dataset containing color images and grayscale annotations.

[0020] The present invention is further configured as follows: in step 1, shape includes the four boundary values ​​bbox of the circumscribed rectangle of each element and the point coordinate sequence polygon of the polygonal box of the area actually occupied by the element, wherein the boundaries and coordinates are both longitude and latitude values; record includes the serial number id and category information class of each geo pixel.

[0021] The present invention is further configured as follows: in step 7, when reading the affine information geo_transform of the header file of the full-factor map, only the header file is read, and all images are not loaded.

[0022] The present invention is further configured as follows: in step 8, when reading the 4-channel tiff data of the corresponding range from the full-factor map according to the grid coordinate boundary, only partial reading is performed without loading the entire image.

[0023] The present invention is further configured as follows: in step 11, the compression rule is: while maintaining the aspect ratio of the image, compress the longer side of the width and height to 1920 pixels.

[0024] The present invention has the following beneficial effects: The present invention proposes a method for constructing a dataset based on aerial full-factor geographic images, which converts the business data in a professional field into a dataset that can be used for deep learning training without additional manual labeling costs, fully tapping the value of the business data in the professional field, and providing a data foundation for the subsequent application of other deep learning models in this field, such as farmland identification and segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a schematic diagram of the shp file structure;

[0026] Figure 2 is the algorithm flow chart;

[0027] Figure 3 It is a full-factor map (partial);

[0028] Figure 4 Label the shp diagram (partial);

[0029] Figure 5 This is a jpg image of the cropped farmland.

[0030] Figure 6 This is the cropped farmland block PNG segmentation mask image. DETAILED DESCRIPTION

[0031] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.

[0032] A method for constructing a dataset based on aerial full-factor geographic images, comprising the following steps:

[0033] Step 1: Load the shp annotation file (see the attached page for the shp structure) and obtain the shape information and attribute information (record) for each geographic feature, resulting in a list of geographic features. The shape contains the four bounding boxes (bboxes) of each feature's bounding rectangle, stored in order from bottom left to top right, and the point coordinate sequence (polygon) representing the polygonal area of ​​the feature's actual area (both bounding boxes and coordinates are in latitude and longitude). The record contains the ID and class information for each feature. Full-feature maps are often too large, typically tens or hundreds of GB, to load directly.

[0034] Step 2: traverse the geographic element list and record the current geographic element as main.

[0035] Step 3: Read the bbox of main, subtract the right and left boundaries to get the width of the bbox, and subtract the upper and lower boundaries to get the height of the bbox.

[0036] Step 4: Calculate the border padding distance, using 10% of the width as the horizontal padding distance width_padding and 10% of the height as the vertical padding distance height_padding. Pad the border in all four directions based on width_padding and height_padding to obtain the new border bbox*.

[0037] Step 5: Save the main polygon in the list lines and the class class in the list classes.

[0038] Step 6: traverse the geographic element list, record the current geographic element as sub, and perform the following judgment and processing:

[0039] (1) Whether sub is main, if so, skip and process the next geographic element;

[0040] (2) Does the polygon shape of sub intersect with the boundary of main? If not, skip it; if so, calculate the intersection of the polygon of sub and the boundary of main, add the intersection part to lines, and add the class of sub to classes.

[0041] Step 7: Read the affine information geo_transform of the header file of the full-factor map (only read the header file, do not load all the images), and convert the latitude and longitude value boundary bbox* into the grid coordinate boundary boundary according to the affine information.

[0042] Step 8: Read the 4-channel tiff data of the corresponding range from the full-feature map according to the grid coordinate boundary (local reading, not loading the entire image), take the RGB values ​​of the first three channels and save them as a 3-channel jpg format color geographic feature image.

[0043] Step 9: Write geo_transform, boundary, lines, and classes to a JSON file and save it as a file. Generate a segmentation mask array matrix based on the JSON file and save it as a single-channel grayscale image in PNG format.

[0044] Step 10, repeat 2-8 until all geographic features are traversed.

[0045] In step 11, organize all the geographic feature images in jpg format and the segmentation mask images in png format into two folders, and perform the same compression operation on the jpg images and png images corresponding to each geographic feature to ensure that the resolution of the jpg images and png images are consistent. The compression rule is: while maintaining the aspect ratio of the image, compress the longer side of the width and height to 1920 pixels.

[0046] In step 12, we finally get a dataset containing color images and grayscale annotations.

[0047] like Figure 1 As shown in the figure, it is a structural diagram of the shp file. The shp file constructed based on the aerial full-factor map contains information of multiple geographic elements. The information of each geographic element includes shape information and attribute information record. Shape includes bbox and polygon. Record attributes can be customized to add or delete. In the scenario of the present invention, the record attributes include serial number id, category described by string and class identified by number.

[0048] like Figure 2 The following is a flowchart of the algorithm. The main idea is to slice the shp shape of each geographic feature and add information about its edges and intersections with other features. Then, based on the shp shape, a specified range is read from the full feature map (the full feature map is too large to read in its entirety, so only a partial read is required). Finally, the local feature map is saved as an image and annotations are generated using the shp shape.

[0049] like Figure 3 As shown in the figure, it is a schematic diagram of the full-factor map (partial); Figure 4 Shown is the shp marked diagram (partial).

[0050] Figure 5 Taking farmland as an example, this is a cropped jpg image of the farmland. Figure 6This is the cropped farmland block PNG segmentation mask image.

[0051] This method converts the business data in a professional field into a dataset that can be used for deep learning training without the cost of additional manual labeling, fully tapping the value of the business data in this professional field and providing a data foundation for the subsequent application of other deep learning models in this field, such as farmland identification and segmentation.

[0052] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for constructing a dataset based on aerial full-element geographic images, characterized by: The following steps are involved: Step 1: load the shp annotation file, obtain the shape information and attribute information record of each geographic feature, and obtain a geographic feature list; Step 2: traverse the geographic element list and record the current geographic element as main; Step 3: Read the bbox of main, subtract the right and left boundaries to get the width of the bbox, and subtract the upper and lower boundaries to get the height of the bbox; Step 4, calculate the border padding distance, use 10% of the width as the horizontal padding distance width_padding, use 10% of the height as the vertical padding distance height_padding, and fill the border in four directions according to width_padding and height_padding to get the new boundary bbox*; Step 5, save the polygon of main in the list lines, and save the class class in the list classes; Step 6: traverse the geographic element list, record the current geographic element as sub, and perform the following judgment and processing: (1) Whether sub is main, if so, skip and process the next geographic element; (2) Does the polygon shape of sub intersect with the boundary of main? If not, skip it. If so, calculate the intersection of the polygon of sub and the boundary of main, add the intersection to lines, and add the class of sub to classes. Step 7: Read the affine information geo_transform of the full-factor map header file, and convert the latitude and longitude value boundary bbox* into the grid coordinate boundary boundary according to the affine information; Step 8: Read the 4-channel tiff data of the corresponding range from the full-feature map according to the grid coordinate boundary, take the RGB values ​​of the first three channels and save them as a 3-channel jpg format color geographic feature image; Step 9: Write geo_transform, boundary, lines, and classes into json and save it as a file. Generate a segmentation mask array matrix based on the json file and save it as a single-channel grayscale image in png format. Step 10, repeat steps 2-8 until all geographic elements are traversed; Step 11: Organize all the jpg images of geographic features and the png images of segmentation masks into two folders, and perform the same compression operation on the jpg images and png images corresponding to each geographic feature to ensure that the resolution of the jpg images and png images are consistent; In step 12, we finally obtain a dataset containing color images and grayscale annotations.

2. The method for constructing a dataset based on aerial full-element geographic images according to claim 1, characterized in that: In step 1, shape contains the four boundary values ​​​​of each feature's bounding rectangle bbox and the point coordinate sequence polygon of the polygon box of the area actually occupied by the feature, where the boundaries and coordinates are both longitude and latitude values; record contains the serial number id and category information class of each pixel.

3. The method for constructing a dataset based on aerial full-element geographic images according to claim 1, characterized in that: In step 7, when reading the affine information geo_transform of the header file of the full-factor map, only the header file is read without loading all the images.

4. The method for constructing a dataset based on aerial full-element geographic images according to claim 3, characterized in that: In step 8, when reading the 4-channel tiff data of the corresponding range from the full-factor map according to the grid coordinate boundary, only partial reading is performed, and the entire image is not loaded.

5. The method for constructing a dataset based on aerial full-element geographic images according to claim 1, characterized in that: In step 11, the compression rule is: while maintaining the aspect ratio of the image, compress the longer side of the width and height to 1920 pixels.

Citation Information

Patent Citations

  • Automatic extraction and vectorization method for geographical surface elements of thematic map

    CN112991536A

  • Map line element extraction method based on deep learning

    CN115292538A