Skip to content

kolena.workflow.define_workflow#

Legacy Warning

Content in this section reflects outdated practices or deprecated features. It's recommended to avoid using these in new developments.

While existing implementations using these features will continue to receive support, we strongly advise adopting the latest standards and tools for new projects to ensure optimal performance and compatibility. For more information and up-to-date practices, please refer to our newest documentation at docs.kolena.io.

define_workflow(name, test_sample_type, ground_truth_type, inference_type) #

Define a new workflow, specifying its test sample, ground truth, and inference types.

from kolena.workflow import define_workflow

from my_code import MyTestSample, MyGroundTruth, MyInference

_, TestCase, TestSuite, Model = define_workflow(
    "My Workflow",
    MyTestSample,   # extends e.g. kolena.workflow.Image (or uses directly)
    MyGroundTruth,  # extends kolena.workflow.GroundTruth
    MyInference,    # extends kolena.workflow.Inference
)

define_workflow is provided as a convenience method to create the TestCase, TestSuite, and Model objects for a new workflow. These objects can also be defined manually by subclassing them and binding the workflow class variable:

from kolena.workflow import TestCase

from my_code import my_workflow

class MyTestCase(TestCase):
    workflow = my_workflow

Parameters:

Name Type Description Default
name str

The name of the workflow.

required
test_sample_type Type[TestSample]

The type of the TestSample for this workflow.

required
ground_truth_type Type[GroundTruth]

The type of the GroundTruth for this workflow.

required
inference_type Type[Inference]

The type of the Inference for this workflow.

required

Returns:

Type Description
Tuple[Workflow, Type[TestCase], Type[TestSuite], Type[Model]]

The Workflow object for this workflow along with the TestCase, TestSuite, and Model objects to use when creating and running tests for this workflow.