{"record":{"id":"b842619e8bc02347","repo":"roboflow/supervision","slug":"roundness-attribute-must-be-float-between-0-1-0","errorCode":null,"errorMessage":"roundness attribute must be float between (0, 1.0]","messagePattern":"roundness attribute must be float between \\(0, 1\\.0\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/annotators/core.py","lineNumber":2693,"sourceCode":"        roundness: float = 0.6,\n    ):\n        \"\"\"\n        Args:\n            color: The color or color palette to use for\n                annotating detections.\n            thickness: Thickness of the bounding box lines.\n            color_lookup: Strategy for mapping colors to annotations.\n                Options are `INDEX`, `CLASS`, `TRACK`.\n            roundness: Percent of roundness for edges of bounding box.\n                Value must be float 0 < roundness <= 1.0\n                By default roundness percent is calculated based on smaller side\n                length (width or height).\n        \"\"\"\n        self.color: Color | ColorPalette = _normalize_color_input(color)\n        self.thickness: int = thickness\n        self.color_lookup: ColorLookup = color_lookup\n        if not 0 < roundness <= 1.0:\n            raise ValueError(\"roundness attribute must be float between (0, 1.0]\")\n        self.roundness: float = roundness\n\n    @ensure_cv2_image_for_class_method\n    def annotate(\n        self,\n        scene: ImageType,\n        detections: Detections,\n        custom_color_lookup: npt.NDArray[np.int_] | None = None,\n    ) -> ImageType:\n        \"\"\"\n        Annotates the given scene with bounding boxes with rounded edges\n        based on the provided detections.\n\n        Args:\n            scene: The image where rounded bounding boxes will be drawn.\n                `ImageType` is a flexible type, accepting either `numpy.ndarray`\n                or `PIL.Image.Image`.\n            detections: Object detections to annotate.","sourceCodeStart":2675,"sourceCodeEnd":2711,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/annotators/core.py#L2675-L2711","documentation":"Raised by `RoundBoxAnnotator.__init__` when the `roundness` parameter is not in the exclusive-inclusive interval (0, 1.0]. Roundness is the fraction of the smaller box side used for the rounded-corner radius; 0 would give no rounding (use plain BoxAnnotator instead) and values above 1 produce overlapping/invalid arcs.","triggerScenarios":"Calling `sv.RoundBoxAnnotator(roundness=0)`, `roundness=0.0`, `roundness=1.5`, or a negative value; deriving roundness from a percentage without dividing by 100 (e.g. passing 50 for 50%); float configs parsed as 0 due to an empty field.","commonSituations":"Treating roundness as a 0-100 percentage instead of a 0-1 fraction; defaults copied from snippets that used 0 meaning 'square corners'; JSON config with a typo producing 0.0.","solutions":["Use a fraction in (0, 1.0], e.g. `roundness=0.5` for half-round corners or `1.0` for fully rounded.","Divide percentage values by 100 before passing: `roundness=pct / 100`.","If you truly want square corners, use `sv.BoxAnnotator` instead of RoundBoxAnnotator with roundness 0."],"exampleFix":"# before\nannotator = sv.RoundBoxAnnotator(roundness=0)     # ValueError\nannotator = sv.RoundBoxAnnotator(roundness=30)    # meant 30% -> ValueError\n\n# after\nannotator = sv.RoundBoxAnnotator(roundness=0.3)   # 30% rounding","handlingStrategy":"validation","validationCode":"roundness = min(1.0, max(roundness / 100 if roundness > 1 else roundness, 1e-6))\nannotator = sv.RoundBoxAnnotator(roundness=roundness)","typeGuard":"def is_valid_roundness(v) -> bool:\n    return isinstance(v, (int, float)) and 0 < v <= 1.0","tryCatchPattern":null,"preventionTips":["Treat roundness as a 0-1 fraction, not a percentage.","Use sv.BoxAnnotator when you want square corners."],"tags":["annotators","validation","configuration"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}