{"record":{"id":"1dfa5bad0e1f0ef6","repo":"tensorflow/models","slug":"input-directory-not-found-at-input-dir","errorCode":null,"errorMessage":"Input directory not found at '{INPUT_DIR}'","messagePattern":"Input directory not found at '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/src/extract_objects.py","lineNumber":111,"sourceCode":"    Filtered masks and boxes.\n  \"\"\"\n  filtered = [\n      (mask, box)\n      for mask, box in zip(masks, boxes)\n      if (np.sum(mask.astype(np.uint8)) / image_area) * 100 > min_percent\n  ]\n\n  if not filtered:\n    return [], []\n\n  valid_masks, valid_boxes = zip(*filtered)\n  return list(valid_masks), list(valid_boxes)\n\n\ndef main(_) -> None:\n  \"\"\"Runs the main object detection and extraction pipeline.\"\"\"\n  if not os.path.isdir(INPUT_DIR):\n    raise ValueError(f\"Input directory not found at '{INPUT_DIR}'\")\n\n  # Check if COCO output should be created\n  create_coco = FLAGS.category_name is not None\n\n  print(\"Initializing image extraction and classification...\")\n  try:\n    pipeline = detection_segmentation.ObjectDetectionSegmentation(\n        dino_config_path=GROUNDING_DINO_CONFIG,\n        dino_weights_path=GROUNDING_DINO_WEIGHTS,\n        sam_config_path=SAM2_CONFIG,\n        sam_checkpoint_path=SAM2_WEIGHTS,\n    )\n  except FileNotFoundError as e:\n    print(\n        f\"\\n⚠️ Error: Could not find model files: {e}. \"\n        \"Please check the paths in the script.\"\n    )\n    return","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/src/extract_objects.py#L93-L129","documentation":"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.","triggerScenarios":"Thrown at official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/src/extract_objects.py:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify INPUT_DIR (flags or module constant) points to the existing images directory","Download or copy the input images to the expected location","Fix typos or use absolute paths; ensure it is a directory, not a single file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}