Skip to contents

Extracts a .zip archive containing a YOLO dataset or YOLO training results. By default, extracts into a folder named after the .zip archive (without the .zip extension) located in the same parent directory as the archive.

If the extracted directory contains a valid YOLO dataset (data.yaml or images/ directory), the function automatically returns an active yolo_dataset S3 object for direct inspection, training with yolo_train(), or preview with yolo_dataset_preview().

Usage

yolo_dataset_unzip(
  file,
  exdir = NULL,
  overwrite = TRUE,
  as_dataset = TRUE,
  verbose = TRUE
)

yolo_unzip(
  file,
  exdir = NULL,
  overwrite = TRUE,
  as_dataset = TRUE,
  verbose = TRUE
)

Arguments

file

Character. Path to the .zip archive to extract. If the .zip extension is omitted, the function checks for <file>.zip in the current working directory.

exdir

Character. Directory where the files should be extracted. If NULL (default), the contents are extracted into a folder named after the .zip archive (without extension) in the same directory as the .zip file.

overwrite

Logical. Whether to overwrite existing files during extraction. Defaults to TRUE.

as_dataset

Logical. If TRUE (default) and the extracted archive is a YOLO dataset, returns a yolo_dataset S3 object. If FALSE or if the archive contains training results, returns the path to the extracted directory.

verbose

Logical. Whether to print informative status messages. Defaults to TRUE.

Value

A yolo_dataset object if the extracted contents represent a YOLO dataset, or the path to the extracted folder (invisibly).

Examples

if (FALSE) { # interactive()
# Unzip dataset into 'my_dataset/'
ds <- yolo_unzip("my_dataset.zip")

# Unzip training results from Google Colab
res_dir <- yolo_unzip("capsulas_small_results.zip")
yolo_results(res_dir)
}