Skip to contents

Reverses the last labeling, export, or autolabeling operation performed on a YOLO dataset, functioning like a "Ctrl + Z" action.

If source images were moved (move = TRUE), they are safely moved back to their original source directory. If images were copied (move = FALSE), the copies in images/ are removed. All generated labels (labels/), review preview images (review/), and YAML configs are cleanly purged. If no history manifest is found, it safely restores all images from images/ back to the dataset folder (or a custom to directory).

Usage

yolo_dataset_undo(
  data = ".",
  to = NULL,
  steps = 1L,
  purge_empty = TRUE,
  force = FALSE,
  verbose = TRUE
)

yolo_undo(
  data = ".",
  to = NULL,
  steps = 1L,
  purge_empty = TRUE,
  force = FALSE,
  verbose = TRUE
)

yolo_autolabel_undo(
  data = ".",
  to = NULL,
  steps = 1L,
  purge_empty = TRUE,
  force = FALSE,
  verbose = TRUE
)

yolo_dataset_export_undo(
  data = ".",
  to = NULL,
  steps = 1L,
  purge_empty = TRUE,
  force = FALSE,
  verbose = TRUE
)

yolo_dataset_label_undo(
  data = ".",
  to = NULL,
  steps = 1L,
  purge_empty = TRUE,
  force = FALSE,
  verbose = TRUE
)

Arguments

data

Path to the dataset directory (e.g. "dataset_rotulado", ".") or a yolo_dataset object.

to

Optional destination folder to return the images to (used if original location cannot be determined or to override original locations). Defaults to restoring images directly inside the dataset directory.

steps

Integer. Number of operations to undo (default 1L).

purge_empty

Logical. Whether to remove empty dataset directories (images/, labels/, review/) after restoring images. Defaults to TRUE.

force

Logical. If TRUE, forces undo even if data is a root/system directory or a parent container holding multiple child datasets. Defaults to FALSE.

verbose

Logical. Show progress messages. Defaults to TRUE.

Value

Invisible list containing details of restored images, removed labels, and cleaned files.