{"record":{"id":"e1437d1fbdf3dba0","repo":"huggingface/pytorch-image-models","slug":"final-scale-range-values-should-ideally-be-between","errorCode":null,"errorMessage":"final_scale_range values should ideally be between 0.0 and 1.0.","messagePattern":"final_scale_range values should ideally be between 0\\.0 and 1\\.0\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"timm/data/naflex_transforms.py","lineNumber":584,"sourceCode":"        if isinstance(interpolation, str):\n            if interpolation == 'random':\n                self.interpolation = _RANDOM_INTERPOLATION\n            else:\n                self.interpolation = str_to_interp_mode(interpolation)\n        else:\n            self.interpolation = interpolation\n\n        # Validate scale and ratio\n        self.scale = _validate_range(self.scale, \"scale\")\n        self.ratio = _validate_range(self.ratio, \"ratio\")\n\n        # Validate final_scale_range if provided\n        if self.final_scale_range is not None:\n            self.final_scale_range = _validate_range(self.final_scale_range, \"final_scale_range\")\n\n            # Additional validation for final_scale_range values\n            if not (0.0 <= self.final_scale_range[0] <= self.final_scale_range[1] <= 1.0):\n                warnings.warn(\"final_scale_range values should ideally be between 0.0 and 1.0.\")\n\n    @staticmethod\n    def get_params(\n            img: torch.Tensor,\n            scale: Tuple[float, float],\n            ratio: Tuple[float, float],\n            crop_attempts: int = 10,\n            patch_h: int = 16,\n            patch_w: int = 16,\n            max_seq_len: int = 1024,\n            divisible_by_patch: bool = True,\n            max_ratio: Optional[float] = None,\n            final_scale_range: Optional[Tuple[float, float]] = None,\n            interpolation: Union[List[InterpolationMode], InterpolationMode] = _RANDOM_INTERPOLATION,\n    ) -> Tuple[Tuple[int, int, int, int], Tuple[int, int], InterpolationMode]:\n        \"\"\" Get parameters for a random sized crop relative to image aspect ratio.\n        \"\"\"\n        _, height, width = F.get_dimensions(img)","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/data/naflex_transforms.py#L566-L602","documentation":"After validating ordering, RandomResizedCropToSequence checks that final_scale_range lies within [0.0, 1.0]. A warning (no error) means values fall outside, e.g. (1.0, 1.5), which can produce upsampling or crops larger than the source image during final-scale randomization.","triggerScenarios":"Passing final_scale_range=(1.0, 1.33) for a mild zoom-out augmentation; mixing up scale semantics from RandomResizedCrop's area-scale (which is also <=1 in timm's impl).","commonSituations":"Configs tuned for torchvision RandomResizedCrop where scale > 1 sometimes appears; intending 'zoom' ranges. Crops may still be clamped by downstream max_seq_len logic, but results can be unexpected.","solutions":["Keep final_scale_range within (0, 1], e.g. (0.8, 1.0)","If you truly need upsampling, verify output behavior and suppress the warning deliberately","Re-read the transform docstring for the intended scale semantics"],"exampleFix":"# before\ntfm = RandomResizedCropToSequence(..., final_scale_range=(1.0, 1.33))\n# after\ntfm = RandomResizedCropToSequence(..., final_scale_range=(0.75, 1.0))","handlingStrategy":"validation","validationCode":"lo, hi = final_scale_range\\nassert 0.0 <= lo <= hi <= 1.0, 'final_scale_range should be within [0, 1]'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the transform docstring for scale semantics before tuning","Keep augmentation scales <= 1.0 unless upsampling is verified"],"tags":["naflex","transforms","scale-range","timm"],"backgroundTag":"value-out-of-expected-range","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}