Skip to content

Preprocessing Utils Function References

Functions documentation for preprocesssing/utils.py

Function Reference

scripts.preprocessing.utils

Utility Functions For Preprocessing Data into Training Sets for YOLO models

create_yaml(working_dir, class_names=['cross-sucking'], output_filename='dataset.yaml')

Write a YOLO dataset YAML configuration file.

Parameters:

Name Type Description Default
dataset_path str

Absolute path to the dataset root directory.

required
class_names list[str]

Ordered list of class labels matching the IDs in label files.

['cross-sucking']
output_path str

Destination path for the YAML file.

required

Returns:

Type Description
None

This function reads straight to disk and does not return anything.

validate_file_paths(paths, root)

Clean file paths to standardize path structure and validate paths exist in the root directory root.

Parameters:

Name Type Description Default
paths List[str]

List of relative paths within the labelled clips directory to zipped folders containing bounding box annotations for cross-sucking events, or relative paths to cross-sucking clips within the cross sucking clips directory.

required
root Path

Path to the root directory containing zipped folders with bounding box annotations for cross-sucking events, or cross-sucking videos.

required

Returns:

Name Type Description
validated_paths List[Path]

List of Paths to zipped folders with bounding box labels, or cross-sucking videos.

Raises:

Type Description
TypeError

If label_paths is not a list or root is not a Path object.

FileNotFoundError

If a constructed path does not exist.