Pytorch-yolov3: About a line in train.py: ap_table += [[c, class_names[c], "%.5f" % AP[i]]]

Created on 1 Feb 2020  ·  5Comments  ·  Source: eriklindernoren/PyTorch-YOLOv3

I use the DOTA dataset (15 classes)
when i run train.py, appear

Traceback (most recent call last):
File "train.py", line 176, in
ap_table += [[c, class_names[c], "%.5f" % AP[i]]]
IndexError: list index out of range

Why is that?
Thank U

Most helpful comment

solved. Because the last line of the names file is missing a newline.
Thank you

All 5 comments

solved. Because the last line of the names file is missing a newline.
Thank you

@Adoreee Hello, I have the same problem but I don't know what you mean?How exactly did you change it?thanks!

@Adoreee Hello, I have the same problem but I don't know what you mean?How exactly did you change it?thanks!

Add a "\n" to the last line of *.names

@Adoreee Thank you very much!

add check code can solve?

            if c < len(class_names):
                ap_table += [[c, class_names[c], "%.5f" % AP[i]]]
            else:
                print("!!! invalid class index:", c)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexandru-dinu picture alexandru-dinu  ·  3Comments

hezhangubc picture hezhangubc  ·  4Comments

monteksingh picture monteksingh  ·  3Comments

FanLu1994 picture FanLu1994  ·  3Comments

mwharton3 picture mwharton3  ·  3Comments