
Convert External Annotations (CSV, COCO, Pascal VOC) to YOLO Format
Source:R/utils_yolo_dataset.R
yolo_dataset_convert.Rdyolo_dataset_convert() converts annotations from standard computer vision formats
into a clean, ready-to-train YOLO dataset.
Supports:
CSV: Tabular tables (
image,xmin,ymin,xmax,ymax,class) commonly exported by ImageJ, Fiji, or field records.COCO: Standard COCO JSON (
instances_train.jsonwithimages,annotations,categories).Pascal VOC: Directory of XML annotation files.
Automatically computes normalized YOLO coordinates and creates train/ and val/ splits.
Arguments
- input
Path to the annotation file (
.csv,.json) or directory containing Pascal VOC.xmlfiles.- format
Format type:
"csv"(default),"coco", or"voc".- img_dir
Directory where the raw image files are stored.
- out_dir
Destination directory for the YOLO dataset. Defaults to
"yolo_converted_dataset".- split
Proportions for train and validation splits (default:
c(train = 0.80, val = 0.20)).- copy
Logical. Whether to copy image files into the dataset. Defaults to
TRUE.- seed
Random seed for split partitioning (default: 42).
- overwrite
Logical. Overwrite existing
out_dir. Defaults toFALSE.- verbose
Logical. Show progress. Defaults to
TRUE.