{"record":{"id":"42fa17813321181b","repo":"open-mmlab/mmdetection","slug":"the-annotation-file-of-open-images-challenge-shoul","errorCode":null,"errorMessage":"The annotation file of Open Images Challenge should be a txt file.","messagePattern":"The annotation file of Open Images Challenge should be a txt file\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/openimages.py","lineNumber":311,"sourceCode":"            self.hierarchy_file = osp.join(self.data_root, self.hierarchy_file)\n        if self.image_level_ann_file and not is_abs(self.image_level_ann_file):\n            self.image_level_ann_file = osp.join(self.data_root,\n                                                 self.image_level_ann_file)\n\n\n@DATASETS.register_module()\nclass OpenImagesChallengeDataset(OpenImagesDataset):\n    \"\"\"Open Images Challenge dataset for detection.\n\n    Args:\n        ann_file (str): Open Images Challenge box annotation in txt format.\n    \"\"\"\n\n    METAINFO: dict = dict(dataset_type='oid_challenge')\n\n    def __init__(self, ann_file: str, **kwargs) -> None:\n        if not ann_file.endswith('txt'):\n            raise TypeError('The annotation file of Open Images Challenge '\n                            'should be a txt file.')\n\n        super().__init__(ann_file=ann_file, **kwargs)\n\n    def load_data_list(self) -> List[dict]:\n        \"\"\"Load annotations from an annotation file named as ``self.ann_file``\n\n        Returns:\n            List[dict]: A list of annotation.\n        \"\"\"\n        classes_names, label_id_mapping = self._parse_label_file(\n            self.label_file)\n        self._metainfo['classes'] = classes_names\n        self.label_id_mapping = label_id_mapping\n\n        if self.image_level_ann_file is not None:\n            img_level_anns = self._parse_img_level_ann(\n                self.image_level_ann_file)","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/openimages.py#L293-L329","documentation":"OpenImagesChallenge dataset in mmdet requires the annotation file to be a .txt file (the Challenge subset ships CSV-like txt annotation files, unlike the standard Open Images which uses a CSV). The constructor checks the file extension and raises TypeError immediately before loading anything, so no data is read from a wrongly named/typed file.","triggerScenarios":"Instantiating OpenImagesChallengeDataset (or building a train_dataloader around it in a config) with ann_file that does not end with 'txt', e.g. pointing at a .csv/.json annotation file or a path missing the extension.","commonSituations":"Copying a config from the regular Open Images (csv) dataset, or renaming/moving annotation files so the .txt suffix is lost; also passing a URL or variable path without extension. Windows paths or hidden trailing characters can also defeat endswith('txt').","solutions":["Point ann_file at the Open Images Challenge annotation txt file (e.g. challenge2018_train_bbox.csv is actually txt-named in mmdet splits — use the file provided by the dataset preparation script, ending in .txt)","If your annotations are genuinely in CSV format, use mmdet.datasets.OpenImagesDataset instead of the Challenge variant","Rename your annotation file to have a .txt extension if the content is already the challenge txt format","Verify the path: print ann_file and confirm it ends with 'txt' before constructing the dataset"],"exampleFix":"# before\ndataset = dict(type='OpenImagesChallengeDataset', ann_file='annotations/challenge2018_train_bbox.csv')\n# after\ndataset = dict(type='OpenImagesChallengeDataset', ann_file='annotations/challenge2018_train_bbox.txt')","handlingStrategy":"validation","validationCode":"ann_file = 'annotations/challenge2018_train_bbox.txt'\nassert ann_file.endswith('txt'), 'OpenImagesChallenge annotation must be a .txt file'\ndataset = OpenImagesChallengeDataset(ann_file=ann_file, data_prefix=dict(img='img/'))","typeGuard":"def is_valid_oid_ann_file(path: str) -> bool:\n    return isinstance(path, str) and path.endswith('txt') and os.path.isfile(path)","tryCatchPattern":null,"preventionTips":["Name Open Images Challenge annotation files with the .txt extension produced by the official preparation scripts","When migrating configs between OpenImagesDataset and OpenImagesChallengeDataset, re-check the ann_file extension"],"tags":["mmdet","dataset","annotation-file","file-extension","open-images"],"backgroundTag":"invalid-argument-value","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}