lib.sedna.algorithms.hard_example_mining.hard_example_mining

Hard Example Mining Algorithms

Module Contents

Classes

ThresholdFilter

Object detection Hard samples discovery methods named Threshold

CrossEntropyFilter

Object detection Hard samples discovery methods named CrossEntropy

IBTFilter

Object detection Hard samples discovery methods named IBT

class lib.sedna.algorithms.hard_example_mining.hard_example_mining.ThresholdFilter(threshold: float = 0.5, **kwargs)[source]

Bases: BaseFilter, abc.ABC

Object detection Hard samples discovery methods named Threshold

Parameters:

threshold (float) – hard coefficient threshold score to filter img, default to 0.5.

__call__(infer_result=None) bool[source]

predict function, judge the sample is hard or not.

Parameters:

infer_result (array_like) – prediction result

Returns:

is_hard_sampleTrue means hard sample, False means not.

Return type:

bool

class lib.sedna.algorithms.hard_example_mining.hard_example_mining.CrossEntropyFilter(threshold_cross_entropy=0.5, **kwargs)[source]

Bases: BaseFilter, abc.ABC

Object detection Hard samples discovery methods named CrossEntropy

Parameters:

threshold_cross_entropy (float) – hard coefficient threshold score to filter img, default to 0.5.

__call__(infer_result=None) bool[source]

judge the img is hard sample or not.

Parameters:

infer_result (array_like) – prediction classes list, such as [class1-score, class2-score, class2-score,….], where class-score is the score corresponding to the class, class-score value is in [0,1], who will be ignored if its value not in [0,1].

Returns:

is hard sampleTrue means hard sample, False means not.

Return type:

bool

class lib.sedna.algorithms.hard_example_mining.hard_example_mining.IBTFilter(threshold_img=0.5, threshold_box=0.5, **kwargs)[source]

Bases: BaseFilter, abc.ABC

Object detection Hard samples discovery methods named IBT

Parameters:
  • threshold_img (float) – hard coefficient threshold score to filter img, default to 0.5.

  • threshold_box (float) – threshold_box to calculate hard coefficient, formula is hard coefficient = number(prediction_boxes less than threshold_box) / number(prediction_boxes)

__call__(infer_result=None) bool[source]

Judge the img is hard sample or not.

Parameters:

infer_result (array_like) – prediction boxes list, such as [bbox1, bbox2, bbox3,….], where bbox = [xmin, ymin, xmax, ymax, score, label] score should be in [0,1], who will be ignored if its value not in [0,1].

Returns:

is hard sampleTrue means hard sample, False means not.

Return type:

bool