Division by zero error in training related to number of samples
See original GitHub issueGetting
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/app/robosat/tools/__main__.py", line 60, in <module>
args.func(args)
File "/app/robosat/tools/train.py", line 147, in main
val_hist = validate(val_loader, num_classes, device, net, criterion)
File "/usr/lib/python3.5/contextlib.py", line 30, in inner
return func(*args, **kwds)
File "/app/robosat/tools/train.py", line 245, in validate
"mcc": metrics.get_mcc(),
File "/app/robosat/metrics.py", line 66, in get_mcc
(self.tp + self.fp) * (self.tp + self.fn) * (self.tn + self.fp) * (self.tn + self.fn)
ZeroDivisionError: float division by zero
. . . following the completion of a single epoch (out of a total of 1) in this workflow. It’s unclear from the traceback where exactly the zero is being invoked, or how it could be fixed in either the config .tomls or the inputs. It seems related to this division, but it’s not clear how a situation where num_samples = 0 could get through the validity check just above it.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Divide by Zero error when training · Issue #558 · thtrieu/darkflow
To train my own dataset which are 20 images of car with license plate annotated. The labels.txt contains only one line license plate...
Read more >DIVIDE_BY_ZERO error class - Azure Databricks
In this article. Parameters; Explanation; Mitigation; Examples; Related. Division by zero. To return NULL instead, use try_divide .
Read more >Exception has occurred: ZeroDivisionError division by zero ...
It is giving you a division by zero error because len(test_lengths[i]) in count/len(test_lengths[i])*100 is 0, and you know that a number ...
Read more >How is division by zero avoided when implementing back ...
I am building a neural network for which I am using the sigmoid function as the activation function for the single output neuron...
Read more >How to fix the #DIV/0! error - Excel formula - Exceljet
Although a #DIV/0! error is caused by an attempt to divide by zero, ... For example, in the screen below, we are calculating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@daniel-j-h New related PR: https://github.com/mapbox/robosat/pull/127
@wboykinm Thanks for the test and report, and replyied on the ‘newer and bigger’ one…
@ocourtin That seems to have done the trick on the division by zero error! Thanks for adding the handler!
(Of course I’m on to newer and bigger failures, but that doesn’t appear related and I’ll try some debugging before I whine about that one.)