{"record":{"id":"da78b84086ba486a","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"unknown-iou-type-da78b8","errorCode":null,"errorMessage":"Unknown iou type {}","messagePattern":"Unknown iou type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pytorch_object_detection/retinaNet/train_utils/coco_eval.py","lineNumber":66,"sourceCode":"\n    def accumulate(self):\n        for coco_eval in self.coco_eval.values():\n            coco_eval.accumulate()\n\n    def summarize(self):\n        for iou_type, coco_eval in self.coco_eval.items():\n            print(\"IoU metric: {}\".format(iou_type))\n            coco_eval.summarize()\n\n    def prepare(self, predictions, iou_type):\n        if iou_type == \"bbox\":\n            return self.prepare_for_coco_detection(predictions)\n        elif iou_type == \"segm\":\n            return self.prepare_for_coco_segmentation(predictions)\n        elif iou_type == \"keypoints\":\n            return self.prepare_for_coco_keypoint(predictions)\n        else:\n            raise ValueError(\"Unknown iou type {}\".format(iou_type))\n\n    def prepare_for_coco_detection(self, predictions):\n        coco_results = []\n        for original_id, prediction in predictions.items():\n            if len(prediction) == 0:\n                continue\n\n            boxes = prediction[\"boxes\"]\n            boxes = convert_to_xywh(boxes).tolist()\n            scores = prediction[\"scores\"].tolist()\n            labels = prediction[\"labels\"].tolist()\n\n            coco_results.extend(\n                [\n                    {\n                        \"image_id\": original_id,\n                        \"category_id\": labels[k],\n                        \"bbox\": box,","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/1ec3fe6f374fc9969973a61f819de25658595afa/pytorch_object_detection/retinaNet/train_utils/coco_eval.py#L48-L84","documentation":"COCO results preparation in coco_eval.py dispatches on the iou_type of the COCO evaluator (bbox/segm/keypoints). If the evaluator's iou_type is any other string, prepare() raises ValueError. Detection-only RetinaNet training normally uses 'bbox', so this indicates a misconfigured evaluator.","triggerScenarios":"Constructing a CocoEvaluator whose base coco_evaluator has iouType set to something other than 'bbox', 'segm', or 'keypoints', then calling update() which invokes prepare().","commonSituations":"Copying evaluation code for instance segmentation and setting iouType='stuff' or leaving a typo in iouType; mixing evaluation classes from other repos.","solutions":["Check the iouType on the base COCO evaluator before wrapping it in CocoEvaluator; use 'bbox' for detection","Pass the base coco_evaluator only after it was created with COCO(..., ) and evaluate(imgs) with iouType='bbox'","Add a guard that only builds CocoEvaluator when iou_type in ('bbox','segm','keypoints')"],"exampleFix":"// before\ncoco_evaluator = COCO(...)\ncoco_evaluator.params.iouType = 'stuff'\n// after\ncoco_evaluator.params.iouType = 'bbox'\ncoco_evaluator = CocoEvaluator(coco_evaluator, iou_types=['bbox'])","handlingStrategy":"validation","validationCode":"iou_type = coco_evaluator.coco_eval['bbox'].params.iouType if 'bbox' in coco_evaluator.coco_eval else 'unknown'\nassert iou_type in ('bbox', 'segm', 'keypoints'), f'unsupported iouType: {iou_type}'","typeGuard":"def has_supported_iou_type(evaluator) -> bool:\n    return getattr(getattr(evaluator, 'params', None), 'iouType', None) in ('bbox', 'segm', 'keypoints')","tryCatchPattern":"try:\n    coco_evaluator.update(predictions)\nexcept ValueError as e:\n    print(f'iouType misconfigured: {e}; defaulting to bbox')","preventionTips":["Never modify params.iouType after creating the evaluator","Only wrap evaluators created with standard iouTypes","Pin to this repo's CocoEvaluator API expectations (bbox for detection)"],"tags":["coco","evaluation","valueerror","config"],"backgroundTag":"unsupported-evaluator-type","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}