Package adams.data.objectoverlap
Class AreaRatio
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,LabelAwareObjectOverlap
,ObjectOverlap
,Serializable
public class AreaRatio extends AbstractObjectOverlap implements LabelAwareObjectOverlap
Uses the area ratio between the annotated and predicted objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_AdditionalObject
whether to check for additional predicted objects not present in actual.protected boolean
m_AverageRatio
whether to use average overlap ratio instead of just this->other.protected String
m_LabelKey
the label meta-data key - ignored if empty.protected double
m_MinOverlapRatio
the minimum overlap ratio to use.protected boolean
m_UseOtherObject
whether to use the other object in the output in case of an overlap.static String
OVERLAP_COUNT
the overlap count.static String
OVERLAP_LABEL_HIGHEST
the label of the highest overlap.static String
OVERLAP_LABEL_HIGHEST_MATCH
whether the labels of the highest overlap match.static String
OVERLAP_PERCENTAGE_HIGHEST
the highest overlap percentage.-
Fields inherited from class adams.data.objectoverlap.AbstractObjectOverlap
m_CopyMetaData, m_ExcludeIdentical, m_MetaDataKeys
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.data.objectoverlap.ObjectOverlap
ADDITIONAL_OBJ, UNKNOWN_LABEL
-
-
Constructor Summary
Constructors Constructor Description AreaRatio()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
additionalObjectTipText()
Returns the tip text for this property.String
averageRatioTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected LocatedObjects
doCalculate(LocatedObjects annotations, LocatedObjects predictions, Map<LocatedObject,Map<LocatedObject,Double>> matches)
Computes the overlapping objects between the annotations and the predictions.boolean
getAdditionalObject()
Returns whether to count additional predicted objects.boolean
getAverageRatio()
Returns whether to use average overlap ratio instead.String
getLabelKey()
Returns the (optional) key for a string label in the meta-data; if supplied the value of the object with the highest overlap gets stored in the report usingOVERLAP_LABEL_HIGHEST
,OVERLAP_LABEL_HIGHEST_MATCH
stores whether the labels match.double
getMinOverlapRatio()
Returns the minimum overlap ratio to use.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
getUseOtherObject()
Returns whether to use/forward other object data.String
globalInfo()
Returns a string describing the object.String
labelKeyTipText()
Returns the tip text for this property.String
minOverlapRatioTipText()
Returns the tip text for this property.void
setAdditionalObject(boolean value)
Sets whether to count additional predicted objects.void
setAverageRatio(boolean value)
Sets whether to use average overlap ratio instead.void
setLabelKey(String value)
Sets the (optional) key for a string label in the meta-data; if supplied the value of the object with the highest overlap gets stored in the report usingOVERLAP_LABEL_HIGHEST
,OVERLAP_LABEL_HIGHEST_MATCH
stores whether the labels match.void
setMinOverlapRatio(double value)
Sets the minimum overlap ratio to use.void
setUseOtherObject(boolean value)
Sets whether to use/forward other object data.com.github.fracpete.javautils.struct.Struct2<LocatedObjects,LocatedObjects>
splitOverlaps(LocatedObjects overlaps)
Splits the overlapping objects into subsets of matching labels and mismatching ones.String
useOtherObjectTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.objectoverlap.AbstractObjectOverlap
addMatch, calculate, check, copyMetaData, copyMetaDataTipText, excludeIdenticalTipText, getCopyMetaData, getExcludeIdentical, getMetaDataKeys, initMatch, matches, metaDataKeysTipText, setCopyMetaData, setExcludeIdentical, setMetaDataKeys
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.data.objectoverlap.ObjectOverlap
calculate, matches
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
OVERLAP_PERCENTAGE_HIGHEST
public static final String OVERLAP_PERCENTAGE_HIGHEST
the highest overlap percentage.- See Also:
- Constant Field Values
-
OVERLAP_LABEL_HIGHEST
public static final String OVERLAP_LABEL_HIGHEST
the label of the highest overlap.- See Also:
- Constant Field Values
-
OVERLAP_LABEL_HIGHEST_MATCH
public static final String OVERLAP_LABEL_HIGHEST_MATCH
whether the labels of the highest overlap match.- See Also:
- Constant Field Values
-
OVERLAP_COUNT
public static final String OVERLAP_COUNT
the overlap count.- See Also:
- Constant Field Values
-
m_MinOverlapRatio
protected double m_MinOverlapRatio
the minimum overlap ratio to use.
-
m_LabelKey
protected String m_LabelKey
the label meta-data key - ignored if empty.
-
m_UseOtherObject
protected boolean m_UseOtherObject
whether to use the other object in the output in case of an overlap.
-
m_AdditionalObject
protected boolean m_AdditionalObject
whether to check for additional predicted objects not present in actual.
-
m_AverageRatio
protected boolean m_AverageRatio
whether to use average overlap ratio instead of just this->other.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractObjectOverlap
-
setMinOverlapRatio
public void setMinOverlapRatio(double value)
Sets the minimum overlap ratio to use.- Parameters:
value
- the minimum ratio
-
getMinOverlapRatio
public double getMinOverlapRatio()
Returns the minimum overlap ratio to use.- Returns:
- the minimum ratio
-
minOverlapRatioTipText
public String minOverlapRatioTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelKey
public void setLabelKey(String value)
Sets the (optional) key for a string label in the meta-data; if supplied the value of the object with the highest overlap gets stored in the report usingOVERLAP_LABEL_HIGHEST
,OVERLAP_LABEL_HIGHEST_MATCH
stores whether the labels match.- Parameters:
value
- the key, ignored if empty
-
getLabelKey
public String getLabelKey()
Returns the (optional) key for a string label in the meta-data; if supplied the value of the object with the highest overlap gets stored in the report usingOVERLAP_LABEL_HIGHEST
,OVERLAP_LABEL_HIGHEST_MATCH
stores whether the labels match.- Returns:
- the key, ignored if empty
-
labelKeyTipText
public String labelKeyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseOtherObject
public void setUseOtherObject(boolean value)
Sets whether to use/forward other object data.- Parameters:
value
- true if to use other object
-
getUseOtherObject
public boolean getUseOtherObject()
Returns whether to use/forward other object data.- Returns:
- true if to use other object
-
useOtherObjectTipText
public String useOtherObjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAdditionalObject
public void setAdditionalObject(boolean value)
Sets whether to count additional predicted objects.- Parameters:
value
- true if to count additional predicted objects
-
getAdditionalObject
public boolean getAdditionalObject()
Returns whether to count additional predicted objects.- Returns:
- true if to count additional predicted objects
-
additionalObjectTipText
public String additionalObjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAverageRatio
public void setAverageRatio(boolean value)
Sets whether to use average overlap ratio instead.- Parameters:
value
- true if to use average overlap ratio instead
-
getAverageRatio
public boolean getAverageRatio()
Returns whether to use average overlap ratio instead.- Returns:
- true if to use average overlap ratio instead
-
averageRatioTipText
public String averageRatioTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractObjectOverlap
- Returns:
- null if no info available, otherwise short string
-
doCalculate
protected LocatedObjects doCalculate(LocatedObjects annotations, LocatedObjects predictions, Map<LocatedObject,Map<LocatedObject,Double>> matches)
Computes the overlapping objects between the annotations and the predictions.- Specified by:
doCalculate
in classAbstractObjectOverlap
- Parameters:
annotations
- the annotations (ground truth)predictions
- the predictions to compare withmatches
- for collecting the matches- Returns:
- the overlapping objects
-
splitOverlaps
public com.github.fracpete.javautils.struct.Struct2<LocatedObjects,LocatedObjects> splitOverlaps(LocatedObjects overlaps)
Splits the overlapping objects into subsets of matching labels and mismatching ones.- Specified by:
splitOverlaps
in interfaceLabelAwareObjectOverlap
- Parameters:
overlaps
- all overlaps, to split- Returns:
- split into matching/mismatching subsets
-
-