A method for adaptively selecting a Ground Penetrating Radar (GPR) image for detecting a moisture damage, wherein the method adaptively selects the GPR image with a proper contrast according to data of the GPR image, comprising the following steps:
- S1, reading pre-processed GPR data:
- generating GPR images with different contrasts randomly in a set contrast data range after pre-processing GPR data to construct an initial random image data set, wherein the initial random image data set comprising N pictures;
- S2, adjusting resolutions of the N pictures:
- defining the initial random image data set as an RID data set, zooming the RID data set to 224*224 to obtain a zoomed data set and defining the zoomed data set as an RBD data set;
- zooming a resolution of a moisture damage initial image data set directly to 224*224 to obtain the RBD data set;
- S3, inputting the RBD data set into a recognition model:
- inputting the RBD data set obtained in the step S2 into the recognition model, and executing a step S4 after an operation of the recognition model,
- wherein a picture input resolution size of the recognition model is 224*224 and a picture output resolution size of the recognition model is 224*224;
- the recognition model is a mixed deep learning model, wherein the mixed deep learning model is comprised of two portions:
- a feature extraction adopting ResNet50 and a target detection adopting a YOLO V2 frame;
- S4, outputting a moisture damage result:
- post-processing an output result of the recognition model in the S3, wherein the post-processing comprising the following steps:
- S41, judging a quantity of candidate boxes BBoxes of a spectra in the output result, executing S42 when the quantity of candidate boxes BBoxes is greater than 1, otherwise, outputting a result directly;
- S42, judging whether the candidate boxes BBoxes are overlapped or not, executing S43 when the candidate boxes BBoxes are overlapped, otherwise, outputting the result directly;
- S43, judging whether label names corresponding to overlapped candidate boxes are identical or not, wherein when label names corresponding to the overlapped candidate boxes are identical, the label names corresponding to merged candidate boxes are invariable and when label names corresponding to the overlapped candidate boxes are not identical, indicating that moisture damage label names and bridge joint label names are comprised simultaneously, the label names are output as bridge joint, Joint;
- S44, merging the candidate boxes BBoxes, taking a minimum value of intersected candidate boxes in x and y directions, taking a maximum value of w and h, wherein coordinates of a merged candidate box are [xmin, ymin, wmax, hmax];
- S45, outputting the result, adjusting an output picture resolution to be equal to a picture resolution of the moisture damage initial image data set in the output result of the recognition model, wherein the output result is a label name with a target and an image of the candidate box BBoxes (x, y, w, h) corresponding to the target;
- S5, judging whether a detection target is present or not with the initial random image data set:
- S51, converting the output result in the S4 into a matrix Ai corresponding to pixel points in a picture, wherein Ai is defined as:
- A
- i
- [
- m
- ,
- n
- ]
- =
- {
- 1
- ,
- x
- i
- ≤
- m
- ≤
- x
- i
- +
- W
- i
-
- and
-
- y
- i
- ≤
- n
- ≤
- y
- i
- +
- h
- i
- 0
- ,
- other
- ,
- where 1≤m≤H0, 1≤n≤W0;
- wherein H0 is a picture height of an image output by the recognition model and W0 is a picture width of the image output by the recognition model;
- summating the matrixes Ai corresponding to the N pictures in the RID data set and calculating a mean value of the matrixes Ai to acquire a mean value matrix A, wherein A is defined as:
- A
- =
- 1
- N
-
- ∑
- i
- =
- 1
- N
- A
- i
- ;
- S52, setting k1=0.8 and θ0=0.5, and updating the mean value matrix A according to a formula below to acquire an updated mean value matrix A;
- A(A<max(k1*max(max(A)), θ0))=0;
- wherein
- k1 is a target association coefficient;
- θ0 is a minimum value in the matrix A when the target is comprised, and no target is present when the mean value is lower than the minimum value;
- max(max(A)) is a maximum value in the mean value matrix A;
- S53, acquiring a judging condition T for judging whether the target is present or not according to a formula below on a basis of the updated mean value matrix A, and when the judging condition T is equal to 1, indicating that the target is present and when the judging condition T is equal to 0, indicating that no target is present;
- T
- =
- {
- 1
- ,
- where
-
- max
-
- (
- max
-
- (
- A
- )
- )
- >
- 0
- 0
- ,
- where
-
- max
-
- (
- max
-
- (
- A
- )
- )
- =
- 0
- ;
- and
- S6, generating the GPR image randomly incrementally and selecting the GPR image with the proper contrast:
- when the picture contains the target, performing an initial judgment;
- S61, when Flag is equal to 0, indicating that a random image sample set is generated for a first time in an initial sample set stage, not entering a follow-up selecting judgment, setting Flag=1, then adding 5% of the N pictures additionally as a sample of the initial random image data set, a total number of the N pictures in the sample being is N=(1+5%) N, and returning to the S2;
- S62, when the Flag is not equal to 0, indicating a non-initial stage, setting a picture association coefficient, and selecting the picture with a maximum association coefficient of the mean value matrix A as the GPR image with the proper contrast;
- the picture association coefficient Ri is defined as:
- R
- i
- =
- ∑
- m
- =
- 1
- H
- 0
- ∑
- n
- =
- 1
- W
- 0
- (
- A
-
- (
- m
- ,
- n
- )
- -
- μ
- A
- )
-
- (
- A
- i
- (
- m
- ,
- n
- )
- -
- μ
- A
- i
- )
- ∑
- m
- =
- 1
- H
- 0
- ∑
- n
- =
- 1
- W
- 0
- (
- A
-
- (
- m
- ,
- n
- )
- -
- μ
- A
- )
- 2
-
- ∑
- m
- =
- 1
- H
- 0
- ∑
- n
- =
- 1
- W
- 0
- (
- A
- i
- (
- m
- ,
- n
- )
- -
- μ
- A
- i
- )
- 2
- ;
- wherein Ri is the picture association coefficient between the matrix Ai corresponding to an ith image and the mean value matrix A;
- m is a coordinate value in a height direction;
- n is a coordinate value in a width direction;
- μA is a total mean value of the mean value matrix A;
- and
- μAi is a total mean value of the matrix Ai;
- a termination condition of a selection process is as follows:
- STOP
- =
- abs
-
- (
- F
-
- 1
- -
- F
-
- 1
- p
-
- r
-
- e
- )
- <
- 0.01
- &&
- F
-
- 1
- >
- 0.8
- ;
- F
-
- 1
- =
- 2
- *
- Precision
- ·
- Recall
- Precision
- +
- Recall
- ;
- Precision
- =
- T
-
- P
- T
-
- P
- +
- F
-
- P
- ;
- Recall
- =
- TP
- TP
- +
- F
-
- N
- ;
- wherein F1 is an evaluation index of a deep learning;
- F1Pre is an evaluation index of a previous deep learning, and is 0 initially;
- TP is a true target region;
- FP is a misrecognized true value, representing that an unrecognized true value is judged as a negative value or a background mistakenly;
- and FN is a misrecognized negative value wherein the background is taken as the target;
- assigning the evaluation index F1 calculated to a variable F1Pre when the termination condition is not met, and then returning to the step S61 to increase the random image sample set so as to re-select;
- outputting the GPR image with the proper contrast by a GPR system when the termination condition is met.