tensorflow/models · error · FileNotFoundError

Root directory does not exist

Error message

Root directory does not exist: {root_dir}

What it means

Raised in split_train_val's discover_dataset_directories when root_dir does not exist as a directory.

Solutions

  1. Fix the root_dir path typo or create the directory.
  2. Run from the correct working directory or use an absolute path.
  3. Confirm the datasets stage that populates the root has completed.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/split_train_val.py:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/90c5f25e7d39663d. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/split_train_val.py:80

# ── Dataset discovery and validation ────────────────────────────────────────


def discover_dataset_directories(root_dir: str) -> list[tuple[str, str]]:
  """Returns the list of dataset subdirectories directly under ``root_dir``.

  Args:
      root_dir: Path to the root directory containing dataset subfolders.

  Returns:
      A sorted list of ``(dataset_name, dataset_path)`` tuples.

  Raises:
      FileNotFoundError: If ``root_dir`` does not exist.
      ValueError: If ``root_dir`` contains no subdirectories.
  """
  if not os.path.isdir(root_dir):
    raise FileNotFoundError(f"Root directory does not exist: {root_dir}")

  dataset_entries = sorted(
      [entry for entry in os.scandir(root_dir) if entry.is_dir()],
      key=lambda entry: entry.name,
  )

  if not dataset_entries:
    raise ValueError(f"No dataset subfolders found under: {root_dir}")

  return [(entry.name, entry.path) for entry in dataset_entries]


def validate_dataset_paths(
    dataset_directories: list[tuple[str, str]],
    input_images_folder_name: str,
    train_val_folder_name: str,
) -> list[tuple[str, str, str]]:
  """Validates that each dataset has the expected input/output layout.

View on GitHub (pinned to e006f5f0d5)