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

ZeroDivisionError: division by zero after running gtf.Evaluate() #86

Open
vidyap-xgboost opened this issue Jul 19, 2020 · 2 comments
Open

Comments

@vidyap-xgboost
Copy link
Contributor

I ran:

# Run validation
accuracy, class_based_accuracy = gtf.Evaluate();

and got the below result + ZeroDivisionError.

    Result
        class based accuracies
            0. hoodies - 6.952869808679421 %
            1. hoodies-female - 1.8196856906534327 %
            2. longsleeve - 34.255444379046494 %
            3. shirt - 95.48966381290457 %
            4. sweatshirt - 85.657104736491 %
            5. sweatshirt-female - 63.951120162932796 %
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-15-e9c57d0b7fc4> in <module>()
      1 # Run validation
----> 2 accuracy, class_based_accuracy = gtf.Evaluate();

3 frames
/content/monk_v1/monk/gluon/finetune/level_4_evaluation_base.py in set_evaluation_final(self)
     69         for i in range(len(self.system_dict["dataset"]["params"]["classes"])):
     70             self.custom_print("            {}. {} - {} %".format(i, self.system_dict["dataset"]["params"]["classes"][i], 
---> 71                 class_dict[self.system_dict["dataset"]["params"]["classes"][i]]["num_correct"]/class_dict[self.system_dict["dataset"]["params"]["classes"][i]]["num_images"]*100));
     72             class_dict[self.system_dict["dataset"]["params"]["classes"][i]]["accuracy(%)"] = class_dict[self.system_dict["dataset"]["params"]["classes"][i]]["num_correct"]/class_dict[self.system_dict["dataset"]["params"]["classes"][i]]["num_images"]*100;
     73         self.custom_print("        total images:            {}".format(len(self.system_dict["local"]["data_loaders"]["test"])));

ZeroDivisionError: division by zero

What does this error suggest?

@vidyap-xgboost
Copy link
Contributor Author

[UPDATE]

I ran the below code as suggested in #73

gtf.system_dict["dataset"]["params"]["classes"]

and got this result:

['hoodies',
 'hoodies-female',
 'longsleeve',
 'shirt',
 'sweatshirt',
 'sweatshirt-female',
 'zalando']

There is no empty class.

@abhi-kumar
Copy link
Contributor

Please check if the validation dataset has no examples for either one of the classes.

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

2 participants