Summary of the invention
Technical problems to be solved
In order to avoid the shortcomings of the prior art, the present invention proposes a kind of aircraft mesh based on saliency and SVMDetection method is marked, it is not high to solve detection accuracy by object detection field is applied to based on the image segmentation that salient region detectsThe problems such as.
Technical solution
A kind of Aircraft Targets detection method based on saliency and SVM, it is characterised in that steps are as follows:
Step 1, data preparation: visible light Airport Images are chosen from publicly available all kinds of images as training sampleAnd target atlas to be detected, and grayscale image is converted to, the size of the external square of maximum of aircraft is from minimum value in figure: a1×a1,It is a to maximum value2×a2;Selected part image will be used as positive sample after the cutting of aircraft region in image as training sample,Negative sample is used as after his region cutting;Remaining parts of images is as test sample;The sample of the training is scaled a3×a3The size of size;
Step 2: extracting the HOG feature of positive negative training sample respectively;
Step 3: by the HOG feature of each the positive negative sample extracted and its class label, positive sample 1, negative sampleA vector, training SVM classifier are combined into for -1;
Step 4: the notable figure of image in test sample is obtained using the conspicuousness detection method based on remaining spectral theory;
Step 5: the connected domain in notable figure is extracted by area threshold method, generates the candidate region of Aircraft Targets,Process is as follows:
Step 5a: the mean value of notable figure is calculated firstAnd variance
Wherein, w indicates that the width of image, h indicate that the height of image, Sal (i, j) indicate the pixel of the i-th row jth column in notable figureValue;
Step 5b: the mean value of notable figure is utilizedAnd varianceThreshold value T is calculated, notable figure is divided with threshold value T;The thresholdValue T:
Coefficient k is in order to which tension metrics are poorAnd mean valueWeight in threshold value T value
Step 5c, connected domain filtering is carried out to the notable figure after thresholding: is n with size1×n1Rectangular window, with the i-th rowA neighborhood is intercepted centered on jth column pixel (i, j);The area that the region is defined with the number of pixels in certain region finds out placeIn the area of the marking area in the contiguous range;If the area is greater than certain threshold value, just retains the region, otherwise do not protectIt stays;Using all regions remained as the candidate region of Aircraft Targets;
Step 6: Aircraft Targets are extracted from the candidate region of Aircraft Targets, process is as follows:
Step 6a, response matrix is constructed:
A two-dimensional response matrix M is constructed, the value of each element is a two-dimensional array M in matrixi,j(s, r) itsMiddle i ∈ [1, w], j ∈ [1, h], s are used for record window size, and r is used to record SVM caused by the window there are Aircraft TargetsResponse;When initialization, which is initialized as a full 0 matrix identical with image size;
Using the local pixel maximum of any candidate region as the center of the candidate region, referred to as: seed point;
Step 6b, secondary windows method rejects invalid seed point, retains most probable aircraft region, process is as follows:
(A) determine first time image block window: window is a rectangular window centered on seed point, the size of windowFor h1×h1, in which:
Wherein, int () function representation round.Original image is intercepted with the window, the figure that will be truncated toAs block is scaled a3×a3Size extracts the HOG feature of image block, then HOG feature is updated in SVM classifier, calculatesSVM classifier response r1;
(B) determine second of image block window: window is a rectangular window centered on seed point, the size of windowFor h2×h2, in which:
h2=2 (h1-1)+1
Original image is intercepted with the window, the image block being truncated to is scaled a3×a3Size extracts image blockThen HOG feature is updated in SVM classifier by HOG feature, calculate SVM classifier response r2;
(C) judge whether to retain the region:
If the classifier response being calculated twice is respectively less than 0, then it is assumed that the corresponding aircraft candidate regions of the seed pointDomain is invalid, therefore rejects the invalid seed point;
Otherwise it is assumed that the region that window includes there are aircraft or contains most of fuselage of aircraft, by two secondary responseIn the larger value assignment into response matrix on the corresponding coordinate position of seed point, the referred to as seed point of response matrix, and recordingThe lower corresponding window size of the response;Specifically, if changing coordinates are as follows: (u, v), the SVM classifier response that needs are recorded,It is assigned to the r value at the seed point of response matrix in the two-dimensional array of element M (u, v);Corresponding interception window when the response will be generatedSquare side length value in mouth size, is assigned to the s value at the seed point of response matrix in the two-dimensional array of element M (u, v);
Step 6c, optimize response matrix, determine aircraft region:
(1) optimize the window size recorded in each seed point:
To the seed point of each response matrix, transformed edge of window long value h is first calculated according to the following formula3:
Centered on the coordinate at the seed point of response matrix, with h3×h3Interception window is established to original image for window sizeAs being intercepted, the image block being truncated to is scaled a3×a3Size extracts the HOG feature of image block, then by HOG featureIt is updated in SVM classifier, calculates SVM classifier response r3;
Transformed edge of window long value h is calculated further according to following formula4:
Centered on the coordinate at the seed point of response matrix, with h4×h4Interception window is established to original image for window sizeAs being intercepted, the image block being truncated to is scaled a3×a3Size extracts the HOG feature of image block, then by HOG featureIt is updated in SVM classifier, calculates SVM classifier response r4;
Find out r, r3,r4In maximum value, replace at the seed point of response matrix original r value in the two-dimensional array of element,With original s value in the two-dimensional array of element at the seed point of the corresponding edge of window long value replacement response matrix of the new r value;
It determines aircraft region, obtains final target detection result;
(2) according to the response matrix after optimization, the coordinate recorded using at the seed point of response matrix is as winged in original imageThe center of square area where machine target, pros where the s value recorded using at the seed point as Aircraft Targets in original imageThe side length in shape region can determine each aircraft region, obtain final Aircraft Targets testing result.
Beneficial effect
A kind of Aircraft Targets detection method based on saliency and SVM proposed by the present invention, salient region detectionIn there are two types of vision attention mode, be respectively: the attention mode of bottom-up (data-driven), top-down (task-driven)Pay attention to mode.The present invention first extracts histograms of oriented gradients (HOG) feature of training sample, Training Support Vector Machines (SVM) pointClass device, then the bottom-up visual attention model using a kind of based on remaining spectral theory carries out salient region detection, fastlyThere may be the candidate regions of target for speed extraction, then extract the HOG feature of candidate region, reuse trained svm classifierDevice classifies to candidate region, completes target detection.
The present invention will dexterously be tied based on the detection of the saliency of remaining spectral theory and the learning method of support vector machinesAltogether, the selection for improving target area improves the robustness of detection accuracy and detection, and model is simple, and execution efficiency is high.
Steps are as follows for embodiment:
Step 1: data preparation.
Visible light Airport Images are intercepted from GOOGLE-EARTH as training sample and target to be detected, are uniformly converted toGrayscale image, the size of the external square of maximum of aircraft is from minimum value in figure: a1×a1, until maximum value is a2×a2Differ.At thisIn embodiment, a1=20, a2=80.From the image after these interceptions, positive negative sample (each 2000) of the acquisition for training,Manually mark its aircraft region.Positive sample is the aircraft of various postures, different model, and negative sample is to build present in airportThe intersection etc. of road in mark, airplane tail group, airport in object, airport.In training, sample standard deviation used is uniformly contractedIt puts as a3×a3The size of size does not need to cut for every width test image.In the present embodiment, a3=64.
Step 2: extracting the HOG feature of positive negative training sample.
First using Gamma correction method to after scaling having a size of a3×a3Image normalization.Then by image uniformIt is divided into b1×b1A " cell " (cell), the size of each cell are c1×c1A pixel, in which: c1=a3/b1.For justIn calculating, usually by a3,b1,c1Value be adjusted to integer value, in the present embodiment, b1=8, c1=8.It finds out each in cellThe gradient direction of pixel projects in corresponding histogram according to the amplitude weighting of its gradient direction, a cell pairAnswer the vector of a N-dimensional (N=9 here extracts 9 dimensional features from each cell).Then take b2×b2A cell combinationAt a block (block), the interval between block and the initial position of block takes d1A pixel, so that mutual is overlapped between block, blockSelection sequence are as follows: first from left to right, then from top to bottom.In the present embodiment, b2=2, d1=8, it may be assumed that horizontal direction and Vertical SquareTo there is 7 blocks respectively, so that image includes 49 blocks altogether.Each cell still takes N-dimensional feature, and the feature of block is by the straight of cellSquare figure feature vector is composed in series according to putting in order for cell;The HOG feature of whole image is then by each piece of HOG featureVector is composed in series.In the present embodiment, have 9 × 2 × 2 totally 36 dimensional feature, entire normalized image share 36 × 49 for each pieceTotally 1764 dimensional feature.
Step 3: by the HOG feature of each the positive negative sample extracted in previous step and its class label, (positive sample is1, negative sample is -1) it is combined into a vector, training SVM classifier.The kernel function of SVM is using radial base core letter in the present embodimentNumber.
Step 4: after training, obtaining the significant of test image using the conspicuousness detection method based on remaining spectral theoryFigure.
(1) width of gray level image I to be detected is set as w pixel, is highly h pixel, to the pixel of image
Set I (x) (wherein [0,255] I (x) ∈, x ∈ [1, w*h]) carries out Fourier transformation F (I (x)), and extracts figurePicture frequency
The phase property and amplitude characteristic in domain;
A (f)=R (F (I (x))) (1)
P (f)=S (F (I (x))) (2)
Wherein, A (f) indicates that the amplitude of frequency f, P (f) indicate the phase of frequency f, and R (F (I (x))) expression takes F (I (x))Amplitude, S (F (I (x))) expression take F (I (x)) phase.
(2) log of calculated amplitude composes L (f), and composes to log and carry out mean filter, the residual spectra R (f) for then asking log to compose:
L (f)=log (A (f)) (3)
R (f)=L (f)-hn(f)*L(f) (4)
H in above formulanIt (f) be size is n × n (in the present embodiment select 3 × 3 sizes) mean filter convolution kernel, definitionFor
(3) residual spectra is acquired to new image spectrum in conjunction with phase spectrum, Fourier inversion is carried out to the image spectrumNew image is acquired, and image smoothing is carried out using Gaussian convolution core to obtained image, can be obtained based on remaining spectral theoryImage saliency map S (x):
S (x)=g (x) * F-1[exp(R(f)+P(f))]2 (5)
In above formula, F-1It (f) is Fourier inversion, g (x) indicates Gaussian convolution core.
Step 5: the connected domain in notable figure being extracted by area threshold method, the candidate regions of Aircraft Targets are generated with thisDomain.
(1) mean value of notable figure is calculated firstAnd variance
Wherein, w indicates that the width of image, h indicate that the height of image, Sal (i, j) indicate the pixel of the i-th row jth column in notable figureValue.
(2) mean value of notable figure is utilizedAnd varianceThreshold value T is calculated, notable figure is divided with threshold value T.Here threshold valueT:
Coefficient k is in order to which tension metrics are poorAnd mean valueWeight in threshold value T value, in the present embodiment:The such value of k can make threshold value T and standard deviationMeet certain inverse proportionality characteristics, the difference that debases the standard is excessiveWhen influence to threshold value, or can the influence appropriate that increase standard deviation when standard deviation is too small.
(3) connected domain filtering is carried out to the notable figure after thresholding.It is n with size1×n1Rectangular window, with the i-th row jthA neighborhood, in the present embodiment, n are intercepted centered on column pixel (i, j)1=11.The area is defined with the number of pixels in certain regionThe area in domain can find out the area of the marking area in the contiguous range.If the area is greater than certain threshold value (this realityIt applies in example, 60) threshold value takes, just retain the region, otherwise do not retain.Using all regions remained as the time of Aircraft TargetsFavored area.
Step 6: extracting Aircraft Targets from the candidate region of Aircraft Targets.
(1) response matrix is constructed
A two-dimensional response matrix M is constructed, the value of each element is a two-dimensional array M in matrixi,j(s, r) itsMiddle i ∈ [1, w], j ∈ [1, h], s are used for record window size, and r is used to record SVM caused by the window there are Aircraft TargetsResponse.When initialization, which is initialized as a full 0 matrix identical with image size.
Using the local pixel maximum of some candidate region as the center of the candidate region, referred to as: seed point (that is: may be usedThere can be the regional center position of Aircraft Targets).
(2) invalid seed point is rejected, most probable aircraft region is retained
For the accuracy rate for improving screening, the present invention proposes a kind of secondary windows method, specific as follows:
(A) first time image block window is determined
The window is a rectangular window centered on seed point, and the size of window is h1×h1, in which:
Wherein, int () function representation round.Original image is intercepted with the window, the figure that will be truncated toAs block is scaled a3×a3Size extracts the HOG feature of image block, then HOG feature is updated in SVM classifier, calculatesSVM classifier response r1。
(B) second of image block window is determined
The window is a rectangular window centered on seed point, and the size of window is h2×h2, in which:
h2=2 (h1-1)+1 (10)
Original image is intercepted with the window, the image block being truncated to is scaled a3×a3Size extracts image blockThen HOG feature is updated in SVM classifier by HOG feature, calculate SVM classifier response r2。
(C) judge whether to retain the region
If the classifier response being calculated twice is respectively less than 0, then it is assumed that the corresponding aircraft candidate regions of the seed pointDomain is invalid, therefore rejects the invalid seed point.
Otherwise it is assumed that the region that window includes there are aircraft or contains most of fuselage of aircraft, this can be rung twiceFor the larger value assignment answered into the response matrix on the corresponding coordinate position of seed point, which is known as the seed of response matrixPoint, and record the corresponding window size of the response.Specifically, if changing coordinates are as follows: (u, v), the svm classifier that needs are recordedDevice response is assigned to the r value at the seed point of response matrix in the two-dimensional array of element M (u, v);It will generate corresponding when the responseInterception window size in square side length value, be assigned at the seed point of response matrix in the two-dimensional array of element M (u, v)S value.
(3) optimize response matrix, determine aircraft region
(A) optimize the window size recorded in each seed point
To the seed point of each response matrix, transformed edge of window long value h is first calculated according to the following formula3:
Centered on the coordinate at the seed point of response matrix, with h3×h3Interception window is established to original image for window sizeAs being intercepted, the image block being truncated to is scaled a3×a3Size extracts the HOG feature of image block, then by HOG featureIt is updated in SVM classifier, calculates SVM classifier response r3。
Transformed edge of window long value h is calculated further according to following formula4:
Centered on the coordinate at the seed point of response matrix, with h4×h4Interception window is established to original image for window sizeAs being intercepted, the image block being truncated to is scaled a3×a3Size extracts the HOG feature of image block, then by HOG featureIt is updated in SVM classifier, calculates SVM classifier response r4。
Find out r, r3,r4In maximum value, replace at the seed point of response matrix original r value in the two-dimensional array of element,With original s value in the two-dimensional array of element at the seed point of the corresponding edge of window long value replacement response matrix of the new r value.
(B) it determines aircraft region, obtains final target detection result
According to the response matrix after optimization, the coordinate recorded using at the seed point of response matrix is as aircraft mesh in original imageThe center of square area where mark, square region where the s value recorded using at the seed point as Aircraft Targets in original imageThe side length in domain can determine each aircraft region, obtain final Aircraft Targets testing result.