gandlf- index out of bounds error #858
-
I'm trying to run gandlf on the breastmnist dataset obtained from medmnist. The data only has 1 channel of size (28, 28). Looks something like this: I'm using gandlf version 0.0.19. I made relevant changes to the config file like changing n_channels to 1, n_classes to 0,1, and patch_size to 28,28. (See attached config file) But I still am encountering the following error: ERROR: Traceback (most recent call last):
File "/content/GaNDLF/gandlf_run", line 126, in <module>
main_run(
File "/content/GaNDLF/GANDLF/cli/main_run.py", line 92, in main_run
TrainingManager_split(
File "/content/GaNDLF/GANDLF/training_manager.py", line 173, in TrainingManager_split
training_loop(
File "/content/GaNDLF/GANDLF/compute/training_loop.py", line 338, in training_loop
overall_metrics = overall_stats(
File "/content/GaNDLF/GANDLF/metrics/__init__.py", line 120, in overall_stats
return classification.overall_stats(predictions, ground_truth, params)
File "/content/GaNDLF/GANDLF/metrics/classification.py", line 76, in overall_stats
output_metrics[metric_name] = get_output_from_calculator(
File "/content/GaNDLF/GANDLF/utils/tensor.py", line 536, in get_output_from_calculator
temp_output = calculator(prediction, target)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/metric.py", line 298, in forward
self._forward_cache = self._forward_reduce_state_update(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/metric.py", line 368, in _forward_reduce_state_update
batch_val = self.compute()
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/metric.py", line 607, in wrapped_func
value = _squeeze_if_scalar(compute(*args, **kwargs))
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/classification/auroc.py", line 123, in compute
return _binary_auroc_compute(state, self.thresholds, self.max_fpr)
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/functional/classification/auroc.py", line 88, in _binary_auroc_compute
fpr, tpr, _ = _binary_roc_compute(state, thresholds, pos_label)
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/functional/classification/roc.py", line 54, in _binary_roc_compute
fps, tps, thres = _binary_clf_curve(preds=state[0], target=state[1], pos_label=pos_label)
File "/usr/local/lib/python3.10/dist-packages/torchmetrics/functional/classification/precision_recall_curve.py", line 61, in _binary_clf_curve
target = target[desc_score_indices]
IndexError: index 7 is out of bounds for dimension 0 with size 5 I'm not sure how to fix this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for the report! This is related to this bug report. Comment out the lines 65-69 in |
Beta Was this translation helpful? Give feedback.
Thanks for the report!
This is related to this bug report. Comment out the lines 65-69 in
GANDLF/metrics/classification.py
(see this PR for reference) and it should work fine.