tensorflow/models · error · ValueError
Unknown crop variant: {variant!r}
Error message
Unknown crop variant: {variant!r} What it means
Error "Unknown crop variant: {variant!r}" thrown in tensorflow/models.
Source
Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:285
Returns:
A PIL image for the requested variant, or ``None`` for degenerate
boxes in the ``'raw'`` variant.
Raises:
ValueError: If ``variant`` is not one of the allowed values.
"""
if variant == _RAW_VARIANT:
return sam3_inference_utils.crop_raw_masked_image(image_array, mask, box)
if variant == _BLACK_BACKGROUND_VARIANT:
return sam3_inference_utils.crop_masked_image(
image_array, mask, box, size=crop_size
)
if variant == _IMAGENET_MEAN_BACKGROUND_VARIANT:
return sam3_inference_utils.crop_with_mean_background_blend(
image_array, mask, box, size=crop_size
)
raise ValueError(f"Unknown crop variant: {variant!r}")
def generate_selected_crops(
image: Image.Image,
state: dict[str, Any],
score_threshold: float,
crop_size: tuple[int, int],
variants: tuple[str, ...],
) -> list[tuple[int, dict[str, Any]]]:
"""Generates only the crop variants requested in ``variants``.
Skips the work of building unused crop variants. Mask hole-filling is
performed once per detection and reused across variants.
Args:
image: Input RGB PIL image.
state: SAM output dict with ``'masks'``, ``'boxes'``, ``'scores'`` keys.
score_threshold: Minimum confidence score to include a detection.View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:285 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/58bca88c9b575b85.
Report an issue: GitHub.