qingzhenduyu / ICAL

Official implementation for ICDAR 2024 Oral paper "ICAL: Implicit Character-Aided Learning for Enhanced Handwritten Mathematical Expression Recognition"
16 stars 0 forks source link

Some wrong in vocab #5

Closed JackJi12316 closed 1 month ago

JackJi12316 commented 3 months ago

When I run eval/test.py, it throw the error as (with data of crohme): KeyError: '-'

but in vocab.py, through test, it is nothing wrong, so I modify vocab.py before:

def words2indices(self, words: List[str]) -> List[int]:
        return [self.word2idx[w] for w in words]

after:

    def words2indices(self, words: List[str]) -> List[int]:
        indices = []
        for w in words:
            if w in self.word2idx:
                indices.append(self.word2idx[w])
            elif w == '-':
                indices.append(9) # only corhme
        return indices

And it works. I think there are some thing wrong in vocab, expecally in '-' only.

qingzhenduyu commented 3 months ago

In fact, I haven't met this error ever. Maybe you modified the dictionary in CROHME dataset?