Skip to contents

The sm_compute() computes a given metric (metric_id parameter) from segmentation objects. It compares the reference to the segmentation polygons using a metric.

A list with all supported metrics can be obtained by sm_list_metrics() (see Details for more information).

The sm_metric_subset() returns the subset used to compute the metrics in segmetric object.

Usage

sm_compute(m, metric_id, ...)

sm_metric_subset(m, metric_id = NULL)

Arguments

m

A segmetric object.

metric_id

A character vector with metrics id to be computed.

...

Any additional argument to compute a metric (see Details).

Value

Return a numeric vector with computed metric.

Details

  • "OS1" refers to Oversegmentation. Its values range from 0 (optimal) to 1 (Clinton et al., 2010).

  • "US1" refers to Undersegmentation. Its values range from 0 (optimal) to 1 (Clinton et al., 2010).

  • "OS2" refers to Oversegmentation. Its values range from 0 (optimal) to 1 (Persello and Bruzzone, 2010).

  • "US2" refers to Undersegmentation. Its values range from 0 (optimal) to 1 (Persello and Bruzzone, 2010).

  • "OS3" refers to Oversegmentation. Its values range from 0 (optimal) to 1 (Yang et al., 2014).

  • "US3" refers to Undersegmentation. Its values range from 0 (optimal) to 1 (Yang et al., 2014).

  • "AFI" refers to Area Fit Index. Its optimal value is 0 (Lucieer and Stein, 2002; Clinton et al., 2010).

  • "QR" refers to Quality Rate. Its values range from 0 (optimal) to 1 (Weidner, 2008; Clinton et al., 2010).

  • "D_index" refers to Index D. Its values range from 0 (optimal) to 1 (Levine and Nazif, 1982; Clinton et al., 2010).

  • "precision" refers to Precision. Its values range from 0 to 1 (optimal) (Van Rijsbergen, 1979; Zhang et al., 2015).

  • "recall" refers to Recall. Its values range from 0 to 1 (optimal) (Van Rijsbergen, 1979; Zhang et al., 2015).

  • "UMerging" refers to Undermerging. Its values range from 0 (optimal) to 1 (Levine and Nazif, 1982; Clinton et al., 2010).

  • "OMerging" refers to Overmerging. Its optimal value is 0 (Levine and Nazif, 1982; Clinton et al., 2010).

  • "M" refers to Match. Its values range from 0 to 1 (optimal) (Janssen and Molenaar, 1995; Feitosa et al., 2010).

  • "E" refers to Evaluation Measure. Its values range from 0 (optimal) to 100 (Carleer et al., 2005).

  • "RAsub" refers to Relative Area. Its values range from 0 to 1 (optimal) (Müller et al., 2007; Clinton et al., 2010).

  • "RAsuper" refers to Relative area. Its values range from 0 to 1 (optimal) (Müller et al., 2007; Clinton et al., 2010).

  • "PI" refers to Purity Index. Its values range from 0 to 1 (optimal) (van Coillie et al., 2008).

  • "Fitness" refers to Fitness Function. Its optimal value is 0 (Costa et al., 2008).

  • "ED3" refers to Euclidean Distance. Its values range from 0 (optimal) to 1 (Yang et al., 2014).

  • "F_measure" refers to F-measure metric. Its values range from 0 to 1 (optimal) (Van Rijsbergen, 1979; Zhang et al., 2015). It takes the optional weight argument alpha, ranging from 0.0 to 1.0 (the default is 0.5).

  • "IoU" refers to Intersection over Union metric. Its values range from 0 to 1 (optimal) (Jaccard, 1912; Rezatofighi et al., 2019).

  • "SimSize" refers to the similarity size metric. Its values range from 0 to 1 (optimal) (Zhan et al., 2005).

  • "qLoc"refers to quality of object’s location metric. Its optimal value is 0 (Zhan et al., 2005).

  • "RPsub" refers to Relative Position (sub) metric. Optimal value is 0 (Möller et al., 2007, Clinton et al., 2010).

  • "RPsuper" refers to Relative Position (super) metric. Its values range from 0 (optimal) to 1 (Möller et al., 2007, Clinton et al., 2010).

  • "OI2 refers to Overlap Index metric. Its values range from 0 to 1 (optimal) (Yang et al., 2017).

References

A complete list of cited references is available in ?segmetric.

Examples

# load sample datasets
data("sample_ref_sf", package = "segmetric")
data("sample_seg_sf", package = "segmetric")

# create segmetric object
m <- sm_read(ref_sf = sample_ref_sf, seg_sf = sample_seg_sf)

# compute AFI metric and summarize it
sm_compute(m, "AFI") %>% summary()
#> [1] -0.007097452

# compute three metrics and summarize them
sm_compute(m, c("AFI", "OS1", "US2")) %>% summary()
#>          AFI          OS1          US2 
#> -0.007097452  0.173414677  0.086174537 

# compute OS1, F_measure, and US2 metrics using pipe
m <- sm_compute(m, "OS1") %>%
  sm_compute("F_measure") %>%
  sm_compute("US2")

# summarize them
summary(m)
#>        OS1  F_measure        US2 
#> 0.17341468 0.84728616 0.08617454