Skip to content

Commit c85f457

Browse files
committed
PR 590 Review changes:
- quicktest.yaml: commenting out trigger on pull request - FastSurferCNN.utils.metrics.py: docstring changes
1 parent 462b00d commit c85f457

File tree

2 files changed

+29
-37
lines changed

2 files changed

+29
-37
lines changed

.github/workflows/quicktest.yaml

+11-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: quicktest-runner
22

3-
# File: quicktest.yaml
3+
# File: quicktest_runner.yaml
44
# Author: Taha Abdullah
55
# Created on: 2023-07-10
66
# Functionality: This workflow runs FastSurfer on MRI data and runs pytest to check if the results are acceptable. It
@@ -16,25 +16,19 @@ name: quicktest-runner
1616
# - FS_LICENSE: Path to the FreeSurfer license file.
1717

1818
on:
19-
pull_request:
20-
branches:
21-
- dev
22-
- stable
19+
# pull_request:
20+
# branches:
21+
# - dev
22+
# - stable
2323
workflow_dispatch:
2424

2525
jobs:
26-
# Checkout repo
27-
checkout:
26+
run-quicktest:
2827
runs-on: self-hosted
2928
steps:
29+
# Checkout fastsurfer
3030
- uses: actions/checkout@v2
31-
32-
# Create conda environment, install packages, and run Fastsurfer
33-
run-fastsurfer:
34-
runs-on: self-hosted
35-
needs: checkout
36-
steps:
37-
# Check if the Environment Variables used in further steps are present
31+
# Check if the Environment Variables used in further steps are present
3832
- name: Check Environment Variables
3933
run: |
4034
REQUIRED_ENV_VARS=(
@@ -71,17 +65,12 @@ jobs:
7165
export THIS_RUN_OUTDIR=${GITHUB_SHA:0:7}
7266
mkdir -p $SUBJECTS_DIR/$THIS_RUN_OUTDIR
7367
export TEST_DIR=$THIS_RUN_OUTDIR
68+
export TQDM_DISABLE=1
7469
./brun_fastsurfer.sh --subject_list $RUNNER_FS_MRI_DATA/subjects_list.txt \
7570
--sd $SUBJECTS_DIR/$THIS_RUN_OUTDIR \
7671
--parallel --threads 4 --3T --parallel_subjects surf
77-
78-
# Test fastsurfer output
79-
run-pytest:
80-
runs-on: self-hosted
81-
if: always()
82-
needs: run-fastsurfer
83-
steps:
72+
# run pytest checks for data consistency/quality
8473
- name: Run pytest
8574
run: |
8675
source /venv-pytest/bin/activate
87-
python -m pytest test/quick_test
76+
python -m pytest test/quick_test

FastSurferCNN/utils/metrics.py

+18-15
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,20 @@ class DiceScore:
109109
"""
110110
Accumulating the component of the dice coefficient i.e. the union and intersection.
111111
112-
Args:
113-
op (callable): a callable to update accumulator. Method's signature is `(accumulator, output)`.
114-
For example, to compute arithmetic mean value, `op = lambda a, x: a + x`.
115-
output_transform (callable, optional): a callable that is used to transform the
116-
:class:`~ignite.engine.Engine`'s `process_function`'s output into the
117-
form expected by the metric. This can be useful if, for example, you have a multi-output model and
118-
you want to compute the metric with respect to one of the outputs.
119-
device (str of torch.device, optional): device specification in case of distributed computation usage.
120-
In most of the cases, it can be defined as "cuda:local_rank" or "cuda"
121-
if already set `torch.cuda.set_device(local_rank)`. By default, if a distributed process group is
122-
initialized and available, device is set to `cuda`.
112+
Parameters
113+
----------
114+
op : callable
115+
A callable to update the accumulator. Method's signature is `(accumulator, output)`.
116+
For example, to compute arithmetic mean value, `op = lambda a, x: a + x`.
117+
output_transform : callable, optional
118+
A callable that is used to transform the :class:`~ignite.engine.Engine`'s `process_function`'s output into the
119+
form expected by the metric. This can be useful if, for example, you have a multi-output model and
120+
you want to compute the metric with respect to one of the outputs.
121+
device : str or torch.device, optional
122+
Device specification in case of distributed computation usage.
123+
In most cases, it can be defined as "cuda:local_rank" or "cuda"
124+
if already set `torch.cuda.set_device(local_rank)`. By default, if a distributed process group is
125+
initialized and available, the device is set to `cuda`.
123126
"""
124127
def __init__(
125128
self,
@@ -154,8 +157,8 @@ def _check_output_type(self, output):
154157
"""
155158
Check the type of the output and raise an error if it doesn't match expectations.
156159
157-
Parameters:
158-
-----------
160+
Parameters
161+
----------
159162
output : tuple
160163
The output to be checked, expected to be a tuple.
161164
"""
@@ -168,8 +171,8 @@ def _update_union_intersection(self, batch_output, labels_batch):
168171
"""
169172
Update the union and intersection matrices based on batch predictions and labels.
170173
171-
Parameters:
172-
-----------
174+
Parameters
175+
----------
173176
batch_output : torch.Tensor
174177
Batch predictions from the model.
175178

0 commit comments

Comments
 (0)