#1133·rf-detr

Proposal: Gather exceptions and name them

Author: hinogiCreated Jun 19, 2026Updated Aug 26, 2026
Labelsenhancement

Since there are quiet a lot of ValueError exceptions going on it would be a good way to gather them into their own module and give them meaningful names that make the code more readable and shows more intention.

python
if not keypoint_cat_ids:
        raise ValueError(
            "Keypoint COCO dataset has no keypoint category metadata and no keypoint annotations. "
            "Expected COCO categories with a 'keypoints' field or annotations with 'keypoints'/'num_keypoints'."
        )
    if len(keypoint_cat_ids) > len(active_slots):
        raise ValueError(
            "Keypoint COCO dataset has more keypoint-bearing categories "
            f"({len(keypoint_cat_ids)}) than active schema slots ({len(active_slots)}). "
            "Multi-class keypoint training needs an explicit num_keypoints_per_class schema."
        )

maybe this could be turned into some custom errors like

python
class MissingKeypointMetadataError(ValueError):
    pass

class TooManyKeypointCategoriesError(ValueError):
    pass

or even move the error messages into the class and extend the constructor to accept arguments for the output of the message.