tensorflow/models · error · ValueError

No class subfolders found under: {train_dir}

Error message

No class subfolders found under: {train_dir}

What it means

Error "No class subfolders found under: {train_dir}" thrown in tensorflow/models.

Source

Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/augment_train_split.py:314

def discover_class_folders(train_dir: str) -> list[tuple[str, str]]:
  """Returns the sorted list of class subfolders under the train split.

  Args:
      train_dir: Path to the train split folder.

  Returns:
      A sorted list of ``(class_name, class_path)`` tuples.

  Raises:
      ValueError: If no class subfolders are found.
  """
  class_entries = sorted(
      [entry for entry in os.scandir(train_dir) if entry.is_dir()],
      key=lambda entry: entry.name,
  )
  if not class_entries:
    raise ValueError(f"No class subfolders found under: {train_dir}")
  return [(entry.name, entry.path) for entry in class_entries]


def discover_target_folders(
    train_dir: str, crop_variants: tuple[str, ...]
) -> list[tuple[str, str]]:
  """Returns the sorted list of target subfolders containing images to augment.

  When ``crop_variants`` has a single entry, images are stored directly in
  each class folder under ``train_dir``. When ``crop_variants`` has multiple
  entries, each class folder contains one subdirectory per variant.

  Args:
      train_dir: Path to the train split folder.
      crop_variants: Tuple of active crop variants from the config.

  Returns:
      A sorted list of ``(target_name, target_path)`` tuples.

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/augment_train_split.py:314 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/7d538242be9e06c7. Report an issue: GitHub.