labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

Overwriting the classes.txt file caused an `IndexError: list index out of range` error

Open Olalaye opened this issue 3 years ago • 2 comments

I encountered a flashback while restarting Labellimg to continue annotating the data.

Screenshot from 2021-04-21 11-48-55

Screenshot from 2021-04-21 11-49-05

I noticed that this was caused by the classes.txt file being overwritten by labelImg.

Repetition: Prepare two images, the first one labeled as Category A and the second one labeled as Category B, save and restart the labelImg, modify the first image, save and enter the second image, at this time the labelImg will be killed.

After the first annotation, look at the classes.txt file. There are two categories.After restart labelImg, modify and save, and check again, only category A is left.Labelimg could not find category B for the second image, so an error was reported.

  • OS:Ubuntu
  • PyQt version:1.8.4

Olalaye avatar Apr 21 '21 04:04 Olalaye

As mentioned in official document, plz change directory to your image folder, and create a folder named "data", then create a predefined_classes.txt in the data folder. (If you have old labels, put them into data folder) After doing that, use this command "labelImg . ./data/predefined_classes.txt" Everything will be OK.

kuonumber avatar Nov 24 '21 02:11 kuonumber

I install the repo as the docs, then not only I have to modify the data/predefined_classes.txt but also create a classes.txt in the target image folder, otherwise annoying errors occur 😑

bonniss avatar Nov 30 '21 04:11 bonniss