Class ConfusionMatrix
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.imagesegmentation.operation.AbstractImageSegmentationContainerOperation
-
- adams.data.imagesegmentation.operation.ConfusionMatrix
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
public class ConfusionMatrix extends AbstractImageSegmentationContainerOperation
Evaluates a prediction (first container) against the annotation (second container) and outputs a spreadsheet with the confusion matrix.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfusionMatrix.MatrixValues
Defines what values to show.
-
Field Summary
Fields Modifier and Type Field Description protected String
m_ActualPrefix
the optional prefix for the actual labels.protected BaseString[]
m_Labels
the label to use instead of automatically determining.protected ConfusionMatrix.MatrixValues
m_MatrixValues
what values to generate.protected String
m_PredictedPrefix
the optional prefix for the predicted labels.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ConfusionMatrix()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
actualPrefixTipText()
Returns the tip text for this property.protected void
collapse(Map<String,BufferedImage> layers, List<String> labels, int[] collapsed)
Collapses the layers into a single array, with the label index corresponding to the integer value (label 0 = pixel 1, label 1 = pixel 2, ...).protected Object
convert(double value)
Converts the number to integer if COUNTS is used.void
defineOptions()
Adds options to the internal list of options.protected Object
doProcess(ImageSegmentationContainer[] containers)
Performs the actual processing of the containers.Class
generates()
The type of data that is generated.String
getActualPrefix()
Returns the prefix of the actual labels.BaseString[]
getLabels()
Returns the labels to use for enforcing order other than alphabetical.ConfusionMatrix.MatrixValues
getMatrixValues()
Returns the type of values to generate.String
getPredictedPrefix()
Returns the prefix of the predicted labels.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
labelsTipText()
Returns the tip text for this property.String
matrixValuesTipText()
Returns the tip text for this property.int
maxNumContainersRequired()
Returns the maximum number of containers that are required for the operation.int
minNumContainersRequired()
Returns the minimum number of containers that are required for the operation.String
predictedPrefixTipText()
Returns the tip text for this property.void
setActualPrefix(String value)
Sets the prefix of the actual labels.void
setLabels(BaseString[] value)
Sets the labels to use for enforcing order other than alphabetical.void
setMatrixValues(ConfusionMatrix.MatrixValues value)
Sets the type of values to generate.void
setPredictedPrefix(String value)
Sets the prefix of the predicted labels.-
Methods inherited from class adams.data.imagesegmentation.operation.AbstractImageSegmentationContainerOperation
check, checkSameDimensions, checkSameDimensions, process
-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Labels
protected BaseString[] m_Labels
the label to use instead of automatically determining.
-
m_ActualPrefix
protected String m_ActualPrefix
the optional prefix for the actual labels.
-
m_PredictedPrefix
protected String m_PredictedPrefix
the optional prefix for the predicted labels.
-
m_MatrixValues
protected ConfusionMatrix.MatrixValues m_MatrixValues
what values to generate.
-
-
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 classAbstractOptionHandler
-
setLabels
public void setLabels(BaseString[] value)
Sets the labels to use for enforcing order other than alphabetical.- Parameters:
value
- the labels
-
getLabels
public BaseString[] getLabels()
Returns the labels to use for enforcing order other than alphabetical.- Returns:
- the labels
-
labelsTipText
public String labelsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setActualPrefix
public void setActualPrefix(String value)
Sets the prefix of the actual labels.- Parameters:
value
- the prefix
-
getActualPrefix
public String getActualPrefix()
Returns the prefix of the actual labels.- Returns:
- the prefix
-
actualPrefixTipText
public String actualPrefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPredictedPrefix
public void setPredictedPrefix(String value)
Sets the prefix of the predicted labels.- Parameters:
value
- the prefix
-
getPredictedPrefix
public String getPredictedPrefix()
Returns the prefix of the predicted labels.- Returns:
- the prefix
-
predictedPrefixTipText
public String predictedPrefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMatrixValues
public void setMatrixValues(ConfusionMatrix.MatrixValues value)
Sets the type of values to generate.- Parameters:
value
- the type of values
-
getMatrixValues
public ConfusionMatrix.MatrixValues getMatrixValues()
Returns the type of values to generate.- Returns:
- the type of values
-
matrixValuesTipText
public String matrixValuesTipText()
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 classAbstractImageSegmentationContainerOperation
- Returns:
- null if no info available, otherwise short string
-
minNumContainersRequired
public int minNumContainersRequired()
Returns the minimum number of containers that are required for the operation.- Specified by:
minNumContainersRequired
in classAbstractImageSegmentationContainerOperation
- Returns:
- the number of containers that are required, <= 0 means no lower limit
-
maxNumContainersRequired
public int maxNumContainersRequired()
Returns the maximum number of containers that are required for the operation.- Specified by:
maxNumContainersRequired
in classAbstractImageSegmentationContainerOperation
- Returns:
- the number of containers that are required, <= 0 means no upper limit
-
generates
public Class generates()
The type of data that is generated.- Specified by:
generates
in classAbstractImageSegmentationContainerOperation
- Returns:
- the class
-
collapse
protected void collapse(Map<String,BufferedImage> layers, List<String> labels, int[] collapsed)
Collapses the layers into a single array, with the label index corresponding to the integer value (label 0 = pixel 1, label 1 = pixel 2, ...).- Parameters:
layers
- the layers to collapselabels
- the labels to collapsecollapsed
- the collapsed array to fill
-
convert
protected Object convert(double value)
Converts the number to integer if COUNTS is used.- Parameters:
value
- the value to convert- Returns:
- the converted value
-
doProcess
protected Object doProcess(ImageSegmentationContainer[] containers)
Performs the actual processing of the containers.- Specified by:
doProcess
in classAbstractImageSegmentationContainerOperation
- Parameters:
containers
- the containers to process- Returns:
- the generated data
-
-