tensorflow/models · error · FileExistsError
Classifier output directory already exists
Error message
Classifier output directory already exists: {classifier_output_dir}. Remove or rename it before re-running. What it means
Raised in validate_classifier_output_dir when the classifier output directory already exists; existing outputs must be removed or renamed before re-running.
Solutions
- Remove or rename the existing classifier output directory, then re-run.
- Back up the previous output if it is still needed.
- Choose a fresh output directory for the new run.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:212 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/c3ee50b6cf3b612e.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:212
f"{input_dir}"
)
validated.append((dataset_name, input_dir))
return validated
def validate_classifier_output_dir(classifier_output_dir: str) -> None:
"""Ensures the classifier output directory does not already exist.
Args:
classifier_output_dir: Path to the classifier dataset directory.
Raises:
FileExistsError: If the classifier output directory already exists.
"""
if os.path.exists(classifier_output_dir):
raise FileExistsError(
"Classifier output directory already exists: "
f"{classifier_output_dir}. Remove or rename it before re-running."
)
# ── Variant helpers ───────────────────────────────────────────────────────────
def build_variant_directories(
class_folder: str, variants: tuple[str, ...]
) -> dict[str, str]:
"""Creates output directories for each selected variant under a class folder.
When only one variant is selected, the output directory is the class
folder itself (flat layout). When multiple variants are selected, each
variant gets its own subdirectory under the class folder.
Args:View on GitHub (pinned to e006f5f0d5)