{"record":{"id":"c31b15e089053770","repo":"open-mmlab/mmdetection","slug":"no-sample-in-split-self-split","errorCode":null,"errorMessage":"No sample in split \"{self.split}\".","messagePattern":"No sample in split \"(.+?)\"\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/refcoco.py","lineNumber":161,"sourceCode":"                    text = texts\n                else:\n                    raise ValueError(f'Invalid text mode \"{self.text_mode}\".')\n                ins = [{\n                    'mask': grounding_anno['segmentation'],\n                    'ignore_flag': 0\n                }] * len(text)\n                instances.extend(ins)\n                sentences.extend(text)\n            data_info = {\n                'img_path': join_path(img_prefix, image['file_name']),\n                'img_id': img_id,\n                'instances': instances,\n                'text': sentences\n            }\n            data_list.append(data_info)\n\n        if len(data_list) == 0:\n            raise ValueError(f'No sample in split \"{self.split}\".')\n\n        return data_list\n","sourceCodeStart":143,"sourceCodeEnd":164,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/refcoco.py#L143-L164","documentation":"After loading all annotations for the requested split, RefCoco found zero samples, meaning no referring expressions matched the split name. This is raised at the end of load_data_list when the resulting data_list is empty, so dataset construction fails before training.","triggerScenarios":"Passing a split that does not exist for the chosen RefCoco variant (e.g. split='testA' for RefCocoReferring which only has train/val, or split='val' for a dataset whose pickle only contains train), or a data_prefix/ann_file pointing at the wrong pickle file.","commonSituations":"Mixing up RefCoco/RefCocoPlus/RefCocoReferring dataset pickles (refs(unc).p vs instances BIN files), using split names from a different variant's config, or downloading a partial annotation set. The split string is also case-sensitive ('train' vs 'Train').","solutions":["Check the *refs*.p pickle with pickle/Python to list the available splits and use one of them (e.g. 'train', 'val', 'testA', 'testB' for RefCoco)","Make sure ann_file points at the refs pickle matching your dataset class (RefCoco vs RefCocoPlus vs RefCocoReferring have different files)","Match the split name to the official split used when the pickle was generated; re-download the correct annotations if the pickle is for a different dataset"],"exampleFix":"# before\ndataset = dict(type='RefCoco', ann_file='instances_refs(unc).p', split='test')  # no such split in RefCoco\n# after\ndataset = dict(type='RefCoco', ann_file='instances_refs(unc).p', split='testA')","handlingStrategy":"validation","validationCode":"import pickle\nrefs = pickle.load(open(ann_file, 'rb'))\nsplits = {r['split'] for r in refs}\nassert split in splits, f'split {split!r} not in available splits: {splits}'\ndataset = RefCoco(ann_file=ann_file, split=split, ...)","typeGuard":null,"tryCatchPattern":"try:\n    dataset = RefCoco(ann_file=ann_file, split=split, data_prefix=data_prefix)\nexcept ValueError as e:\n    if 'No sample in split' in str(e):\n        raise SystemExit(f'split {split!r} empty; available: {available_splits()}') from e\n    raise","preventionTips":["Inspect the refs pickle once to enumerate valid splits before wiring configs","Use the exact split names of the RefCoco variant you configured (testA/testB only exist for detection-style splits)"],"tags":["mmdet","refcoco","empty-dataset","split","annotations"],"backgroundTag":"empty-dataset-split","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}