{"record":{"id":"dfe07ddd29684999","repo":"lllyasviel/ControlNet","slug":"resize-method-self-resize-method-not-implement","errorCode":null,"errorMessage":"resize_method {self.__resize_method} not implemented","messagePattern":"resize_method (.+?) not implemented","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"annotator/midas/midas/transforms.py","lineNumber":136,"sourceCode":"                    scale_width = scale_height\n            elif self.__resize_method == \"upper_bound\":\n                # scale such that output size is upper bound\n                if scale_width < scale_height:\n                    # fit width\n                    scale_height = scale_width\n                else:\n                    # fit height\n                    scale_width = scale_height\n            elif self.__resize_method == \"minimal\":\n                # scale as least as possbile\n                if abs(1 - scale_width) < abs(1 - scale_height):\n                    # fit width\n                    scale_height = scale_width\n                else:\n                    # fit height\n                    scale_width = scale_height\n            else:\n                raise ValueError(\n                    f\"resize_method {self.__resize_method} not implemented\"\n                )\n\n        if self.__resize_method == \"lower_bound\":\n            new_height = self.constrain_to_multiple_of(\n                scale_height * height, min_val=self.__height\n            )\n            new_width = self.constrain_to_multiple_of(\n                scale_width * width, min_val=self.__width\n            )\n        elif self.__resize_method == \"upper_bound\":\n            new_height = self.constrain_to_multiple_of(\n                scale_height * height, max_val=self.__height\n            )\n            new_width = self.constrain_to_multiple_of(\n                scale_width * width, max_val=self.__width\n            )\n        elif self.__resize_method == \"minimal\":","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/lllyasviel/ControlNet/blob/ed85cd1e25a5ed592f7d8178495b4483de0331bf/annotator/midas/midas/transforms.py#L118-L154","documentation":"Raised by MiDaS Resize transform's get_size when the resize_method string is not one of the supported values. The transform computes new image size based on the configured strategy; an unknown strategy string falls through to this ValueError. Supported methods include upper_bound, lower_bound, and minimal.","triggerScenarios":"Instantiating annotator.midas.midas.transforms.Resize with resize_method set to a typo or unsupported string (e.g. 'Upper_bound', 'fit', 'crop'), then calling the transform on a sample (__call__ -> get_size).","commonSituations":"Copying a config from another repo/version where resize method names differ; typos in YAML/JSON config; custom forks adding methods not present in this copy of midas/transforms.py.","solutions":["Set resize_method to one of the supported strings: 'upper_bound', 'lower_bound', or 'minimal'","Check the exact casing in your config file / constructor call against the midas transforms source","If you need a custom method, subclass Resize and extend get_size instead of passing an unknown string"],"exampleFix":"# before\nResize(384, 384, resize_method='UpperBound')\n# after\nResize(384, 384, resize_method='upper_bound')","handlingStrategy":"validation","validationCode":"ALLOWED = {'upper_bound', 'lower_bound', 'minimal'}\nassert resize_method in ALLOWED, f'resize_method must be one of {ALLOWED}'","typeGuard":"def is_valid_resize_method(m: str) -> bool:\n    return isinstance(m, str) and m in {'upper_bound', 'lower_bound', 'minimal'}","tryCatchPattern":null,"preventionTips":["Define resize_method constants once and reuse them","Validate config values at load time, not at transform call time"],"tags":["midas","resize","config","value-error"],"backgroundTag":"invalid-config-value","analyzedSha":"ed85cd1e25a5ed592f7d8178495b4483de0331bf","analyzedAt":"2026-08-27T12:58:54.167Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}