knitr::opts_chunk$set( collapse = TRUE, comment = "#>", out.width = "100%" ) library(tibble) library(segmetric)
Segmentation Assessment Metrics (segmetric
)
The segmetric
is an open source package that provides a set of metrics for analyzing and evaluating geospatial segmentations. It implements r length(sm_list_metrics())
supervised metrics used in literature for spatial segmentation assessment (see References below).
# install via CRAN install.packages("segmetric")
To install the development version of segmetric
, run the following
commands:
# load necessary libraries library(devtools) install_github("michellepicoli/segmetric")
Spatial datasets can be loaded using sf
objects.
To create a segmetric
object, use function sm_read()
:
library(segmetric) # load example 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)
Plot your data using plot()
command:
plot(m)
Segmentation metrics can be computed by function sm_compute()
.
Use summary()
to obtain an overall metric (mean or weighted mean).
# compute AFI metric and summarize it sm_compute(m, "AFI") %>% summary()
Make multiple calls to compute more other metrics:
# compute OS1, F_measure, and US2 metrics m <- sm_compute(m, "OS1") %>% sm_compute("F_measure") %>% sm_compute("US2") # summarize them summary(m)
To see all supported metrics, type ?metric_functions
or run:
# list all supported metrics sm_list_metrics()
A detailed documentation with examples on how to use each function inside
segmetric
package can be obtained by typing ?segmetric
in R console.
The segmetric
package was implemented based on an extensible architecture.
Feel free to contribute by implementing new metrics functions.
R/metric-funs.R
implementing the new metric..db_registry()
function at R/db.R
file using sm_reg_metric()
.This research was supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (Grant agreement No 677140 MIDLAND).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.