CN113221773A - Method for quickly constructing airplane classification data set based on remote sensing image - Google Patents
Method for quickly constructing airplane classification data set based on remote sensing image Download PDFInfo
- Publication number
- CN113221773A CN113221773A CN202110544772.1A CN202110544772A CN113221773A CN 113221773 A CN113221773 A CN 113221773A CN 202110544772 A CN202110544772 A CN 202110544772A CN 113221773 A CN113221773 A CN 113221773A
- Authority
- CN
- China
- Prior art keywords
- new
- max
- slice
- airplane
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/10—Terrestrial scenes
- G06V20/13—Satellite images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10032—Satellite or aerial image; Remote sensing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Astronomy & Astrophysics (AREA)
- Remote Sensing (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a method for quickly constructing an airplane classification data set based on remote sensing images, which comprises 3 key steps, namely, marking original remote sensing images, recording the type of each airplane and the coordinate of each airplane in the images to form a marking file; secondly, performing primary cutting on the original remote sensing image to form a slice with each slice only containing one target, and automatically generating a label file corresponding to each slice; and thirdly, rotating the slice at multiple angles, calculating coordinates of the rotated target in the slice, and finally cutting the target from the rotated slice. Compared with the mode of directly rotating the original remote sensing image and then cutting, the method has the advantages that the data processing efficiency is improved by about 6 times, the airplane cannot deform when the target formed by cutting enters the classification network for scaling, the airplane feature extraction is more accurate, and the model classification accuracy is improved.
Description
Technical Field
The invention belongs to the field of computer vision data enhancement, and particularly relates to a method for quickly constructing an airplane classification data set based on remote sensing images.
Background
The information exists in various types, particularly, the information existing in an image form is important, and compared with information such as text, audio and the like, the image is more intuitive and contains more information. The information of fully extracting the image is an important direction of future information processing, and the traditional mode of extracting image information is mainly manual interpretation, and is inefficient, and along with the development of science and technology, image acquisition ability is stronger and stronger, and image quantity is exponential growth, and artificial mode has been unable to adapt to the development and the actual conditions of era, need develop the research of utilizing machine intelligence to interpret the image urgently.
The basis of utilizing a machine learning training model is a data set, the data labeling workload is large, the method is a data enhancement method aiming at the data set construction, and the data set which has a certain scale and meets the model training requirement can be formed by labeling a small number of remote sensing images.
Data enhancement and data set construction are involved by almost every machine learning researcher. The conventional data enhancement methods commonly used at present include rotation, translation, scaling, random shielding, random clipping, turning, brightness adjustment, noise disturbance and the like. The data enhancement method using machine learning is based on a generation countermeasure network method.
The Zhang Xiaofeng provides a data enhancement method based on the generation of the countermeasure network for the problems of data shortage and difficult training of the neural network in a 'data enhancement method based on the generation of the countermeasure network', and an experimental result shows that compared with real data, the synthesized data has semantic similarity and can present text diversity; after the synthetic data is added, the neural network can be trained more stably. (Zhang Xiaofeng, data enhancement method based on generation of confrontational network, computer system application, 10 months in 2019)
In the patent of 'an infrared image data enhancement method applied to target detection', aiming at the problem that infrared image data is lack and is not enough to support a training detector, a method for converting a color image from a color domain to an infrared domain by constructing and generating a confrontation network as an image generator is disclosed, and then the infrared image-based target detection network is convenient to train so as to improve the detection rate of the target in an environment with poor illumination. (Wangweian, Shenping, an infrared image data enhancement method for object detection, 202011412775)
When the remote sensing images are labeled, due to the fact that the airplanes are different in shape and different in length-width ratio, the labeling frame of the airplane is not square but rectangular, the airplane with the length-width ratio larger than 1.2 reaches 40%, the classification network can zoom and stretch the images into squares (such as 224x224 or 256x256) before inputting the images into the network, the airplane is deformed due to stretching operation, as shown in fig. 3, due to the fact that the angles of the airplanes and the labeling errors are different in the same type, the stretching proportion is different, the difficulty of extracting airplane features from the identification model is increased, feature extraction is inaccurate, and the identification accuracy of the model is reduced.
The remote sensing image has larger pixel points, the average pixel is more than 10000 x 10000, but the number of airplane targets in one remote sensing image is less and unequal, less 3-5 frames and more 50-60 frames, and when the data is enhanced and the original image is directly rotated, the memory consumption is large, the calculated amount is large, and the consumed time is too much. If the target is directly cut and then rotated, the rotation will bring black edges, which affects the accuracy of the classification model.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to solve the technical problems that the demand of machine learning on data is large, the original data of remote sensing images is less, the labeling cost of classified data is high, the efficiency of the existing data enhancement mode is low, and deformation can be generated before the target images of airplanes enter network identification, and provides a method for quickly constructing airplane classified data sets based on the remote sensing images.
In order to solve the technical problem, the invention discloses a method for quickly constructing an aircraft classification data set based on remote sensing images, which comprises the following steps:
step 1, marking an original remote sensing image, marking an airplane target in the original large-amplitude remote sensing image by using a rectangular frame, and recording the coordinate of a marking frame in the image to form an original marking file;
step 2, primarily cutting an original remote sensing image according to an original labeling file to form a slice with each slice only containing one target, calculating the size and the position of the slice through the coordinate of a labeling frame where the airplane target is located, and simultaneously generating a slice labeling file corresponding to each slice;
and 3, rotating the slices at multiple angles, calculating coordinates of the rotated target in the rotated slices, and cutting the airplane target from the rotated slices according to the coordinates.
In one implementation mode, the original labeling file in step 1 records the type of the airplane target and the coordinates of the labeling frame where the airplane target is located in the original remote sensing image.
In one implementation mode, in step 2, an original remote sensing image is cut for the first time, the original remote sensing image is cut from the original remote sensing image according to a single target, a slice with each slice only containing one airplane target is formed, the airplane target is located in the center of the slice, the size and the position of the slice are obtained through calculation of coordinates of a marking frame where the airplane target is located, and meanwhile a marking file corresponding to each slice is generated.
The operations such as rotation in the subsequent step are performed based on the slices generated in the step, so that the memory occupation and consumption in the calculation process can be greatly reduced, and the data processing rate is remarkably improved.
In one implementation, step 2 includes:
(1) cutting an airplane target:
recording the width W and the height H of an original remote sensing image, setting the positions of a marking frame where an airplane target is read to be (x1, y1), (x2, y2), (x3, y3), (x4, y4), and calculating the coordinates of the upper left corner (x _ min, y _ min) and the coordinates of the lower right corner (x _ max, y _ max):
x_min=min(x1,x2,x3,x4)
y_min=min(y1,y2,y3,y4)
x_max=max(x1,x2,x3,x4)
y_max=max(y1,y2,y3,y4)
calculating the width and height of the airplane target:
width=x_max-x_min
height=y_max-y_min
calculating the size of a slice to be cut, calculating the size extended of the slice to be extended:
extend=max(width,height)/2
the slice after the expansion operation can ensure that when the aircraft target is marked after rotating any angle, a black area generated by filling after rotation is not contained in the marking frame (except the condition that the aircraft target is at the edge of the original remote sensing image).
Calculating the coordinates of the slice to be cut in the original remote sensing image, namely the upper left corner (x _ c _ min, y _ c _ min) and the lower right corner (x _ c _ max, y _ c _ max), and cutting the slice from the original remote sensing image according to the coordinates, wherein the coordinate calculation formulas of (x _ c _ min, y _ c _ min) and (x _ c _ max, y _ c _ max) are as follows:
x_c_min=max(0,x_min-extend)
y_c_min=max(0,y_min-extend)
x_c_max=min(W,x_max+extend)
y_c_max=min(H,y_max+extend)
calculating the coordinates of the airplane target in the slice, wherein the upper left corner is (x _ n _ min, y _ n _ min), the lower right corner is (x _ n _ max, y _ n _ max), and generating a slice annotation file corresponding to the slice, wherein the slice annotation file comprises the type of the airplane target and the coordinates of the airplane target relative to the slice, (x _ n _ min, y _ n _ min) and (x _ n _ max, y _ n _ max) coordinate calculation formulas are as follows:
x_n_min=x_min–x_c_min
y_n_min=y_min–y_c_min
x_n_max=x_n_min+width
y_n_max=y_n_min+height
the coordinates obtained through the calculation are the actual coordinates of the airplane target relative to the slice, and the airplane target can be directly cut out from the slice according to the coordinates.
(2) Cutting out all aircraft targets
And (3) cutting all the airplane targets in the original remote sensing image one by one according to the steps in the step (1) to generate independent slices and corresponding slice marking files.
In one implementation, the step 3 of performing multiple angle rotations on the slice generated in the step 2, and cutting the airplane target from the rotated slice to generate a data set, includes:
step 3.1: rotating the slice to obtain a new picture, and calculating a rotation coordinate corresponding to any pixel point in the original slice when the upper left corner of the new picture is taken as an origin;
step 3.2: calculating coordinates of four points of a marking frame of the airplane target in the new picture;
step 3.3: cutting the airplane target according to the square to obtain a square airplane target image;
step 3.4: and (3) circularly executing the steps 3.1-3.3, obtaining square airplane target images of other rotation angles and square airplane target images of other slices at multiple rotation angles, and generating a data set.
In one implementation, step 3.1 comprises:
step 3.1.1: calculating the coordinate (x _ new, y _ new) of any pixel point in the original slice after the anticlockwise rotation angle is a degrees:
let the size of the original slice be WcHigh HcThe slice is centered around (W)c/2,HcAnd/2) counterclockwise rotation by a degree, and the coordinates in the new picture after the rotation of the point with the coordinates (x _ old, y _ old) in the original slice are (x _ new, y _ new), (x _ new, y _ new) are calculated as follows:
x_new=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2
y_new=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2
the coordinate system corresponding to the point with the coordinate of (x _ old, y _ old) in the original slice is based on the upper left corner of the original slice as the origin (0,0), and the new coordinates (x _ new, y _ new) calculated by the above formula are respectively shifted left and up (W _ new) by the center of the new picturec/2,HcThe point after/2) is obtained by calculation with the origin (0,0), a negative value appears, and therefore the formula needs to be corrected;
step 3.1.2: calculating correction offset amounts delt _ x and delt _ y with the upper left corner of the new rotated picture as the origin:
four corners (0,0), (W) of the original slicec,0),(Wc,Hc),(0,Hc) The coordinates of the four points after rotation are calculated as (x _ new _1, y _ new _1), (x _ new _2, y _ new _2), (x _ new _3, y _ new _3), (x _ new _4, y _ new _4) by substituting the above formula for (x _ old, y _ old) in the calculation of (x _ new, y _ new), respectively, and the formula for calculating the correction offset amount is:
delt_x=min(x_new_1,x_new_2,x_new_3,x_new_4)
delt_y=min(y_new_1,y_new_2,y_new_3,y_new_4)
step 3.1.3: calculating the corrected rotation coordinates (x _ new _ revise, y _ new _ revise) with the upper left corner of the new picture obtained by rotation as the origin, wherein the calculation formula is as follows:
x_new_revise=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2–delt_x
y_new_revise=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2–delt_y
the coordinates which are relative to the upper left corner of the new rotated picture and are taken as the origin are obtained after the calculation, and the coordinate system conforms to the general specification of the field of image processing.
In one implementation, step 3.2 includes: let the coordinates of the labeling box where the aircraft target is located in the original slice be (x1, y1), (x2, y2), (x3, y3), (x4, x4), and calculate the coordinates corresponding to 4 points after slice rotation (x1, y1), (x2, y2), (x3, y3), (x4, x4) by using the rotation coordinate formula corrected in step 3.1.3, and denote as (x _1_ new, y _1_ new), (x _2_ new, y _2_ new), (x _3_ new, y _3_ new), (x _4_ new, y _4_ new), and calculate the left upper-corner coordinates (x _ new _ min, y _ new _ lower _ min) and the right-corner coordinates (x _ new _ max, y _ new _ max) of the labeling box of the aircraft target in the new slice as follows:
x_new_min=min(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_min=min(y_1_new,y_2_new,y_3_new,y_4_new)
x_new_max=max(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_max=max(y_1_new,y_2_new,y_3_new,y_4_new)
then after the slice is rotated, the four corner coordinates of the labeling box of the airplane target in the new picture are: upper left corner (x _ new _ min, y _ new _ min), upper right corner (x _ new _ max, y _ new _ min), lower right corner (x _ new _ max, y _ new _ max), lower left corner (x _ new _ min, y _ new _ max).
In one implementation, step 3.3 includes: calculating a minimum external square coincident with the center point of a marking frame of the airplane target in a new picture, firstly calculating a coordinate correction value cut according to the square, then cutting according to the corrected coordinate, storing into a square airplane target picture, and recording the corresponding relation between the name of each square airplane target picture and the type of the airplane target; the coordinate correction algorithm is as follows:
if y _ new _ max-y _ new _ min > -x _ new _ max-x _ new _ min, remember
delt=((y_new_max-y_new_min)–(x_new_max-x_new_min))/2
The coordinate of the upper left corner of the marked frame of the airplane target in the new picture is corrected to (x _ new _ min-delt, y _ new _ min), and the coordinate of the lower right corner is corrected to (x _ new _ max + delt, y _ new _ max)
If y _ new _ max-y _ new _ min < x _ new _ max-x _ new _ min, remember
delt=((x_new_max-x_new_min)–(y_new_max-y_new_min))/2
The upper left corner coordinate of the marked box in the new picture of the airplane target is corrected to (x _ new _ min, y _ new _ min-delt), and the lower right corner coordinate is corrected to (x _ new _ max, y _ new _ max + delt).
The method cuts the target according to the mode of the minimum external square, and ensures that the image of the airplane target does not deform before entering the network recognition when the recognition model is trained. Similar operation is adopted during inference, namely when the airplane target is cut from the detection result and enters the recognition model, the minimum circumscribed square of the detection frame is calculated at first, and the target is cut according to the square and then is transmitted into the recognition model for recognition. The method can enable the aircraft feature extraction to be more accurate, and improve the model classification and identification accuracy.
Has the advantages that:
the method for quickly constructing the airplane classification data set based on the remote sensing image is a method for constructing the airplane classification data set under the application scene that the remote sensing image has less original data and high data marking cost, a data enhancement flow of slicing, rotating and cutting and a square cutting mode are adopted in the data enhancement, and the method has the following advantages:
(1) when the original remote sensing image is marked, marking according to the actual boundary of the airplane target, wherein the marking can be used for training an airplane detection model and constructing a classification data set training classification model;
(2) compared with the mode of directly rotating the original remote sensing image and then cutting, the data processing efficiency is improved by about 6 times for the cutting and rotating operation of the remote sensing image with more than 10000 x 10000 pixel points;
(3) the airplane cannot deform when a target formed by square cutting enters the classification network for zooming, so that the airplane characteristic extraction is more accurate, and the model classification accuracy is improved. Similar operation is adopted during inference, namely when the airplane target is cut from the detection result and enters the recognition model, the minimum circumscribed square of the detection frame is calculated at first, and the target is cut according to the square and then is transmitted into the recognition model for recognition.
Drawings
The foregoing and/or other advantages of the invention will become further apparent from the following detailed description of the invention when taken in conjunction with the accompanying drawings.
FIG. 1 is a flowchart of an embodiment of the present application for rapidly constructing an aircraft classification dataset based on remote sensing images;
FIG. 2 is a labeled example of an aircraft according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a prior art rectangular trimmed aircraft undergoing a change in shape after stretching;
FIG. 4 is a schematic diagram of a labeled box of an aircraft target in a new image after being rotationally sliced according to an embodiment of the present application.
Detailed Description
Embodiments of the present invention will be described below with reference to the accompanying drawings.
The invention provides a method for quickly constructing an airplane classification data set based on remote sensing images, which comprises the following specific steps:
step 1, as shown in fig. 2, marking an original remote sensing image, marking an airplane target in the original remote sensing image by using a rectangular frame, and recording coordinates of a marking frame in the image to form an original marking file, wherein the original marking file records the type of the airplane target and the coordinates of the marking frame in the original remote sensing image. The original annotation file in this embodiment is exemplified as follows:
{ type: 'xx aircraft', XY: [ x1, y1, x2, y2, x3, y3, x4, y4] }
The type of the airplane target is recorded by the 'xx airplane', (x1, y1), (x2, y2), (x3, y3), (x4, y4) and the coordinate values of four points of a labeling box where the airplane target is located.
Step 2, primarily cutting the original remote sensing image according to the original labeling file, cutting the remote sensing image according to a single target to form a slice with each slice only containing one airplane target, wherein the airplane target is positioned in the center of the slice, the size and the position of the slice are obtained by calculating the coordinates of a labeling frame where the airplane target is positioned, and simultaneously, automatically generating a slice labeling file corresponding to each slice, wherein the specific steps are as follows:
(1) cutting an airplane target:
the width W and the height H of the original remote sensing image are recorded, and the positions of the marking boxes where the airplane target is located are (x1, y1), (x2, y2), (x3, y3), (x4 and y 4). Calculate the top left corner coordinates (x _ min, y _ min) and the bottom right corner coordinates (x _ max, y _ max):
x_min=min(x1,x2,x3,x4)
y_min=min(y1,y2,y3,y4)
x_max=max(x1,x2,x3,x4)
y_max=max(y1,y2,y3,y4)
calculating the width (width) and height (height) of the airplane target:
width=x_max-x_min
height=y_max-y_min
calculating the size of a slice to be cut, calculating the size extended of the slice to be extended:
extend=max(width,height)/2
calculating the coordinates of the slice to be cut in the original remote sensing image, namely the upper left corner (x _ c _ min, y _ c _ min) and the lower right corner (x _ c _ max, y _ c _ max), and cutting the slice from the original remote sensing image according to the coordinates, wherein the coordinate calculation formulas of (x _ c _ min, y _ c _ min) and (x _ c _ max, y _ c _ max) are as follows:
x_c_min=max(0,x_min-extend)
y_c_min=max(0,y_min-extend)
x_c_max=min(W,x_max+extend)
y_c_max=min(H,y_max+extend)
calculating the coordinates of the airplane target in the slice, wherein the upper left corner is (x _ n _ min, y _ n _ min), and the lower right corner is (x _ n _ max, y _ n _ max), and generating a slice annotation file corresponding to the slice (the annotation file contains the type of the airplane target and the coordinates of the airplane target relative to the slice), (x _ n _ min, y _ n _ min), and (x _ n _ max, y _ n _ max) coordinate calculation formulas are as follows:
x_n_min=x_min–x_c_min
y_n_min=y_min–y_c_min
x_n_max=x_n_min+width
y_n_max=y_n_min+height
(2) cutting all objects
And (3) cutting all the airplane targets in the original remote sensing image one by one according to the steps in the step (1) to generate independent slices and corresponding slice marking files.
Note: when the distances between the multiple airplane targets are close, only one airplane target in each slice cannot be completely guaranteed, the slice is generated by taking each airplane target as the center at one time, and only one airplane target exists in the corresponding label file.
Step 3, rotating the slice at multiple angles, calculating coordinates of the rotated target in the slice, and then cutting the airplane target from the rotated slice, wherein the specific steps are as follows:
step 3.1: rotating the slice to obtain a new picture, and calculating a rotation coordinate corresponding to any pixel point in the original slice when the upper left corner of the new picture is taken as an origin;
step 3.2: calculating coordinates of four points of a marking frame of the airplane target in the new picture;
step 3.3: cutting the airplane target according to the square to obtain a square airplane target image;
step 3.4: and (3) circularly executing the steps 3.1-3.3, obtaining square airplane target images of other rotation angles and square airplane target images of other slices with multiple rotation angles, and generating a data set.
In this embodiment, step 3.1 includes:
step 3.1.1: calculating the coordinate (x _ new, y _ new) of any pixel point in the original slice after the anticlockwise rotation angle is a degrees:
let the size of the original slice be WcHigh HcThe slice is centered around (W)c/2,HcAnd/2) counterclockwise rotation by a degree, and the coordinates in the new picture after the rotation of the point with the coordinates (x _ old, y _ old) in the original slice are (x _ new, y _ new), (x _ new, y _ new) are calculated as follows:
x_new=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2
y_new=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2
the coordinate system corresponding to the point with the coordinate of (x _ old, y _ old) in the original slice is based on the upper left corner of the original slice as the origin (0,0), as shown by the point O' in the left diagram of fig. 4, and the new coordinates (x _ new, y _ new) calculated by the above formula are respectively shifted to the left and upward (W _ new, y _ new) by the center of the new picturec/2,HcThe point after/2) is calculated as the origin (0,0), a negative value occurs, and thus the formulaNeed to be corrected;
step 3.1.2: the correction offset amounts delt _ x and delt _ y with the upper left corner of the new rotated picture as the origin (indicated by the O point in the right picture of fig. 4) are calculated:
four corners (0,0), (W) of the original slicec,0),(Wc,Hc),(0,Hc) The coordinates of the four points after rotation are calculated as (x _ new _1, y _ new _1), (x _ new _2, y _ new _2), (x _ new _3, y _ new _3), (x _ new _4, y _ new _4) by substituting the above formula for (x _ old, y _ old) in the calculation of (x _ new, y _ new), respectively, and the formula for calculating the correction offset amount is:
delt_x=min(x_new_1,x_new_2,x_new_3,x_new_4)
delt_y=min(y_new_1,y_new_2,y_new_3,y_new_4)
step 3.1.3: calculating corrected rotation coordinates (x _ new _ revise, y _ new _ revise) with the upper left corner of the new picture obtained by rotation as the origin, wherein the calculation formula is as follows:
x_new_revise=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2–delt_x
y_new_revise=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2–delt_y。
in this embodiment, step 3.2 includes: let the coordinates of the marked box where the aircraft target is located in the original slice be (x1, y1), (x2, y2), (x3, y3), (x4, x4), and use the rotation coordinate formula corrected in step 3.1.3 to calculate the coordinates of 4 points corresponding to (x1, y1), (x2, y2), (x3, y3), (x4, x4) after the slice is rotated, (x _1_ new, y _1_ new), (x _2_ new, y _2_ new), (x _3_ new, y _3_ new), (x _4_ new, y _4_ new), which correspond to the points T1, T2, T3, and T4 of the right image of fig. 4, respectively, and calculate the coordinates of the aircraft target in the top left corner (x _ new _ min, y _ new _ max, and the coordinates of the marked box of the aircraft target in the new image as follows:
x_new_min=min(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_min=min(y_1_new,y_2_new,y_3_new,y_4_new)
x_new_max=max(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_max=max(y_1_new,y_2_new,y_3_new,y_4_new)
then after the slice is rotated, the four corner coordinates of the labeling box of the airplane target in the new picture are: the marked boxes of the aircraft target in the new picture are black rectangular boxes in the right picture of fig. 4.
In this embodiment, step 3.3 includes: calculating a minimum external square coincident with the center point of a marking frame of the airplane target in a new picture, firstly calculating a coordinate correction value cut according to the square, then cutting according to the corrected coordinate, storing into a square airplane target picture, and recording the corresponding relation between the name of each square airplane target picture and the type of the airplane target; the coordinate correction algorithm is as follows:
if y _ new _ max-y _ new _ min > -x _ new _ max-x _ new _ min, remember
delt=((y_new_max-y_new_min)–(x_new_max-x_new_min))/2
The coordinate of the upper left corner of the marked frame of the airplane target in the new picture is corrected to (x _ new _ min-delt, y _ new _ min), and the coordinate of the lower right corner is corrected to (x _ new _ max + delt, y _ new _ max)
If y _ new _ max-y _ new _ min < x _ new _ max-x _ new _ min, remember
delt=((x_new_max-x_new_min)–(y_new_max-y_new_min))/2
The upper left corner coordinate of the marked box in the new picture of the airplane target is corrected to (x _ new _ min, y _ new _ min-delt), and the lower right corner coordinate is corrected to (x _ new _ max, y _ new _ max + delt).
The invention provides a method for rapidly constructing an aircraft classification data set based on remote sensing images, and a plurality of methods and ways for implementing the technical scheme are provided, the above description is only a specific implementation manner of the invention, and it should be noted that, for a person skilled in the art, a plurality of improvements and decorations can be made without departing from the principle of the invention, and these improvements and decorations should also be regarded as the protection scope of the invention. All the components not specified in the present embodiment can be realized by the prior art.
Claims (8)
1. A method for quickly constructing an aircraft classification data set based on remote sensing images is characterized by comprising the following steps:
step 1: marking an original remote sensing image, marking an airplane target in the original remote sensing image by using a rectangular frame, and recording the coordinates of a marking frame in the image to form an original marking file;
step 2: primarily cutting an original remote sensing image according to an original marking file to form a slice with each slice only containing one airplane target, calculating the size and the position of the slice through the coordinate of a marking frame where the airplane target is located, and simultaneously generating a slice marking file corresponding to each slice;
and step 3: and rotating the slice, calculating the coordinates of the rotated airplane target in the rotated slice, and cutting the airplane target from the rotated slice according to the coordinates.
2. The method for rapidly constructing the aircraft classification data set based on the remote sensing images as claimed in claim 1, wherein in step 1, an original labeling file records the type of the aircraft target and the coordinates of a labeling frame where the aircraft target is located in the original remote sensing images.
3. The method for rapidly constructing the airplane classification data set based on the remote sensing images as claimed in claim 1, wherein in the step 2, the original remote sensing image is cut for the first time, the original remote sensing image is cut from the original remote sensing image according to a single target, a slice with each slice only containing one airplane target is formed, the airplane target is located in the center of the slice, the size and the position of the slice are obtained through calculation of coordinates of a labeling frame where the airplane target is located, and a labeling file corresponding to each slice is generated at the same time.
4. The method for rapidly constructing an aircraft classification data set based on remote sensing images as claimed in claim 3, wherein the step 2 comprises:
(1) cutting an airplane target:
recording the width W and the height H of an original remote sensing image, setting the positions of a marking frame where an airplane target is read to be (x1, y1), (x2, y2), (x3, y3), (x4, y4), and calculating the coordinates of the upper left corner (x _ min, y _ min) and the coordinates of the lower right corner (x _ max, y _ max):
x_min=min(x1,x2,x3,x4)
y_min=min(y1,y2,y3,y4)
x_max=max(x1,x2,x3,x4)
y_max=max(y1,y2,y3,y4)
calculating the width and height of the airplane target:
width=x_max-x_min
height=y_max-y_min
calculating the size of a slice to be cut, calculating the size extended of the slice to be extended:
extend=max(width,height)/2
calculating the coordinates of the slice to be cut in the original remote sensing image, namely the upper left corner (x _ c _ min, y _ c _ min) and the lower right corner (x _ c _ max, y _ c _ max), and cutting the slice from the original remote sensing image according to the coordinates, wherein the coordinate calculation formulas of (x _ c _ min, y _ c _ min) and (x _ c _ max, y _ c _ max) are as follows:
x_c_min=max(0,x_min-extend)
y_c_min=max(0,y_min-extend)
x_c_max=min(W,x_max+extend)
y_c_max=min(H,y_max+extend)
calculating the coordinates of the airplane target in the slice, wherein the upper left corner is (x _ n _ min, y _ n _ min), the lower right corner is (x _ n _ max, y _ n _ max), and generating a slice annotation file corresponding to the slice, wherein the slice annotation file comprises the type of the airplane target and the coordinates of the airplane target relative to the slice, (x _ n _ min, y _ n _ min) and (x _ n _ max, y _ n _ max) coordinate calculation formulas are as follows:
x_n_min=x_min–x_c_min
y_n_min=y_min–y_c_min
x_n_max=x_n_min+width
y_n_max=y_n_min+height
(2) cutting out all aircraft targets
And (3) cutting all the airplane targets in the original remote sensing image one by one according to the steps in the step (1) to generate independent slices and corresponding slice marking files.
5. The method for rapidly constructing an aircraft classification data set based on remote sensing images as claimed in claim 4, wherein in step 3, the slice generated in step 2 is rotated by a plurality of angles, and an aircraft target is cut from the rotated slice to generate the data set, and the method comprises the following steps:
step 3.1: rotating the slice to obtain a new picture, and calculating a rotation coordinate corresponding to any pixel point in the original slice when the upper left corner of the new picture is taken as an origin;
step 3.2: calculating coordinates of four points of a marking frame of the airplane target in the new picture;
step 3.3: cutting the airplane target according to the square to obtain a square airplane target image;
step 3.4: and (3) circularly executing the steps 3.1-3.3, obtaining square airplane target images of other rotation angles and square airplane target images of other slices at multiple rotation angles, and generating a data set.
6. The method for rapidly constructing an aircraft classification dataset based on remote sensing images as claimed in claim 5, wherein step 3.1 comprises:
step 3.1.1: calculating the coordinate (x _ new, y _ new) of any pixel point in the original slice after the anticlockwise rotation angle is a degrees:
let the size of the original slice be WcHigh HcThe slice is centered around (W)c/2,HcAnd/2) counterclockwise rotation by a degree, and the coordinates in the new picture after the rotation of the point with the coordinates (x _ old, y _ old) in the original slice are (x _ new, y _ new), (x _ new, y _ new) are calculated as follows:
x_new=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2
y_new=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2
the coordinate system corresponding to the point with the coordinate of (x _ old, y _ old) in the original slice is the original point (0,0) at the upper left corner of the original slice, and the new coordinate (x _ new, y _ new) calculated by the formula is the new coordinate (x _ new, y _ new)The centers of the pictures are respectively shifted leftwards and upwards (W)c/2,HcThe point after/2) is obtained by calculation with the origin (0, 0);
step 3.1.2: calculating correction offset amounts delt _ x and delt _ y with the upper left corner of the new rotated picture as the origin:
four corners (0,0), (W) of the original slicec,0),(Wc,Hc),(0,Hc) The coordinates of the four points after rotation are calculated as (x _ new _1, y _ new _1), (x _ new _2, y _ new _2), (x _ new _3, y _ new _3), (x _ new _4, y _ new _4) by substituting the above formula for (x _ old, y _ old) in the calculation of (x _ new, y _ new), respectively, and the formula for calculating the correction offset amount is:
delt_x=min(x_new_1,x_new_2,x_new_3,x_new_4)
delt_y=min(y_new_1,y_new_2,y_new_3,y_new_4)
step 3.1.3: calculating corrected rotation coordinates (x _ new _ revise, y _ new _ revise) with the upper left corner of the new picture obtained by rotation as the origin, wherein the calculation formula is as follows:
x_new_revise=(y_old–Hc/2)*sin(a)+(x_old–Wc/2)*cos(a)+Wc/2–delt_x
y_new_revise=(y_old–Hc/2)*cos(a)+(x_old–Wc/2)*sin(a)+Hc/2–delt_y。
7. the method for rapidly constructing an aircraft classification dataset based on remote sensing images as claimed in claim 6, wherein step 3.2 comprises: let the coordinates of the labeling box where the aircraft target is located in the original slice be (x1, y1), (x2, y2), (x3, y3), (x4, x4), and calculate the coordinates corresponding to 4 points after slice rotation (x1, y1), (x2, y2), (x3, y3), (x4, x4) by using the rotation coordinate formula corrected in step 3.1.3, and denote as (x _1_ new, y _1_ new), (x _2_ new, y _2_ new), (x _3_ new, y _3_ new), (x _4_ new, y _4_ new), and calculate the left upper-corner coordinates (x _ new _ min, y _ new _ lower _ min) and the right-corner coordinates (x _ new _ max, y _ new _ max) of the labeling box of the aircraft target in the new slice as follows:
x_new_min=min(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_min=min(y_1_new,y_2_new,y_3_new,y_4_new)
x_new_max=max(x_1_new,x_2_new,x_3_new,x_4_new)
y_new_max=max(y_1_new,y_2_new,y_3_new,y_4_new)
then after the slice is rotated, the four corner coordinates of the labeling box of the airplane target in the new picture are: upper left corner (x _ new _ min, y _ new _ min), upper right corner (x _ new _ max, y _ new _ min), lower right corner (x _ new _ max, y _ new _ max), lower left corner (x _ new _ min, y _ new _ max).
8. The method for rapidly constructing an aircraft classification dataset based on remote sensing images as claimed in claim 7, wherein step 3.3 comprises: calculating a minimum external square coincident with the center point of a marking frame of the airplane target in a new picture, firstly calculating a coordinate correction value cut according to the square, then cutting according to the corrected coordinate, storing into a square airplane target picture, and recording the corresponding relation between the name of each square airplane target picture and the type of the airplane target; the coordinate correction algorithm is as follows:
if y _ new _ max-y _ new _ min > -x _ new _ max-x _ new _ min, remember
delt=((y_new_max-y_new_min)–(x_new_max-x_new_min))/2
The coordinate of the upper left corner of the marked frame of the airplane target in the new picture is corrected to (x _ new _ min-delt, y _ new _ min), and the coordinate of the lower right corner is corrected to (x _ new _ max + delt, y _ new _ max)
If y _ new _ max-y _ new _ min < x _ new _ max-x _ new _ min, remember
delt=((x_new_max-x_new_min)–(y_new_max-y_new_min))/2
The upper left corner coordinate of the marked box in the new picture of the airplane target is corrected to (x _ new _ min, y _ new _ min-delt), and the lower right corner coordinate is corrected to (x _ new _ max, y _ new _ max + delt).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110544772.1A CN113221773B (en) | 2021-05-19 | 2021-05-19 | Method for quickly constructing airplane classification data set based on remote sensing image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110544772.1A CN113221773B (en) | 2021-05-19 | 2021-05-19 | Method for quickly constructing airplane classification data set based on remote sensing image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113221773A true CN113221773A (en) | 2021-08-06 |
CN113221773B CN113221773B (en) | 2022-09-13 |
Family
ID=77093010
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110544772.1A Active CN113221773B (en) | 2021-05-19 | 2021-05-19 | Method for quickly constructing airplane classification data set based on remote sensing image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113221773B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114092698A (en) * | 2021-11-09 | 2022-02-25 | 北京百度网讯科技有限公司 | Target information processing method, device, equipment and storage medium |
CN114463336A (en) * | 2021-12-29 | 2022-05-10 | 济南超级计算技术研究院 | Cutting method and system for image and pixel level segmentation marking data thereof |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019104879A1 (en) * | 2017-11-30 | 2019-06-06 | 平安科技(深圳)有限公司 | Information recognition method for form-type image, electronic device and readable storage medium |
WO2019192397A1 (en) * | 2018-04-04 | 2019-10-10 | 华中科技大学 | End-to-end recognition method for scene text in any shape |
CN110674698A (en) * | 2019-08-30 | 2020-01-10 | 杭州电子科技大学 | Remote sensing image rotating ship target detection method based on intensive subregion cutting |
CN110765951A (en) * | 2019-10-24 | 2020-02-07 | 西安电子科技大学 | Remote sensing image airplane target detection method based on bounding box correction algorithm |
-
2021
- 2021-05-19 CN CN202110544772.1A patent/CN113221773B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019104879A1 (en) * | 2017-11-30 | 2019-06-06 | 平安科技(深圳)有限公司 | Information recognition method for form-type image, electronic device and readable storage medium |
WO2019192397A1 (en) * | 2018-04-04 | 2019-10-10 | 华中科技大学 | End-to-end recognition method for scene text in any shape |
CN110674698A (en) * | 2019-08-30 | 2020-01-10 | 杭州电子科技大学 | Remote sensing image rotating ship target detection method based on intensive subregion cutting |
CN110765951A (en) * | 2019-10-24 | 2020-02-07 | 西安电子科技大学 | Remote sensing image airplane target detection method based on bounding box correction algorithm |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114092698A (en) * | 2021-11-09 | 2022-02-25 | 北京百度网讯科技有限公司 | Target information processing method, device, equipment and storage medium |
CN114463336A (en) * | 2021-12-29 | 2022-05-10 | 济南超级计算技术研究院 | Cutting method and system for image and pixel level segmentation marking data thereof |
Also Published As
Publication number | Publication date |
---|---|
CN113221773B (en) | 2022-09-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108492343B (en) | Image synthesis method for training data for expanding target recognition | |
CN110210387B (en) | Method, system and device for detecting insulator target based on knowledge graph | |
CN109948549B (en) | OCR data generation method and device, computer equipment and storage medium | |
CN113221773B (en) | Method for quickly constructing airplane classification data set based on remote sensing image | |
CN104134234A (en) | Full-automatic three-dimensional scene construction method based on single image | |
Chen et al. | Shadow-based Building Detection and Segmentation in High-resolution Remote Sensing Image. | |
CN112634125B (en) | Automatic face replacement method based on off-line face database | |
CN107123130B (en) | Kernel correlation filtering target tracking method based on superpixel and hybrid hash | |
CN107944459A (en) | A kind of RGB D object identification methods | |
CN112132058A (en) | Head posture estimation method based on multi-level image feature refining learning, implementation system and storage medium thereof | |
CN106503170B (en) | It is a kind of based on the image base construction method for blocking dimension | |
CN111027538A (en) | Container detection method based on instance segmentation model | |
CN114694165A (en) | Intelligent PID drawing identification and redrawing method | |
CN112541922A (en) | Test paper layout segmentation method based on digital image, electronic equipment and storage medium | |
Lodh et al. | Flower recognition system based on color and GIST features | |
CN111177811A (en) | Automatic fire point location layout method applied to cloud platform | |
Tan et al. | Common pattern discovery using earth mover's distance and local flow maximization | |
CN115761285A (en) | Auxiliary assembly method based on virtual pose and scene perception matching learning | |
CN111179271B (en) | Object angle information labeling method based on retrieval matching and electronic equipment | |
CN106056575B (en) | A kind of image matching method based on like physical property proposed algorithm | |
CN105930813B (en) | A method of detection composes a piece of writing this under any natural scene | |
Heitzler et al. | A modular process to improve the georeferencing of the Siegfried map | |
CN111627033B (en) | Method, equipment and computer readable storage medium for dividing difficult sample instance | |
Rong et al. | RGB-D hand pose estimation using fourier descriptor | |
CN108932726A (en) | A kind of method for tracking target and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |