Hive.evaluation.abstract module#

Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class Hive.evaluation.abstract.AbstractEvaluator[source]#

Bases: ABC

abstract finish_online_evaluation(*args, **kwargs)[source]#

Accumulate results from batches and compute metrics

abstract reset()[source]#

Reset internal state of evaluator

abstract run_online_evaluation(*args, **kwargs)[source]#

Compute necessary values per batch for later evaluation

class Hive.evaluation.abstract.AbstractMetric[source]#

Bases: ABC

abstract compute(results_list)[source]#

Compute metric

Parameters:

results_list (List[Dict[int, Dict[str, np.ndarray]]]) –

list with result s per image (in list) per category (dict). Inner Dict contains multiple results obtained by box_matching_batch(). dtMatches: matched detections [T, G], where T = number of thresholds, G = number of ground truth gtMatches: matched ground truth boxes [T, D], where T = number of thresholds,

D = number of detections

dtScores: prediction scores [D] detection scores gtIgnore: ground truth boxes which should be ignored [G] indicate whether ground truth

should be ignored

dtIgnore: detections which should be ignored [T, D], indicate which detections should be ignored

Return type:

(Dict[str, float], Dict[str, ndarray])

Returns:

Dict[str, float] – dictionary with scalar values for evaluation Dict[str, np.ndarray]: dictionary with arrays, e.g. for visualization of graphs

class Hive.evaluation.abstract.DetectionMetric[source]#

Bases: AbstractMetric

check_number_of_iou(*args)[source]#

Check if shape of input in first dimension is consistent with expected IoU values (assumes IoU dimension is the first dimension)

Parameters:

args – array like inputs with shape function

Return type:

None

abstract get_iou_thresholds()[source]#

Return IoU thresholds needed for this metric in an numpy array

Return type:

Sequence[float]

Returns:

Sequence[float] – IoU thresholds; [M], M is the number of thresholds