
Divergence-based classifier for SAR/PolSAR features (R6)
Source:R/classifier.R
DivergenceClassifier.RdImplements the family of divergence-based classifiers of Ferreira, Coelho
and Nascimento (2021). Each pixel is represented by the model fitted to
the observations of a moving window (see sar_features()) and each class
by the model fitted to its training pixels. A pixel is assigned to the
class that minimises the chosen divergence between the two fitted models:
$$\hat\imath = \arg\min_{i \in \{1, \ldots, g\}} d(\hat\theta_h,
\hat\theta_i).$$
Two families of features are available:
"gaussian"multivariate normal laws for the intensity vector, using the columns
mean_*andcov_*ofsar_features(). The class covariance combines the average local covariance and the covariance of the local means (law of total variance)."wishart"scaled complex Wishart laws for the full PolSAR covariance matrix, using the columns
c11,c12_re,c12_im, ... ofsar_features(). Since all laws share the number of looks, it only rescales the divergences and does not affect the classification.
The classifier is also available as the 'parsnip' model
divergence_classifier(), for use in 'tidymodels' workflows.
References
Ferreira, J. A., Coelho, H. and Nascimento, A. D. C. (2021). A family of divergence-based classifiers for polarimetric synthetic aperture radar (PolSAR) imagery vector and matrix features. International Journal of Remote Sensing, 42(4), 1201–1229. doi:10.1080/01431161.2020.1826060
Public fields
family"gaussian"or"wishart".divergenceDivergence used (see
divergence_gaussian()).orderOrder of the Rényi divergence.
kindForm (1-4) of the Rényi divergence.
classesClass labels.
prototypesList with the fitted model of each class.
channelsChannels (Gaussian) or matrix order (Wishart) used.
Methods
DivergenceClassifier$new()
Create a classifier.
Usage
DivergenceClassifier$new(
family = c("gaussian", "wishart"),
divergence = c("renyi", "kl", "jeffreys", "bhattacharyya"),
order = 0.5,
kind = 1
)DivergenceClassifier$fit()
Fit the class prototypes.
Arguments
xData frame of features (see
sar_features()); other columns are ignored.yFactor (or vector) of class labels.
DivergenceClassifier$predict()
Predict classes, pseudo-probabilities or distances.
Usage
DivergenceClassifier$predict(x, type = c("class", "prob", "distance"))Examples
img <- SARImage$new(SanFrancisco150)$crop(1:80, 1:80)
feats <- sar_features(img, window = 5)
feats$class <- factor(as.vector(SanFrancisco150_gt[1:80, 1:80]),
labels = c("ocean", "forest", "urban"))
set.seed(1)
train <- feats[sample(nrow(feats), 300), ]
clf <- DivergenceClassifier$new(family = "wishart", divergence = "renyi",
order = 0.5, kind = 3)
clf$fit(train, train$class)
pred <- clf$predict(feats)
mean(pred == feats$class)
#> [1] 0.9920313
head(clf$predict(feats, type = "distance"))
#> # A tibble: 6 × 3
#> ocean forest urban
#> <dbl> <dbl> <dbl>
#> 1 1.72 6.56 9.48
#> 2 1.68 6.55 9.50
#> 3 1.65 6.53 9.50
#> 4 1.69 6.59 9.58
#> 5 1.71 6.66 9.68
#> 6 1.62 6.51 9.51