![]() |
ImFusion SDK 4.3
|
#include <ImFusion/ML/OperationsSequence.h>
Class to execute a sequence of Operation, depending on the workflow phase (training, validation, etc.). More...
Class to execute a sequence of Operation, depending on the workflow phase (training, validation, etc.).
Public Types | |
using | PhasedOperation = std::pair<std::shared_ptr<Operation>, Phase> |
Public Member Functions | |
OperationsSequence (bool verbose=false) | |
OperationsSequence (const std::vector< Operation::Specs > &pipelineConfig, bool verbose=false) | |
Constructs an operation sequence from a sequence of specification, each for a different operation. | |
OperationsSequence (const OperationsSequence &that)=delete | |
OperationsSequence & | operator= (const OperationsSequence &that)=delete |
OperationsSequence (OperationsSequence &&that)=default | |
OperationsSequence & | operator= (OperationsSequence &&that)=default |
Status | addOperation (const Operation::Specs &specs) |
Add an operation specified by a configuration spec. | |
Status | addOperation (std::shared_ptr< Operation > op, Phase phase=Phase::Always) |
Add an existing operation. | |
Status | process (DataItem &item, Phase phase=Phase::Always) const |
Apply sequence of operations on all elements of the data item. | |
std::shared_ptr< SharedImageSet > | process (std::shared_ptr< SharedImageSet > input, Phase phase=Phase::Always) const |
Helper function to apply the sequence of operations on one input image. | |
std::pair< std::shared_ptr< SharedImageSet >, std::shared_ptr< SharedImageSet > > | process (std::shared_ptr< SharedImageSet > input, std::shared_ptr< SharedImageSet > label, Phase phase=Phase::Always) const |
Helper function to apply the sequence of operations on input image and label. | |
std::vector< std::string > | getOperationNames () const |
Returns the names of the operations added so far. | |
std::vector< std::shared_ptr< Operation > > | operations () |
Returns a vector of shared_ptrs to the operations added so far. | |
bool | ok () const |
Returns whether the operations sequence setup was successful. | |
Status | status () const |
Returns status of the operations sequence setup. | |
void | resetOperationSeeds () |
Resets the random generator seeding of all the operations that where explicitly configured with a "seed" parameter. | |
void | setOperationSeeds (unsigned int seed) |
Sets the random generator seeding of all the operations. | |
void | setVerbose (bool verbose) |
Set the verbose flag. | |
void | setOperationsComputingDevice (ML::ComputingDevice device) |
Set the computing device of all current operations. | |
void | setErrorOnUnexpectedBehaviour (bool treatWarningsAsErrors) |
Treat unexpected behaviour warnings as errors. | |
bool | doesNotModifyInput () const |
Returns true if the operation is guaranteed to not modify its input (either because it computes its output out-of-place or because it is a no-op). | |
|
explicit |
Constructs an operation sequence from a sequence of specification, each for a different operation.
At each call to process each operation is applied in the order they were specified.
pipelineConfig | processing pipeline configuration sequence |
Status addOperation | ( | const Operation::Specs & | specs | ) |
Add an operation specified by a configuration spec.
Status addOperation | ( | std::shared_ptr< Operation > | op, |
Phase | phase = Phase::Always ) |
Add an existing operation.
op | the operation to add |
phase | limits application of the op to a specific phase (i.e. Training, or Test) |
bool doesNotModifyInput | ( | ) | const |
Returns true if the operation is guaranteed to not modify its input (either because it computes its output out-of-place or because it is a no-op).
This can be used to decide whether a copy of the input should be made before calling the OperationsSequence::process function. Note that this only relates to the overloads taking specific elements as inputs (e.g. images, keypoints, etc.), since the OperationsSequence::process(DataItem& item) function always modifies its input.