{"record":{"id":"3926cba7c25f16d7","repo":"open-mmlab/mmdetection","slug":"the-unexpected-output-indicates-an-issue-with-name-3926cb","errorCode":null,"errorMessage":"The unexpected output indicates an issue with named entity recognition. You can try setting custom_entities=True and running again to see if it helps.","messagePattern":"The unexpected output indicates an issue with named entity recognition\\. You can try setting custom_entities=True and running again to see if it helps\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/detectors/grounding_dino.py","lineNumber":610,"sourceCode":"                data_samples.token_positive_map = token_positive_maps[i]\n\n            head_inputs_dict = self.forward_transformer(\n                visual_feats, text_dict, batch_data_samples)\n            results_list = self.bbox_head.predict(\n                **head_inputs_dict,\n                rescale=rescale,\n                batch_data_samples=batch_data_samples)\n\n        for data_sample, pred_instances, entity, is_rec_task in zip(\n                batch_data_samples, results_list, entities, is_rec_tasks):\n            if len(pred_instances) > 0:\n                label_names = []\n                for labels in pred_instances.labels:\n                    if is_rec_task:\n                        label_names.append(entity)\n                        continue\n                    if labels >= len(entity):\n                        warnings.warn(\n                            'The unexpected output indicates an issue with '\n                            'named entity recognition. You can try '\n                            'setting custom_entities=True and running '\n                            'again to see if it helps.')\n                        label_names.append('unobject')\n                    else:\n                        label_names.append(entity[labels])\n                # for visualization\n                pred_instances.label_names = label_names\n            data_sample.pred_instances = pred_instances\n        return batch_data_samples\n","sourceCodeStart":592,"sourceCodeEnd":622,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/detectors/grounding_dino.py#L592-L622","documentation":"Grounding DINO predict found predicted label indices >= len(entity): the NER-parsed entity list doesn't cover all class slots, so a prediction can't be mapped to a name and is labeled 'unobject'.","triggerScenarios":"Predicting with a caption where entity parsing yields fewer entities than the positive map implies (re-caption task skips this; recognition task hits it).","commonSituations":"Free-form captions with unusual punctuation; captions not following the 'phrase . phrase .' convention.","solutions":["Use custom_entities=True with an explicit entity list","Rewrite the caption as period-separated phrases"],"exampleFix":"# before\nresults = detector(inputs, texts=['red car and blue bus on street'])\n# after\nresults = detector(inputs, texts=['red car . blue bus .'], custom_entities=True)","handlingStrategy":"validation","validationCode":"entities = [e for e in my_categories]  # explicit list\ncaption = ' . '.join(my_categories)\nresults = detector(inputs, texts=[caption], custom_entities=True)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid free-form captions for grounding; use explicit entity lists","Validate len(entities) covers expected class indices before predict"],"tags":["mmdet","grounding-dino","ner","grounding"],"backgroundTag":"entity-label-mismatch","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}