main content

constant false alarm rate (cfar) detection -凯发k8网页登录

this example introduces constant false alarm rate (cfar) detection and shows how to use cfardetector and cfardetector2d in the phased array system toolbox™ to perform cell averaging cfar detection.

introduction

one important task a radar system performs is target detection. the detection itself is fairly straightforward. it compares the signal to a threshold. therefore, the real work on detection is coming up with an appropriate threshold. in general, the threshold is a function of both the probability of detection and the probability of false alarm.

in many phased array systems, because of the cost associated with a false detection, it is desirable to have a detection threshold that not only maximizes the probability of detection but also keeps the probability of false alarm below a preset level.

there is extensive literature on how to determine the detection threshold. readers might be interested in the and examples for some well known results. however, all these classical results are based on theoretical probabilities and are limited to white gaussian noise with known variance (power). in real applications, the noise is often colored and its power is unknown.

cfar technology addresses these issues. in cfar, when the detection is needed for a given cell, often termed as the cell under test (cut), the noise power is estimated from neighboring cells. then the detection threshold, t, is given by

t=αpn

where pn is the noise power estimate and α is a scaling factor called the threshold factor.

from the equation, it is clear that the threshold adapts to the data. it can be shown that with the appropriate threshold factor, α, the resulting probability of false alarm can be kept at a constant, hence the name cfar.

cell averaging cfar detection

the cell averaging cfar detector is probably the most widely used cfar detector. it is also used as a baseline comparison for other cfar techniques. in a cell averaging cfar detector, noise samples are extracted from both leading and lagging cells (called training cells) around the cut. the noise estimate can be computed as [1]

pn=1nm=1nxm

where n is the number of training cells and xm is the sample in each training cell. if xm happens to be the output of a square law detector, then pn represents the estimated noise power. in general, the number of leading and lagging training cells are the same. guard cells are placed adjacent to the cut, both leading and lagging it. the purpose of these guard cells is to avoid signal components from leaking into the training cell, which could adversely affect the noise estimate.

the following figure shows the relation among these cells for the 1-d case.

with the above cell averaging cfar detector, assuming the data passed into the detector is from a single pulse, i.e., no pulse integration involved, the threshold factor can be written as [1]

α=n(pfa-1/n-1)

where pfa is the desired false alarm rate.

cfar detection using automatic threshold factor

in the rest of this example, we show how to use phased array system toolbox to perform a cell averaging cfar detection. for simplicity and without losing any generality, we still assume that the noise is white gaussian. this enables the comparison between the cfar and classical detection theory.

we can instantiate a cfar detector using the following command:

cfar = phased.cfardetector('numtrainingcells',20,'numguardcells',2);

in this detector we use 20 training cells and 2 guard cells in total. this means that there are 10 training cells and 1 guard cell on each side of the cut. as mentioned above, if we assume that the signal is from a square law detector with no pulse integration, the threshold can be calculated based on the number of training cells and the desired probability of false alarm. assuming the desired false alarm rate is 0.001, we can configure the cfar detector as follows so that this calculation can be carried out.

exp_pfa = 1e-3;
cfar.thresholdfactor = 'auto';
cfar.probabilityfalsealarm = exp_pfa;

the configured cfar detector is shown below.

cfar
cfar = 
  phased.cfardetector with properties:
                   method: 'ca'
            numguardcells: 2
         numtrainingcells: 20
          thresholdfactor: 'auto'
    probabilityfalsealarm: 1.0000e-03
             outputformat: 'cut result'
      thresholdoutputport: false
     noisepoweroutputport: false

we now simulate the input data. since the focus is to show that the cfar detector can keep the false alarm rate under a certain value, we just simulate the noise samples in those cells. here are the settings:

  • the data sequence is 23 samples long, and the cut is cell 12. this leaves 10 training cells and 1 guard cell on each side of the cut.

  • the false alarm rate is calculated using 100 thousand monte carlo trials.

rs = randstream('mt19937ar','seed',2010);
npower = db2pow(-10);  % assume 10db snr ratio
ntrials = 1e5;
ncells = 23;
cutidx = 12;
% noise samples after a square law detector
rsamp = randn(rs,ncells,ntrials) 1i*randn(rs,ncells,ntrials);   
x = abs(sqrt(npower/2)*rsamp).^2;

to perform the detection, pass the data through the detector. in this example, there is only one cut, so the output is a logical vector containing the detection result for all the trials. if the result is true, it means that a target is present in the corresponding trial. in our example, all detections are false alarms because we are only passing in noise. the resulting false alarm rate can then be calculated based on the number of false alarms and the number of trials.

x_detected = cfar(x,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 9.4000e-04

the result shows that the resulting probability of false alarm is below 0.001, just as we specified.

cfar detection using custom threshold factor

as explained in the earlier part of this example, there are only a few cases in which the cfar detector can automatically compute the appropriate threshold factor. for example, using the previous scenario, if we employ a 10-pulses noncoherent integration before the data goes into the detector, the automatic threshold can no longer provide the desired false alarm rate.

npower = db2pow(-10);  % assume 10db snr ratio
xn = 0;
for m = 1:10
    rsamp = randn(rs,ncells,ntrials) 1i*randn(rs,ncells,ntrials);
    xn = xn   abs(sqrt(npower/2)*rsamp).^2;   % noncoherent integration
end
x_detected = cfar(xn,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 0

one may be puzzled why we think a resulting false alarm rate of 0 is worse than a false alarm rate of 0.001. after all, isn't a false alarm rate of 0 a great thing? the answer to this question lies in the fact that when the probability of false alarm is decreased, so is the probability of detection. in this case, because the true false alarm rate is far below the allowed value, the detection threshold is set too high. the same probability of detection can be achieved with our desired probability of false alarm at lower cost; for example, with lower transmitter power.

in most cases, the threshold factor needs to be estimated based on the specific environment and system configuration. we can configure the cfar detector to use a custom threshold factor, as shown below.

release(cfar);
cfar.thresholdfactor = 'custom';

continuing with the pulse integration example and using empirical data, we found that we can use a custom threshold factor of 2.35 to achieve the desired false alarm rate. using this threshold, we see that the resulting false alarm rate matches the expected value.

cfar.customthresholdfactor = 2.35;
x_detected = cfar(xn,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 9.6000e-04

cfar detection threshold

a cfar detection occurs when the input signal level in a cell exceeds the threshold level. the threshold level for each cell depends on the threshold factor and the noise power in that derived from training cells. to maintain a constant false alarm rate, the detection threshold will increase or decrease in proportion to the noise power in the training cells. configure the cfar detector to output the threshold used for each detection using the thresholdoutputport property. use an automatic threshold factor and 200 training cells.

release(cfar);
cfar.thresholdoutputport = true;
cfar.thresholdfactor = 'auto';
cfar.numtrainingcells = 200;

next, create a square-law input signal with increasing noise power.

rs = randstream('mt19937ar','seed',2010);
npoints = 1e4;
rsamp = randn(rs,npoints,1) 1i*randn(rs,npoints,1);
ramp = linspace(1,10,npoints)';
xramp = abs(sqrt(npower*ramp./2).*rsamp).^2;

compute detections and thresholds for all cells in the signal.

[x_detected,th] = cfar(xramp,1:length(xramp));

next, compare the cfar threshold to the input signal.

plot(1:length(xramp),xramp,1:length(xramp),th,...
  find(x_detected),xramp(x_detected),'o')
legend('signal','threshold','detections','location','northwest')
xlabel('time index')
ylabel('level')

figure contains an axes object. the axes object with xlabel time index, ylabel level contains 3 objects of type line. one or more of the lines displays its values using only markers these objects represent signal, threshold, detections.

here, the threshold increases with the noise power of the signal to maintain the constant false alarm rate. detections occur where the signal level exceeds the threshold.

comparison between cfar and classical neyman-pearson detector

in this section, we compare the performance of a cfar detector with the classical detection theory using the neyman-pearson principle. returning to the first example and assuming the true noise power is known, the theoretical threshold can be calculated as

t_ideal = npower*db2pow(npwgnthresh(exp_pfa));

the false alarm rate of this classical neyman-pearson detector can be calculated using this theoretical threshold.

act_pfa_np = sum(x(cutidx,:)>t_ideal)/ntrials
act_pfa_np = 9.5000e-04

because we know the noise power, classical detection theory also produces the desired false alarm rate. the false alarm rate achieved by the cfar detector is similar.

release(cfar);
cfar.thresholdoutputport = false;
cfar.numtrainingcells = 20;
x_detected = cfar(x,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 9.4000e-04

next, assume that both detectors are deployed to the field and that the noise power is 1 db more than expected. in this case, if we use the theoretical threshold, the resulting probability of false alarm is four times more than what we desire.

npower = db2pow(-9);  % assume 9db snr ratio
rsamp = randn(rs,ncells,ntrials) 1i*randn(rs,ncells,ntrials);
x = abs(sqrt(npower/2)*rsamp).^2;   
act_pfa_np = sum(x(cutidx,:)>t_ideal)/ntrials
act_pfa_np = 0.0041

on the contrary, the cfar detector's performance is not affected.

x_detected = cfar(x,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 0.0011

hence, the cfar detector is robust to noise power uncertainty and better suited to field applications.

finally, use a cfar detection in the presence of colored noise. we first apply the classical detection threshold to the data.

npower = db2pow(-10);
fcoeff = maxflat(10,'sym',0.2);
x = abs(sqrt(npower/2)*filter(fcoeff,1,rsamp)).^2;   % colored noise
act_pfa_np = sum(x(cutidx,:)>t_ideal)/ntrials
act_pfa_np = 0

note that the resulting false alarm rate cannot meet the requirement. however, using the cfar detector with a custom threshold factor, we can obtain the desired false alarm rate.

release(cfar);
cfar.thresholdfactor = 'custom';
cfar.customthresholdfactor = 12.85;
x_detected = cfar(x,cutidx);
act_pfa = sum(x_detected)/ntrials
act_pfa = 0.0010

cfar detection for range-doppler images

in the previous sections, the noise estimate was computed from training cells leading and lagging the cut in a single dimension. we can also perform cfar detection on images. cells correspond to pixels in the images, and guard cells and training cells are placed in bands around the cut. the detection threshold is computed from cells in the rectangular training band around the cut.

in the figure above, the guard band size is [2 2] and the training band size is [4 3]. the size indices refer to the number of cells on each side of the cut in the row and columns dimensions, respectively. the guard band size can also be defined as 2, since the size is the same along row and column dimensions.

next, create a two-dimensional cfar detector. use a probability of false alarm of 1e-5 and specify a guard band size of 5 cells and a training band size of 10 cells.

cfar2d = phased.cfardetector2d('guardbandsize',5,'trainingbandsize',10,...
  'probabilityfalsealarm',1e-5);

next, load and plot a range-doppler image. the image includes returns from two stationary targets and one target moving away from the radar.

[resp,rnggrid,dopgrid] = helperrangedoppler;

figure contains an axes object. the axes object with title range doppler map, xlabel doppler (hz), ylabel range (m) contains an object of type image.

use cfar to search the range-doppler space for objects, and plot a map of the detections. search from -10 to 10 khz and from 1000 to 4000 m. first, define the cells under test for this region.

[~,rangeindx] = min(abs(rnggrid-[1000 4000]));
[~,dopplerindx] = min(abs(dopgrid-[-1e4 1e4]));
[columninds,rowinds] = meshgrid(dopplerindx(1):dopplerindx(2),...
  rangeindx(1):rangeindx(2));
cutidx = [rowinds(:) columninds(:)]';

compute a detection result for each cell under test. each pixel in the search region is a cell in this example. plot a map of the detection results for the range-doppler image.

detections = cfar2d(resp,cutidx);
helperdetectionsmap(resp,rnggrid,dopgrid,rangeindx,dopplerindx,detections)

figure contains an axes object. the axes object with title range doppler cfar detections, xlabel doppler (hz), ylabel range (m) contains an object of type image.

the three objects are detected. a data cube of range-doppler images over time can likewise be provided as the input signal to cfar2d, and detections will be calculated in a single step.

summary

in this example, we presented the basic concepts behind cfar detectors. in particular, we explored how to use the phased array system toolbox to perform cell averaging cfar detection on signals and range-doppler images. the comparison between the performance offered by a cell averaging cfar detector and a detector equipped with the theoretically calculated threshold shows clearly that the cfar detector is more suitable for real field applications.

reference

[1] mark richards, fundamentals of radar signal processing, mcgraw hill, 2005

网站地图