tensorflow/models · error · ValueError

Input directory not found at

Error message

Input directory not found at '{INPUT_DIR}'

What it means

Startup check in the milk-pouch detection main(): the configured INPUT_DIR does not exist as a directory, so there are no images to run detection on and the pipeline would silently produce nothing. Fires when the input path is wrong, the data was never downloaded, or the path points to a file instead of a directory.

Solutions

  1. Verify INPUT_DIR (flags or module constant) points to the existing images directory
  2. Download or copy the input images to the expected location
  3. Fix typos or use absolute paths; ensure it is a directory, not a single file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/src/extract_objects.py:111 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/1dfa5bad0e1f0ef6. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/src/extract_objects.py:111

    Filtered masks and boxes.
  """
  filtered = [
      (mask, box)
      for mask, box in zip(masks, boxes)
      if (np.sum(mask.astype(np.uint8)) / image_area) * 100 > min_percent
  ]

  if not filtered:
    return [], []

  valid_masks, valid_boxes = zip(*filtered)
  return list(valid_masks), list(valid_boxes)


def main(_) -> None:
  """Runs the main object detection and extraction pipeline."""
  if not os.path.isdir(INPUT_DIR):
    raise ValueError(f"Input directory not found at '{INPUT_DIR}'")

  # Check if COCO output should be created
  create_coco = FLAGS.category_name is not None

  print("Initializing image extraction and classification...")
  try:
    pipeline = detection_segmentation.ObjectDetectionSegmentation(
        dino_config_path=GROUNDING_DINO_CONFIG,
        dino_weights_path=GROUNDING_DINO_WEIGHTS,
        sam_config_path=SAM2_CONFIG,
        sam_checkpoint_path=SAM2_WEIGHTS,
    )
  except FileNotFoundError as e:
    print(
        f"\n⚠️ Error: Could not find model files: {e}. "
        "Please check the paths in the script."
    )
    return

View on GitHub (pinned to e006f5f0d5)