Class RemoveOverlappingObjects


public class RemoveOverlappingObjects extends ReduceElementsGreedy
Intersecting objects are removed if they have sufficient overlap.

This involves non-maximum suppression for object-masks using an Intersection over Union score.

A strategy for reducing elements that greedily removes any element with a strong overlap with another.

The highest-confidence element is always retained as a priority over lower-confidence elements.

The strength of the overlap is measured by a score with 0 <= score <= 1).

See Non-maximum suppression for a description of the algorithm.

Author:
Owen Feehan
  • Constructor Details

    • RemoveOverlappingObjects

      public RemoveOverlappingObjects()
  • Method Details

    • shouldObjectsBeProcessed

      protected boolean shouldObjectsBeProcessed(ObjectMask source, ObjectMask other)
      Description copied from class: ReduceElementsGreedy
      Whether to include another (possibly-overlapping with source) element in processing?
      Specified by:
      shouldObjectsBeProcessed in class ReduceElementsGreedy
      Parameters:
      source - the element we are currently processing, for which we search for possibly overlapping element
      other - another object which we are considering to include in processing (in conjunction with source).
      Returns:
      true iff other should be included in processing.
    • processObjects

      protected boolean processObjects(ObjectForReduction source, ObjectForReduction overlapping, ReduceObjectsGraph graph)
      Description copied from class: ReduceElementsGreedy
      Processes two objects.
      Specified by:
      processObjects in class ReduceElementsGreedy
      Parameters:
      source - the element that is being processed as the source, the object with higher confidence.
      overlapping - the element that is deemed to overlap with the sourceElement about which a decision is to be made.
      graph - the graph relating objects to each other, and determining the priority for reduction.
      Returns:
      true if the source object was altered during processing, false if it was not.
    • getScoreThreshold

      public double getScoreThreshold()
      Bounding boxes with scores above this threshold are removed.
    • setScoreThreshold

      public void setScoreThreshold(double scoreThreshold)
      Bounding boxes with scores above this threshold are removed.