lvis-dataset / lvis-api

Python API for LVIS Dataset
http://lvisdataset.org
Other
409 stars 63 forks source link

stop_sign.n.01 key error #3

Closed tonysy closed 5 years ago

tonysy commented 5 years ago

Hi, I use the nltk.wordnet to get the sysnet 'stop_sign.n.01', but get the following error:

>>from nltk.corpus import wordnet as wn
>>wn.synset('stop_sign.n.01')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/miniconda3/lib/python3.7/site-packages/nltk/corpus/reader/wordnet.py in synset(self, name)
   1333         try:
-> 1334             offset = self._lemma_pos_offset_map[lemma][pos][synset_index]
   1335         except KeyError:

KeyError: 'n'

During handling of the above exception, another exception occurred:

WordNetError                              Traceback (most recent call last)
<ipython-input-53-b431537ed60c> in <module>
----> 1 wn.synset('stop_sign.n.01')

~/miniconda3/lib/python3.7/site-packages/nltk/corpus/reader/wordnet.py in synset(self, name)
   1335         except KeyError:
   1336             message = 'no lemma %r with part of speech %r'
-> 1337             raise WordNetError(message % (lemma, pos))
   1338         except IndexError:
   1339             n_senses = len(self._lemma_pos_offset_map[lemma][pos])

WordNetError: no lemma 'stop_sign' with part of speech 'n'

would you like to give some solutions? which version of wordnet do you use? Thanks

agrimgupta92 commented 5 years ago

stop_sign.n.01 is actually not a wordnet synset. Stop sign was added to maintain backward compatibility with COCO 80 categories.

rbgirshick commented 5 years ago

We found wordnet to be helpful in constructing LVIS, but also somewhat limiting in a few quirky ways (e.g., in the case of stop sign). We didn't want to limit ourselves and therefore made some modifications (e.g., adding synsets, changing definitions). In the v1.0 release we may remove the synset information from the annotations file to prevent this from confusing people.

tonysy commented 5 years ago

Thanks for your reply.