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 #11

Closed
BlueAkoasm opened this issue May 6, 2022 · 1 comment
Closed

ZeroDivisionError #11

BlueAkoasm opened this issue May 6, 2022 · 1 comment

Comments

@BlueAkoasm
Copy link

Hello, when i run the original code, it always occurs the ZeroDivisionError, it also happens after i change the dataset. The reason is that the TP and FP are both 0 at the same time, so the precision is very low. It seems like the network is not converging. What should i do?
Traceback (most recent call last): File "train.py", line 263, in <module> main() File "train.py", line 93, in main is_best = run_epochs("val", conf, val_loader, model, None, logger, epoch, device, lr_scheduler) File "train.py", line 233, in run_epochs result.evaluate(pred, batch_data, loss.item(), batch_index) File "/home/linux/catkin_ws/LineTR-train/evaluations/metric.py", line 40, in evaluate precision, recall, f1_score = self.eval_pr.get_precision_recall(score_pred, score_gt) File "/home/linux/catkin_ws/LineTR-train/evaluations/evaluate_pr.py", line 31, in get_precision_recall precision = np.average(np.nan_to_num(TP / (TP+FP)))*100. ZeroDivisionError: division by zero

@yosungho
Copy link
Owner

The error occurred when TP and FP are zeros, so I added a small number to prevent the zero denominators. Thanks for reporting the bug.

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