text-detection-fots.pytorch icon indicating copy to clipboard operation
text-detection-fots.pytorch copied to clipboard

CANNOT FIND ANYTHING IN MATCHES IN LINE NUMBER 168 OF DATASETS.PY

Open chakrabortyrajatsubhra opened this issue 4 years ago • 3 comments

matches = self.pattern.findall(line)[0] IndexError: list index out of range

THIS IS THE ERROR I AM GETTING WHILE TRAINING THE MODEL-- I HAVE TRIED TO PRINT WHAT GOES INSIDE MATCHES AND IT IS PRINTING MATCHES[] MEANING MATCHES IS EMPTY. CAN YOU TELL ME --- A) WHAT IS THE ROLE OF MATCHES IN THE CODE? B) I HAVE FOLLOWED ALL THE STEPS ACCORDING TO THE INSTRUCTIONS STILL I AM GETTING AN INDEX ERROR WHY?

YOUR HELP WOULD MEAN A LOT TO ME.

chakrabortyrajatsubhra avatar Aug 18 '20 07:08 chakrabortyrajatsubhra

A) matches = self.pattern.findall(line)[0] parses a given line to extract coordinates of text and text label from a ground truth file. B) The error may occur if the line is empty or doesn't follow an expected pattern (which is 8 numbers and text label separated by , according to self.pattern = re.compile('^' + '(\\d+),' * 8 + '(.+)$')).

My suggestion is to check what line has when the error happens and verify if it matches to one of lines in the corresponding ground truth file.

Wovchena avatar Aug 18 '20 09:08 Wovchena

checked out the ground truth turns out that the format was wrong there and corrrected it but after running it half way i am getting this new error -- "operands could not be broadcast together with shapes (0,) (2,) (0,)".

chakrabortyrajatsubhra avatar Aug 18 '20 22:08 chakrabortyrajatsubhra

Shape of (0,) means there is a one dimensional empty array. Such arrays shouldn't appear. You should figure out where that array comes from and handle it.

Wovchena avatar Aug 19 '20 06:08 Wovchena