Skip to content

kolena.workflow.define_workflow#

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.