Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in train.py #177

Closed
JerryZhuzq opened this issue May 16, 2019 · 9 comments
Closed

Problem in train.py #177

JerryZhuzq opened this issue May 16, 2019 · 9 comments

Comments

@JerryZhuzq
Copy link

Computing AP:   4%|██▉                                                                  | 1/24 [00:00<00:03,  6.08it/Computing AP:  12%|████████▋                                                            | 3/24 [00:00<00:03,  6Computing AP:  25%|█████████████████▎                                                   | 6/24 [00:00<Computing AP:  46%|███████████████████████████████▏                                    |Computing AP:  58%|███████████████████████████████████████▋                     Computing AP:  96%|██████████████████████████████████████████████████ Computing AP: 100%|██████████████████████████████████████████████████ ██████████████████| 24/24 [00:00<00:00, 25.96it/s]
Traceback (most recent call last):
  File "train.py", line 173, in <module>
    ap_table += [[c, class_names[c], "%.5f" % AP[i]]]
IndexError: list index out of range

Print class APs and mAP

ap_table = [["Index", "Class name", "AP"]]
for i, c in enumerate(ap_class):
ap_table += [[c, class_names[c], "%.5f" % AP[i]]]
print(AsciiTable(ap_table).table)
print(f"---- mAP {AP.mean()}")

This module might have some problems in my custom training, do you know what happened?

@SirongHuang
Copy link

I have the same problem!

@SirongHuang
Copy link

SirongHuang commented May 16, 2019

I found the solution! In your custom class name file (/data/custom/classes.names), you need to leave an empty line at the end.

Because in utils/utils.py, the function "load_classes" parses the name file like this: [:-1], which ends up only selecting the first n-1 names in the file if u don't leave an empty line at the end.

If you look at the coco dataset name file, you'll find that empty line in the end as well. (data/coco.names)

I tried removing the empty line and change the [:-1] to [:], but somehow the evaluation gets stuck and not working. It's really weird. But anyways, it should be working with this fix.

@ndlinh301
Copy link

I found the solution! In your custom class name file (/data/custom/classes.names), you need to leave an empty line at the end.

Because in utils/utils.py, the function "load_classes" parses the name file like this: [:-1], which ends up only selecting the first n-1 names in the file if u don't leave an empty line at the end.

If you look at the coco dataset name file, you'll find that empty line in the end as well. (data/coco.names)

I tried removing the empty line and change the [:-1] to [:], but somehow the evaluation gets stuck and not working. It's really weird. But anyways, it should be working with this fix.

I followed your guide and succeeded. Thank you so much.

@Darshan2701
Copy link

@SirongHuang Awesome. Thanks .:)

@H-YunHui
Copy link

SirongHuang
Awesome. Thanks

@zxealous
Copy link

SirongHuang
Awesome. Thanks

@chenshuiyan
Copy link

SirongHuang
Awesome.Thanks

@hoenza
Copy link

hoenza commented Aug 5, 2020

Awsome, Thanks

@Flova
Copy link
Collaborator

Flova commented Feb 2, 2021

Is this issue still relevant/occurring?

I closed this issue due to inactivity. Feel free to reopen for further discussion.

@Flova Flova closed this as completed Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants