DFKI-Interactive-Machine-Learning / multisensor-pipeline

The core library of the DFKI multisensor pipeline framework.
https://dfki-interactive-machine-learning.github.io/multisensor-pipeline/
Other
9 stars 8 forks source link

Introduce `add_connection` method to `GraphPipeline` #57

Closed Bengt closed 3 years ago

Bengt commented 3 years ago

This adds the add_connection method to the GraphPipeline class. It adds a connection of two nodes and the nodes themselves implicitly. This can help with usability, as it is less error-prone than programming these two steps by hand when creating a pipeline. Also, this allows for considerably shorter pipeline definitions, which helps the readability of the documentation.

Using add and connect:

pipeline = GraphPipeline()
pipeline.add([
    eyetracking_source,
    imagecropping_processor,
    imageclassification_processor,
    video_vis_sink
])
pipeline.connect(eyetracking_source, imagecropping_processor)
pipeline.connect(eyetracking_source, video_vis_sink)
pipeline.connect(imagecropping_processor, imageclassification_processor)
pipeline.connect(imageclassification_processor, video_vis_sink)

Using add_connection:

pipeline = Pipeline()
pipeline.add_connection(eye_tracking_source, image_cropping_processor)
pipeline.add_connection(eye_tracking_source, video_visualizer_sink)
pipeline.add_connection(image_cropping_processor, image_classifier_processor)
pipeline.add_connection(image_classifier_processor, video_visualizer_sink)
Bengt commented 3 years ago

Thanks for merging! I will delete my branch, then.