Skip to content

Commit b743053

Browse files
Carole SudreCarole Sudre
authored andcommitted
improvement of documentation listing availability of measures according to tasks
1 parent b5108db commit b743053

1 file changed

Lines changed: 219 additions & 4 deletions

File tree

MetricsReloaded/processes/overall_process.py

Lines changed: 219 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,166 @@
1818
1919
.. _processeval:
2020
21-
Performing the process associated with instance segmentation
22-
------------------------------------------------------------
23-
2421
.. autoclass:: ProcessEvaluation
2522
:members:
2623
24+
The different categories of task considered are:
25+
26+
* ImLC - Image Level Classification
27+
* SemS - Semantic Segmentation
28+
* ObD - Object detection
29+
* InS - Instance segmentation
30+
31+
For each of these tasks only certain metrics are available and suitable. Error messages will be given and the processing interrupted if the chosen
32+
task and the chosen evaluation measures are not compatible.
33+
Evaluation measures are classified into the following categories:
34+
35+
* Per class counting measures - measures_pcc
36+
* Multi class counting measures - measures_mcc
37+
* Overlap measures - measures_overlap
38+
* Boundary measures - measures_boundary
39+
* Multi threshold measures - measures_mt
40+
* Calibration measures - measures_cal
41+
* Combined detection and segmentation metrics - measures_detseg
42+
43+
The available measures per task are:
44+
45+
* ImLC:
46+
47+
* multi threshold measures:
48+
49+
* auroc - Area under the Receiver Operator Curve
50+
* ap - Average Precision
51+
* sens@spec - Sensitivity at Specificity
52+
* spec@sens - Specificity at Sensitivity
53+
* ppv@sens - Positive Predictive value at sensitivity
54+
55+
* per class counting measures:
56+
57+
* fbeta - FBeta score
58+
* lr+ - positive likelihood ratio
59+
* accuracy
60+
* ba - balance accuracy
61+
* ec - expected cost
62+
* nb - net benefit
63+
* numb_ref - number in reference
64+
* numb_pred - number in prediction
65+
* numb_tp - number of true positives
66+
* numb_fp - number of false positives
67+
* numb_fn - number of false negatives
68+
* cohens_kappa
69+
70+
* multi class counting measures:
71+
72+
* mcc - matthews correlation coefficient
73+
* wck - weighted cohen's kappa
74+
* ec - expected cost
75+
76+
* calibration measures:
77+
78+
* ls - logarithmic score
79+
* bs - Brier Score
80+
* cwece - Class-wise expectation calibration error
81+
* nll - Negative log-likelihood
82+
* rbs - Root Brier Score
83+
* ece_kde - Expectation Calibration Error with Kernel density estimation
84+
* kce - Kernel Calibration error
85+
* ece - Expectation Calibration Error
86+
87+
* Object Detection - ObD:
88+
89+
* per class counting measures:
90+
91+
* fbeta - FBeta score
92+
* numb_pred - number of predicted elements
93+
* numb_tp - number of true positives
94+
* numb_fp - number of false positives
95+
* numb_fn - number of false negatives
96+
* numb_ref - number of reference elements
97+
* sensitivity - sensitivity
98+
99+
* multi-threshold measures:
100+
101+
* sens@spec - sensitivity at specificity
102+
* spec@sens - specificity at sensitivity
103+
* sens@ppv - sensitivity at positive predictive value
104+
* ppv@sens - positive predictive value at sensitivity
105+
* sens@fppi - sensitivity at false positive per image
106+
* fppi@sens - false positive per image at sensitivity
107+
* ap - average precision
108+
* froc - free receiver operator curve
109+
110+
* Semantic segmentation - SemS:
111+
112+
* per class measures of overlap:
113+
114+
* dsc - dice similarity coefficient
115+
* fbeta - FBeta score
116+
* cldice - centreline dice
117+
* iou - intersection over union
118+
119+
* measures of boundary quality:
120+
121+
* assd - average symmetric surface distance
122+
* masd - mean average surface distance
123+
* hd - hausdorff distance
124+
* hd_perc - percentile of hausdorff distance
125+
* nsd - normalised surface dice
126+
* boundary_iou - boundary intersection over union
127+
128+
* per class counting :
129+
130+
* numb_ref - number of reference elements
131+
* numb_pred - number of predicted elements
132+
* numb_tp - number of true positives
133+
* numb_fp - number of false positives
134+
* numb_fn - number of false negatives
135+
136+
* Instance segmentation - InS:
137+
138+
* combined measures of detection and segmentation
139+
140+
* pq - panoptic quality
141+
142+
* per class counting measures:
143+
144+
* fbeta - FBeta score
145+
* numb_ref - number of reference instances
146+
* numb_pred - number of prediction instances
147+
* numb_tp - number of true positives
148+
* numb_fp - number of false positives
149+
* numb_fn - number of false negatives
150+
151+
* multi-threshold measures:
152+
153+
* sens@spec - sensitivity at specificity
154+
* spec@sens - specificity at sensitivity
155+
* sens@ppv - sensitivity at positive predictive value
156+
* ppv@sens - positive predictive value at sensitivity
157+
* fppi@sens - false positive per image at sensitivity
158+
* sens@fppi - sensitivity at false positive per image
159+
* ap - average precision
160+
* froc - free receiver operator curve
161+
162+
* measures of overlap:
163+
164+
* dsc - dice similarity coefficient
165+
* fbeta - fbeta score
166+
* cldice - centreline dice similarity coefficient
167+
* iou - intersection over union
168+
169+
* measures of boundary quality:
170+
171+
* hd - hausdorff distance
172+
* boundary_iou - boundary intersection over union
173+
* masd - mean average surface distance
174+
* assd - average symmetric surface distance
175+
* nsd - normalised surface dice
176+
* hd_perc - percentile of hausdorff distance
177+
178+
179+
180+
27181
"""
28182

29183

@@ -43,7 +197,7 @@
43197
'ppv@sens','fbeta','accuracy','ba',
44198
'ec','nb','mcc',
45199
'wck','lr+','bs','cwece',
46-
'nll','rbs','ece_kde','kce','ece',"numb_ref",
200+
'nll','rbs','ece_kde','kce','ece',"numb_ref",'ls',
47201
"numb_pred",
48202
"numb_tp",
49203
"numb_fp",
@@ -106,6 +260,25 @@
106260
class ProcessEvaluation(object):
107261
"""
108262
Performs the evaluation of the data stored in a pickled file according to all the measures, categories and choices of processing
263+
264+
:param data: dictionary containing all the data to be used for the comparison; possible keys include "pred_loc", "ref_loc", "pred_prob",
265+
:param category: task to be considered choice among ImLC, ObD, SemS, InS
266+
:param measures_pcc: list of per class counting measures (these need to be adequate for the chosen task category)
267+
:param measures_mcc: list of multi class counting measures
268+
:param measures_boundary: list of measures to assess boundary quality
269+
:param measures_overlap: list of measures to assess overlap quality
270+
:param measures_mt: list of multi-threshold measures
271+
:param measures_detseg: list of measures assessing jointly detection and segmentation performance
272+
:param measures_cal: list of calibration measures (only available for image level classification class)
273+
:param localization: choice for localization strategy (used in Instance segmentation and Object detection tasks)
274+
:param assignment: choice for the assignment strategy (used in Instance segmentation and Object detection tasks)
275+
:param pixdim: pixel dimensions as list
276+
:param flag_map: indication whether nifti images indicating true positive elements for the reference, the prediction and errors should be created (done only for instance segmentation)
277+
:param file: name of files
278+
:param thresh_ass: threshold chosen for the assignment (default 0.5)
279+
:param case: indication of the handling of cases separately (True) or jointly (False)
280+
:param flag_fp_in: indicates that false positive should be accounted for
281+
:param ignore_missing: indicates whether the missing predictions should be considered in the overall assessment (True) or not (False)
109282
"""
110283

111284
def __init__(
@@ -163,6 +336,11 @@ def __init__(
163336
self.get_stats_res()
164337

165338
def check_valid_measures_cat(self):
339+
"""
340+
Function checking whether the category and the combination of measures suggested are suitable for continuing the process
341+
342+
:return: flag_valid
343+
"""
166344
flag_valid = True
167345
if self.category not in ['ImLC','SemS','InS','ObD']:
168346
warnings.warn('No appropriate category chosen, please choose between ImLC, SemS, InS and ObD')
@@ -178,6 +356,43 @@ def check_valid_measures_cat(self):
178356

179357

180358
def process_data(self):
359+
"""
360+
Performs the processing of the data according to the details given in the setting up of the process
361+
Contributes to the attribution of one dataframe per type of measures :
362+
363+
* resdet - detection results
364+
* resseg - segmentation results
365+
* resmt - multi-threshold results
366+
* resmcc - multi class counting results
367+
* rescal - calibration results
368+
369+
All these dataframes are initialised as None and replaced according to the chosen task. The tasks should yield the following outputs:
370+
371+
* ImLC:
372+
373+
* resdet
374+
* rescal
375+
* resmt
376+
* resmcc
377+
378+
* SemS:
379+
380+
* resseg
381+
382+
* ObD:
383+
384+
* resdet
385+
* resmt
386+
* resmcc
387+
388+
* InS:
389+
390+
* resdet
391+
* resseg
392+
* resmt
393+
* resmcc
394+
395+
"""
181396
data = self.data
182397
df_resdet = None
183398
df_resseg = None

0 commit comments

Comments
 (0)