Skip to content

Commit

Permalink
PR 590 Review changes:
Browse files Browse the repository at this point in the history
- quicktest.yaml: commenting out trigger on pull request
- FastSurferCNN.utils.metrics.py: docstring changes
  • Loading branch information
taha-abdullah committed Oct 22, 2024
1 parent 710291e commit e73139a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/quicktest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: quicktest

# File: quicktest.yaml
# File: quicktest_runner.yaml
# Author: Taha Abdullah
# Created on: 2023-07-10
# Functionality: This workflow runs FastSurfer on MRI data and runs pytest to check if the results are acceptable. It
Expand Down Expand Up @@ -73,4 +73,4 @@ jobs:
- name: Run pytest
run: |
source /venv-pytest/bin/activate
python -m pytest test/quick_test
python -m pytest test/quick_test
33 changes: 18 additions & 15 deletions FastSurferCNN/utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,20 @@ class DiceScore:
"""
Accumulating the component of the dice coefficient i.e. the union and intersection.
Args:
op (callable): a callable to update accumulator. Method's signature is `(accumulator, output)`.
For example, to compute arithmetic mean value, `op = lambda a, x: a + x`.
output_transform (callable, optional): a callable that is used to transform the
:class:`~ignite.engine.Engine`'s `process_function`'s output into the
form expected by the metric. This can be useful if, for example, you have a multi-output model and
you want to compute the metric with respect to one of the outputs.
device (str of torch.device, optional): device specification in case of distributed computation usage.
In most of the cases, it can be defined as "cuda:local_rank" or "cuda"
if already set `torch.cuda.set_device(local_rank)`. By default, if a distributed process group is
initialized and available, device is set to `cuda`.
Parameters
----------
op : callable
A callable to update the accumulator. Method's signature is `(accumulator, output)`.
For example, to compute arithmetic mean value, `op = lambda a, x: a + x`.
output_transform : callable, optional
A callable that is used to transform the :class:`~ignite.engine.Engine`'s `process_function`'s output into the
form expected by the metric. This can be useful if, for example, you have a multi-output model and
you want to compute the metric with respect to one of the outputs.
device : str or torch.device, optional
Device specification in case of distributed computation usage.
In most cases, it can be defined as "cuda:local_rank" or "cuda"
if already set `torch.cuda.set_device(local_rank)`. By default, if a distributed process group is
initialized and available, the device is set to `cuda`.
"""
def __init__(
self,
Expand Down Expand Up @@ -154,8 +157,8 @@ def _check_output_type(self, output):
"""
Check the type of the output and raise an error if it doesn't match expectations.
Parameters:
-----------
Parameters
----------
output : tuple
The output to be checked, expected to be a tuple.
"""
Expand All @@ -168,8 +171,8 @@ def _update_union_intersection(self, batch_output, labels_batch):
"""
Update the union and intersection matrices based on batch predictions and labels.
Parameters:
-----------
Parameters
----------
batch_output : torch.Tensor
Batch predictions from the model.
Expand Down

0 comments on commit e73139a

Please sign in to comment.