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

[BUG] Classification issue if "include_validation_with_hausdorff" is explicitly set to false #200

Open
Linardos opened this issue Oct 3, 2024 · 0 comments

Comments

@Linardos
Copy link
Collaborator

Linardos commented Oct 3, 2024

Describe the bug

Classification code tries to use Segmentation files if "include_validation_with_hausdorff" is explicitly set to false

To Reproduce

It happened to me after updating the code for Classification. It would not recognize the classification commands from the config if the user set include_validation_with_hausdorff=False
Steps to reproduce the behavior:

  1. in the updated FeTS Challenge codebase set for classification, (https://github.com/Linardos/Challenge), the main script has include_validation_with_hausdorff=False
  2. Run command the main script
  3. I get an error showing the code tries to work with segmentation files:
Looping over validation data:   0%|                                                                                                             | 0/12 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "/home/locolinux2/Challenge/Task_1/FeTS_Challenge_RecEng.py", line 1150, in <module>
    scores_dataframe, checkpoint_folder = run_challenge_experiment(
  File "/home/locolinux2/Challenge/Task_1/fets_challenge/experiment.py", line 496, in run_challenge_experiment
    collaborators[col].run_simulation()
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/openfl/component/collaborator/collaborator.py", line 193, in run_simulation
    self.do_task(task, round_number)
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/openfl/component/collaborator/collaborator.py", line 298, in do_task
    global_output_tensor_dict, local_output_tensor_dict = func(
  File "/home/locolinux2/.local/workspace/src/fets_challenge_model.py", line 43, in validate
    epoch_valid_loss, epoch_valid_metric = validate_network(self.model,
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/GANDLF/compute/forward_pass.py", line 285, in validate_network
    result = step(model, image, label, params, train=True)
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/GANDLF/compute/step.py", line 88, in step
    loss, metric_output = get_loss_and_metrics(image, label, output, params)
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/GANDLF/compute/loss_and_metric.py", line 153, in get_loss_and_metrics
    metric_output[metric] = get_metric_output(
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/GANDLF/compute/loss_and_metric.py", line 30, in get_metric_output
    metric_output = metric_function(prediction, target, params).detach().cpu()
  File "/home/locolinux2/Challenge/Task_1/venv/lib/python3.9/site-packages/GANDLF/metrics/segmentation.py", line 61, in multi_class_dice
    current_dice = dice(prediction[:, i, ...], target[:, i, ...])
IndexError: too many indices for tensor of dimension 1

Crude Solution

It was solved by setting include_validation_with_hausdorff=True, and classification runs normally.

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

1 participant