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 classConfusionMatrix.MatrixValuesDefines what values to show.
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_ActualPrefixthe optional prefix for the actual labels.protected BaseString[]m_Labelsthe label to use instead of automatically determining.protected ConfusionMatrix.MatrixValuesm_MatrixValueswhat values to generate.protected Stringm_PredictedPrefixthe optional prefix for the predicted labels.protected Stringm_UnlabeledTextthe unlabeled text to use.-
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 StringactualPrefixTipText()Returns the tip text for this property.protected voidcollapse(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 Objectconvert(double value)Converts the number to integer if COUNTS is used.voiddefineOptions()Adds options to the internal list of options.protected ObjectdoProcess(ImageSegmentationContainer[] containers)Performs the actual processing of the containers.Classgenerates()The type of data that is generated.StringgetActualPrefix()Returns the prefix of the actual labels.BaseString[]getLabels()Returns the labels to use for enforcing order other than alphabetical.ConfusionMatrix.MatrixValuesgetMatrixValues()Returns the type of values to generate.StringgetPredictedPrefix()Returns the prefix of the predicted labels.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetUnlabeledText()Returns the text to use in the confusion matrix for unlabeled pixels.StringglobalInfo()Returns a string describing the object.StringlabelsTipText()Returns the tip text for this property.StringmatrixValuesTipText()Returns the tip text for this property.intmaxNumContainersRequired()Returns the maximum number of containers that are required for the operation.intminNumContainersRequired()Returns the minimum number of containers that are required for the operation.StringpredictedPrefixTipText()Returns the tip text for this property.voidsetActualPrefix(String value)Sets the prefix of the actual labels.voidsetLabels(BaseString[] value)Sets the labels to use for enforcing order other than alphabetical.voidsetMatrixValues(ConfusionMatrix.MatrixValues value)Sets the type of values to generate.voidsetPredictedPrefix(String value)Sets the prefix of the predicted labels.voidsetUnlabeledText(String value)Sets the text to use in the confusion matrix for unlabeled pixels.StringunlabeledTextTipText()Returns the tip text for this property.-
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.
-
m_UnlabeledText
protected String m_UnlabeledText
the unlabeled text to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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.
-
setUnlabeledText
public void setUnlabeledText(String value)
Sets the text to use in the confusion matrix for unlabeled pixels.- Parameters:
value- the type of values
-
getUnlabeledText
public String getUnlabeledText()
Returns the text to use in the confusion matrix for unlabeled pixels.- Returns:
- the text
-
unlabeledTextTipText
public String unlabeledTextTipText()
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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
minNumContainersRequiredin 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:
maxNumContainersRequiredin 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:
generatesin 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:
doProcessin classAbstractImageSegmentationContainerOperation- Parameters:
containers- the containers to process- Returns:
- the generated data
-
-