Class RemoveOverlappingObjects
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
Bounding boxes with scores above this threshold are removed.protected boolean
processObjects
(ObjectForReduction source, ObjectForReduction overlapping, ReduceObjectsGraph graph) Processes two objects.void
setScoreThreshold
(double scoreThreshold) Bounding boxes with scores above this threshold are removed.protected boolean
shouldObjectsBeProcessed
(ObjectMask source, ObjectMask other) Whether to include another (possibly-overlapping withsource
) element in processing?Methods inherited from class org.anchoranalysis.image.inference.bean.reduce.ReduceElementsGreedy
reduce
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
RemoveOverlappingObjects
public RemoveOverlappingObjects()
-
-
Method Details
-
shouldObjectsBeProcessed
Description copied from class:ReduceElementsGreedy
Whether to include another (possibly-overlapping withsource
) element in processing?- Specified by:
shouldObjectsBeProcessed
in classReduceElementsGreedy
- Parameters:
source
- the element we are currently processing, for which we search for possibly overlapping elementother
- another object which we are considering to include in processing (in conjunction withsource
).- 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 classReduceElementsGreedy
- 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 thesourceElement
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.
-