Skip to content

Commit 959fd60

Browse files
committed
update evaluation docs
update evaluation docs
1 parent 50a82ef commit 959fd60

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

docs/source/usage.quickstart.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,51 @@ file used for segmentation of lung from radiograph, which can be find in
115115
label_source = [0, 1]
116116
label_target = [0, 255]
117117
118+
119+
Evaluation
120+
----------
121+
122+
To evaluate a model's prediction results compared with the ground truth,
123+
use the ``pymic_eval_seg`` and ``pymic_eval_cls`` commands for segmentation
124+
and classfication tasks, respectively. Both of them accept a configuration
125+
file to specify the evaluation metrics, predicted results, ground truth and
126+
other information.
127+
128+
For example, for segmentation tasks, run:
129+
130+
.. code-block:: none
131+
132+
pymic_eval_seg evaluation.cfg
133+
134+
The configuration file is like (an example from ``PYMIC_examples/seg_ssl/ACDC``):
135+
136+
.. code-block:: none
137+
138+
[evaluation]
139+
metric = dice
140+
label_list = [1,2,3]
141+
organ_name = heart
142+
143+
ground_truth_folder_root = ../../PyMIC_data/ACDC/preprocess
144+
segmentation_folder_root = result/unet2d_em
145+
evaluation_image_pair = config/data/image_test_gt_seg.csv
146+
147+
See :mod:`pymic.util.evaluation_seg.evaluation` for details of the configuration required.
148+
149+
For classification tasks, run:
150+
151+
.. code-block:: none
152+
153+
pymic_eval_cls evaluation.cfg
154+
155+
The configuration file is like (an example from ``PYMIC_examples/classification/CHNCXR``):
156+
157+
.. code-block:: none
158+
159+
[evaluation]
160+
metric_list = [accuracy, auc]
161+
ground_truth_csv = config/cxr_test.csv
162+
predict_csv = result/resnet18.csv
163+
predict_prob_csv = result/resnet18_prob.csv
164+
165+
See :mod:`pymic.util.evaluation_cls.main` for details of the configuration required.

pymic/io/h5_dataset.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# -*- coding: utf-8 -*-
22

33
from logging import root
4-
import os
5-
from re import S
4+
import os
65
import torch
76
import random
87
import h5py
98
import pandas as pd
10-
from scipy import ndimage
119
from torch.utils.data import Dataset
1210
from torch.utils.data.sampler import Sampler
1311

@@ -40,7 +38,6 @@ def __getitem__(self, idx):
4038
sample = {'image': image, 'label': label}
4139
if self.transform:
4240
sample = self.transform(sample)
43-
# sample["idx"] = idx
4441
return sample
4542

4643
class TwoStreamBatchSampler(Sampler):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pandas>=0.25.3
44
scikit-image>=0.16.2
55
scikit-learn>=0.22
66
scipy>=1.3.3
7-
SimpleITK>=1.2.4
7+
SimpleITK>=2.0.0
88
tensorboard>=2.1.0
99
tensorboardX>=1.9
1010
torch>=1.7.1

0 commit comments

Comments
 (0)