classPiiClassInfoMapper
#include <PiiClassInfoMapper.h>
An operation that maps class indices to arbitrary data.
Inherits PiiDefaultOperation
Description
Useful when classification results need to be coupled with, say, image file names. The training mode, the operation collects class indices and the corresponding data into a look-up table. In normal operation, the data corresponding to the input class index will be emitted.
Inputs
false.
Outputs
Properties
|
Default value for classes that we haven't learned yet. |
|
|
int
|
Maximum number of classes allowed. |
|
bool
|
If |
Constructors and destructor
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
( )
|
|
|
int
|
( )
|
|
void
|
|
|
void
|
(
|
|
void
|
(
|
|
bool
|
( )
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
PiiVariant defaultValue
[read, write]Default value for classes that we haven't learned yet.
The default value is
null. Therefore, one must almost always set the default value before running the operation. -
int maxClasses
[read, write]Maximum number of classes allowed.
Default value is 1024. The operation will store data for class indices ranging from 0 to maxClasses-1.
-
bool training
[read, write]If
true, the operation collects incoming data.If
false, the collected data is used as output.
Function details
-
PiiClassInfoMapper
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
PiiVariant defaultValue
() -
int maxClasses
() -
void setDefaultValue
-
void setMaxClasses
(- int maxClasses
-
void setTraining
(- bool training
-
bool training
() -
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.