tensorflow/models · error · FileExistsError
Augmented files already exist in the following class folders
Error message
Augmented files already exist in the following class folders:
{details}
Remove them before re-running, or run on a fresh classifier dataset. What it means
A FileExistsError raised by build_non_geometric_augmentation before any new augmentation work starts. It fires when a pre-scan of the classifier dataset's class folders (via find_pre_existing_augmentations) finds files already produced by a previous run, so re-running would duplicate or mix outputs from different runs.
Solutions
- Delete the existing augmented files from the listed class folders and re-run.
- Run the pipeline on a fresh classifier dataset directory to keep outputs isolated.
- Move the prior augmented outputs to a backup location if they must be preserved.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/augment_train_split.py:408 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/b7e3ff2e244c29d4.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/augment_train_split.py:408
FileExistsError: If any class folder contains augmented files.
"""
folders_with_augmentations = []
for class_name, class_path in class_folders:
existing_augmented_files = find_pre_existing_augmentations(class_path)
if existing_augmented_files:
sample = existing_augmented_files[:5]
extra = len(existing_augmented_files) - len(sample)
sample_text = ", ".join(sample)
if extra > 0:
sample_text += f", ... (+{extra} more)"
folders_with_augmentations.append(
f" - {class_name}: {len(existing_augmented_files)} files "
f"({sample_text})"
)
if folders_with_augmentations:
details = "\n".join(folders_with_augmentations)
raise FileExistsError(
"Augmented files already exist in the following class folders:\n"
f"{details}\n"
"Remove them before re-running, or run on a fresh classifier dataset."
)
# ── Per-folder pipeline ──────────────────────────────────────────────────────
def process_class_folder(
class_name: str,
class_folder: str,
augmentations_to_apply: tuple[str, ...],
rotation_fill_color: tuple[int, int, int],
) -> None:
"""Applies augmentations to all images in a class folder.
Args:View on GitHub (pinned to e006f5f0d5)