Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions R/dataset-pascal.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
#' The dataset defines 21 semantic classes: `"background"`, `"aeroplane"`, `"bicycle"`, `"bird"`, `"boat"`, `"bottle"`, `"bus"`, `"car"`, `"cat"`, `"chair"`,
#' `"cow"`, `"dining table"`, `"dog"`, `"horse"`, `"motorbike"`, `"person"`, `"potted plant"`, `"sheep"`, `"sofa"`, `"train"`, and `"tv/monitor"`.
#' They are available through the `classes` variable of the dataset object.
#' @export
pascal_voc_classes <- function() {
c(
"background", "aeroplane", "bicycle", "bird", "boat", "bottle",
"bus", "car", "cat", "chair", "cow", "dining table", "dog", "horse",
"motorbike", "person", "potted plant", "sheep", "sofa", "train", "tv/monitor"
)
}
#' @export
voc_classes <- pascal_voc_classes
#'
#' This dataset is frequently used for training and evaluating semantic segmentation models, and supports tasks requiring dense, per-pixel annotations.
#'
Expand Down Expand Up @@ -96,12 +106,7 @@ pascal_segmentation_dataset <- torch::dataset(
"6cd6e144f989b92b3379bac3b3de84fd"),
size = c("440 MB", "440 MB", "550 MB", "890 MB", "1.3 GB", "1.7 GB", "1.9 GB")
),
classes = c(
"background", "aeroplane", "bicycle", "bird", "boat",
"bottle", "bus", "car", "cat", "chair",
"cow", "dining table", "dog", "horse", "motorbike",
"person", "potted plant", "sheep", "sofa", "train",
"tv/monitor"
classes = pascal_voc_classes()
),
voc_colormap = c(
c(0, 0, 0), c(128, 0, 0), c(0, 128, 0), c(128, 128, 0),
Expand Down
10 changes: 5 additions & 5 deletions R/models-deeplabv3.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,24 +98,24 @@ deeplabv3_model_urls <- list(
#' @return A character vector with the PASCAL VOC class names
#' @family class_resolution
#' @export
voc_classes <- c(
pascal_voc_classes <- c(
"background", "aeroplane", "bicycle", "bird", "boat", "bottle",
"bus", "car", "cat", "chair", "cow", "dining table", "dog", "horse",
"motorbike", "person", "potted plant", "sheep", "sofa", "train", "tv/monitor"
)

#' @rdname voc_classes
#' @rdname pascal_voc_classes
#' @param id Integer vector of 1-based class identifiers.
#' @return A character vector with the labels associated with `id`.
#' @family class_resolution
#' @export
voc_label <- function(id) {
voc_classes[id]
pascal_voc_classes[id]
}

deeplabv3_meta <- list(
classes = voc_classes,
class_to_idx = setNames(seq_along(voc_classes) - 1, voc_classes)
classes = pascal_voc_classes(),
class_to_idx = setNames(seq_along(pascal_voc_classes()) - 1, pascal_voc_classes())
)


Expand Down
Loading