Class OpexObjectLocationsWriter

  • All Implemented Interfaces:
    CleanUpHandler, Destroyable, GlobalInfoSupporter, FileFormatHandler, PrettyPrintingSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<AbstractReportWriter>, SizeOfHandler, ReportWriter<Report>, StringReportWriter<Report>, Serializable, Comparable

    public class OpexObjectLocationsWriter
    extends AbstractReportWriter<Report>
    implements PrettyPrintingSupporter, StringReportWriter<Report>
    Writes polygon annotations in VGG Image Annotator JSON format.
    For more information, see:
    http://www.robots.ox.ac.uk/~vgg/software/via/

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -output <adams.core.io.PlaceholderFile> (property: output)
        The file to write the report to.
        default: ${TMP}/out.json
     
    -finder <adams.data.objectfinder.ObjectFinder> (property: finder)
        The object finder to use.
        default: adams.data.objectfinder.AllFinder
     
    -id <adams.data.report.Field> (property: ID)
        The field to use for storing the ID.
        default: ID[S]
     
    -timestamp <adams.data.report.Field> (property: timestamp)
        The field to use for storing the timestamp.
        default: Timestamp[S]
     
    -label-key <java.lang.String> (property: labelKey)
        The key in the meta-data containing the label, ignored if empty.
        default: type
     
    -score-key <java.lang.String> (property: scoreKey)
        The key in the meta-data containing the sore, ignored if empty.
        default: score
     
    -meta-prefix <java.lang.String> (property: metaPrefix)
        The report field prefix used in the report for the meta-data.
        default: Meta.
     
    -pretty-printing <boolean> (property: prettyPrinting)
        If enabled, the output is printed in a 'pretty' format.
        default: false
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Finder

        protected ObjectFinder m_Finder
        the object finder to use.
      • m_Timestamp

        protected Field m_Timestamp
        the field with the timestamp.
      • m_ID

        protected Field m_ID
        the meta-data key with the ID.
      • m_LabelKey

        protected String m_LabelKey
        the meta-data key with the label.
      • m_ScoreKey

        protected String m_ScoreKey
        the meta-data key with the score.
      • m_MetaPrefix

        protected String m_MetaPrefix
        the prefix for the meta-data.
      • m_PrettyPrinting

        protected boolean m_PrettyPrinting
        whether to use pretty-printing.
    • Constructor Detail

      • OpexObjectLocationsWriter

        public OpexObjectLocationsWriter()
    • Method Detail

      • setFinder

        public void setFinder​(ObjectFinder value)
        Sets the finder to use for locating the objects.
        Parameters:
        value - the finder
      • getFinder

        public ObjectFinder getFinder()
        Returns the finder to use for locating the objects.
        Returns:
        the finder
      • finderTipText

        public String finderTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setID

        public void setID​(Field value)
        Sets the field to use for the ID.
        Parameters:
        value - the field
      • getID

        public Field getID()
        Returns the field to use for the ID.
        Returns:
        the field
      • IDTipText

        public String IDTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setTimestamp

        public void setTimestamp​(Field value)
        Sets the field to use for the timestamp.
        Parameters:
        value - the field
      • getTimestamp

        public Field getTimestamp()
        Returns the field to use for the timestamp.
        Returns:
        the field
      • timestampTipText

        public String timestampTipText()
        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 key in the meta-data containing the label.
        Parameters:
        value - the key
      • getLabelKey

        public String getLabelKey()
        Returns the key in the meta-data containing the label.
        Returns:
        the key
      • 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.
      • setScoreKey

        public void setScoreKey​(String value)
        Sets the key in the meta-data containing the score.
        Parameters:
        value - the key
      • getScoreKey

        public String getScoreKey()
        Returns the key in the meta-data containing the score.
        Returns:
        the key
      • scoreKeyTipText

        public String scoreKeyTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setMetaPrefix

        public void setMetaPrefix​(String value)
        Sets the field prefix used in the report for the meta-data.
        Parameters:
        value - the field prefix
      • getMetaPrefix

        public String getMetaPrefix()
        Returns the field prefix used in the report for the meta-data.
        Returns:
        the field prefix
      • metaPrefixTipText

        public String metaPrefixTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPrettyPrinting

        public void setPrettyPrinting​(boolean value)
        Sets whether to use pretty-printing or not.
        Specified by:
        setPrettyPrinting in interface PrettyPrintingSupporter
        Parameters:
        value - true if to use pretty-printing
      • getPrettyPrinting

        public boolean getPrettyPrinting()
        Returns whether pretty-printing is used or not.
        Specified by:
        getPrettyPrinting in interface PrettyPrintingSupporter
        Returns:
        true if to use pretty-printing
      • prettyPrintingTipText

        public String prettyPrintingTipText()
        Returns the tip text for this property.
        Specified by:
        prettyPrintingTipText in interface PrettyPrintingSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • convert

        protected opex4j.ObjectPredictions convert​(Report data)
        Converts the report into OPEX format.
        Parameters:
        data - the report to convert
        Returns:
        the generated OPEX data
      • writeData

        protected boolean writeData​(Report data)
        Performs the actual writing.
        Specified by:
        writeData in class AbstractReportWriter<Report>
        Parameters:
        data - the data to write
        Returns:
        true if successfully written
      • write

        public String write​(Report data,
                            MessageCollection errors)
        Performs checks and converts the report to a string.
        Specified by:
        write in interface StringReportWriter<Report>
        Parameters:
        data - the data to write
        errors - for collecting errors
        Returns:
        the generated data, null in case of failure