After creating a model (especially a DL Python Model), that model will be used to make predictions given new input data. Sometimes the need to make such predictions can occur much later in a Workflow and in different Python nodes. Loading and reloading these models to make a prediction can become costly.
This Workflow introduces a pattern for preserving a DL Python Model in memory such that it can be used to make predictions on-demand without needing to reload it each time. It consists of three reusable Components:
1. a Component to preserve the model in memory and make it possible to call the model's predict() method, on-demand;
2. a Component to call the model's predict() method; and
3. a Component to release the model from memory, once it is no longer needed anywhere in the Workflow.
As a practical demo, this Workflow employs Keras+TensorFlow2's definition of resnet50 to recognize common objects depicted in one or more input images.
Workflow
Python Efficient Repeat Use of Model
Used extensions & nodes
Created with KNIME Analytics Platform version 4.2.1
Legal
By using or downloading the workflow, you agree to our terms and conditions.