classify: Classify an image using a trained classifier

Description Usage Arguments Details Value Examples

View source: R/classify.R

Description

This function will produce two outputs - a prediction image and a probability image. The prediction image contains the predicted classes, the and the probability image contains the per-pixel predicted probabilities of occurrence of each class.

Usage

1
2
classify(x, model, classes_file, prob_file, factors = list(),
  overwrite = FALSE)

Arguments

x

a Raster* image with the predictor layer(s) for the classification

model

a trained classifier as output by train_classifier

classes_file

filename for predicted classes (or missing)

prob_file

filename for predicted probabilities (or missing)

factors

a list of character vector giving the names of predictors (layer names from the images used to build train_data) that should be treated as factors, and specifying the levels of each factor. For example, factors=list(year=c(1990, 1995, 2000, 2005, 2010)).

overwrite

whether to overwrite out_name if it already exists

Details

This function will run in parallel if a parallel backend is registered with foreach.

Value

a list with 2 elements: the predicted classes as a RasterLayer and the class probabilities as a RasterBrick

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
train_data <- get_pixels(L5TSR_1986, L5TSR_1986_2001_training, "class_1986", 
                         training=.6)
model <- train_classifier(train_data)
preds <- classify(L5TSR_1986, model)
plot(preds$classes)
plot(preds$probs)

## End(Not run)

azvoleff/teamlucc documentation built on June 4, 2017, 12:08 a.m.