{"record":{"id":"3ce2ab645faf3539","repo":"open-mmlab/mmdetection","slug":"the-unexpected-output-indicates-an-issue-with-name","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/glip.py","lineNumber":579,"sourceCode":"        else:\n            language_dict_features = self.language_model(list(text_prompts))\n\n            for i, data_samples in enumerate(batch_data_samples):\n                data_samples.token_positive_map = token_positive_maps[i]\n\n            results_list = self.bbox_head.predict(\n                visual_features,\n                language_dict_features,\n                batch_data_samples,\n                rescale=rescale)\n\n        for data_sample, pred_instances, entity in zip(batch_data_samples,\n                                                       results_list, entities):\n            if len(pred_instances) > 0:\n                label_names = []\n                for labels in pred_instances.labels:\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":561,"sourceCodeEnd":591,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/detectors/glip.py#L561-L591","documentation":"During GLIP predict, a predicted label index is >= the number of parsed entities, meaning the label-to-entity mapping from named entity recognition (NER) is inconsistent with the detector's class outputs. The unmatched label is named 'unobject'.","triggerScenarios":"Predicting with a caption whose NER-parsed entity list is shorter than the positive map classes — often with punctuation-heavy or oddly formatted captions.","commonSituations":"Zero-shot grounding with free-form captions; captions where spaCy NER mis-splits phrases.","solutions":["Set custom_entities=True and pass an explicit entity list matching your categories","Format the caption as period-separated phrases ('person . dog .') which GLIP parses reliably"],"exampleFix":"# before\nresults = glip_detector(inputs, texts=['a person walking a dog'])\n# after\nresults = glip_detector(inputs, texts=['person . dog .'], custom_entities=True)","handlingStrategy":"validation","validationCode":"_, _, _, entities = detector.get_tokens_and_prompts(caption, custom_entities=True)\nassert entities and len(entities) >= 1\n# pass custom_entities=True with an explicit list matching categories","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use custom_entities=True with explicit entity lists in production","Format captions as 'phrase . phrase .'"],"tags":["mmdet","glip","ner","grounding"],"backgroundTag":"entity-label-mismatch","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}