{"record":{"id":"58bca88c9b575b85","repo":"tensorflow/models","slug":"unknown-crop-variant-variant-r","errorCode":null,"errorMessage":"Unknown crop variant: {variant!r}","messagePattern":"Unknown crop variant: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py","lineNumber":285,"sourceCode":"\n  Returns:\n      A PIL image for the requested variant, or ``None`` for degenerate\n      boxes in the ``'raw'`` variant.\n\n  Raises:\n      ValueError: If ``variant`` is not one of the allowed values.\n  \"\"\"\n  if variant == _RAW_VARIANT:\n    return sam3_inference_utils.crop_raw_masked_image(image_array, mask, box)\n  if variant == _BLACK_BACKGROUND_VARIANT:\n    return sam3_inference_utils.crop_masked_image(\n        image_array, mask, box, size=crop_size\n    )\n  if variant == _IMAGENET_MEAN_BACKGROUND_VARIANT:\n    return sam3_inference_utils.crop_with_mean_background_blend(\n        image_array, mask, box, size=crop_size\n    )\n  raise ValueError(f\"Unknown crop variant: {variant!r}\")\n\n\ndef generate_selected_crops(\n    image: Image.Image,\n    state: dict[str, Any],\n    score_threshold: float,\n    crop_size: tuple[int, int],\n    variants: tuple[str, ...],\n) -> list[tuple[int, dict[str, Any]]]:\n  \"\"\"Generates only the crop variants requested in ``variants``.\n\n  Skips the work of building unused crop variants. Mask hole-filling is\n  performed once per detection and reused across variants.\n\n  Args:\n      image: Input RGB PIL image.\n      state: SAM output dict with ``'masks'``, ``'boxes'``, ``'scores'`` keys.\n      score_threshold: Minimum confidence score to include a detection.","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py#L267-L303","documentation":"Raised when building crops with an unrecognized crop variant name (not raw, black_background, or imagenet_mean_background).","triggerScenarios":"Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:285 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported variant names: raw, black_background, imagenet_mean_background.","Ensure crop_variants in the config only lists allowed names (config_loader validates this upstream).","Check for typos if variants were added programmatically."],"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"}