Icon

03. Train

Train a U-NetFor Option 1: Create a conda environment for Keras under Preferences -> KNIME -> Python Deep Learning For Option 2: Use the conda environment for Tensorflow2, which was already create in the previous exercise Option 1: Train a Unet using No-Code nodes1. Partition your data using the Partitioning node (Settings: Relative partitioning size 80%, Draw randomly)2. Read in your U-Net from the previous exercise using the Keras Network Reader node3. Use the Conda Environment Propagation node to ensure the correct conda environment (use the Keras environment created in the beginning under Preferences) is selected. 4. Use the Keras Network Learner node to train the model - connections: - use the training data (upper output port from the Partitioning node) as input - use the model from the Keras Network Reader as model input - connect the conda environment flow variable from the Conda Environment Propagation node to the Flow Variable input port - Node Settings: - input column: preprocessed image column "Img Calc" - target column: preprocessed label column "Label Calc" - options: epochs: 15, training batch size: 5, optimizer: Adam - Executable Selection tab: select conda environment flow variable5. Use the Keras Network Executor node to predict on the test data - Node settings: - input columns: preprocessed image column "Img Calc" - add output: select "conv2d_19/Sigmoid:0", Conversion: "To Image", rename column "output" - Executable Selection tab: select conda environment flow variable6. Use Model Writer node to save your trained model to a file named trained.model in the data folder (Hint: use workflow relative path: ../../data/trained.model)7. Use the Interactive Segmentation View node to evaluate your prediction results Option 2: Train a Unet using DL Python nodes1. Partition your data using the Partitioning node (Settings: Relative partitioning size 80%, Draw randomly)2. Use the Conda Environment Propagation node to ensure the correct conda environment (use the Tensorflow2 environment created in the beginning under Preferences) is selected. 3. Read in your U-Net from the previous exercise using the Tensorflow2 Network Reader node - Node Settings: - Executable Selection tab: select conda environment flow variable4. Use the DL Python Network Learner node to train the model - connections: - use the training data (upper output port from the Partitioning node) as input - use the model from the Tensorflow2 Network Reader as model input - connect the conda environment flow variable from the Conda Environment Propagation node to the Flow Variable input port - Node Settings: - Executable Selection tab: select conda environment flow variable5. Use the Tensorflow2 Network Executor node to predict on the test data - Node settings: - input columns: preprocessed image column "Img Calc" - add output: select "conv2d_19/Sigmoid:0", Conversion: "To Image", rename column "output" - Executable Selection tab: select conda environment flow variable6. Use Tensorflow2 Network Writer node to save your trained model to a file named trained_tf2.h5 in the data folder and check "Save optimizer state" (Hint: use workflow relative path: ../../data/trained_tf2.h5)7. Use the Interactive Segmentation View node to evaluate your prediction results training datau-net.h5Epoch: 15convert labelings to bytepredicted labelspredicted labelsconvert labelings to bytetraining datau-net-tf2.h5 Table Reader Keras NetworkReader DL PythonNetwork Learner Image Converter Image to Labeling InteractiveSegmentation View Joiner Joiner Image to Labeling InteractiveSegmentation View Image Converter Table Reader TensorFlow 2Network Reader Conda EnvironmentPropagation Conda EnvironmentPropagation Train a U-NetFor Option 1: Create a conda environment for Keras under Preferences -> KNIME -> Python Deep Learning For Option 2: Use the conda environment for Tensorflow2, which was already create in the previous exercise Option 1: Train a Unet using No-Code nodes1. Partition your data using the Partitioning node (Settings: Relative partitioning size 80%, Draw randomly)2. Read in your U-Net from the previous exercise using the Keras Network Reader node3. Use the Conda Environment Propagation node to ensure the correct conda environment (use the Keras environment created in the beginning under Preferences) is selected. 4. Use the Keras Network Learner node to train the model - connections: - use the training data (upper output port from the Partitioning node) as input - use the model from the Keras Network Reader as model input - connect the conda environment flow variable from the Conda Environment Propagation node to the Flow Variable input port - Node Settings: - input column: preprocessed image column "Img Calc" - target column: preprocessed label column "Label Calc" - options: epochs: 15, training batch size: 5, optimizer: Adam - Executable Selection tab: select conda environment flow variable5. Use the Keras Network Executor node to predict on the test data - Node settings: - input columns: preprocessed image column "Img Calc" - add output: select "conv2d_19/Sigmoid:0", Conversion: "To Image", rename column "output" - Executable Selection tab: select conda environment flow variable6. Use Model Writer node to save your trained model to a file named trained.model in the data folder (Hint: use workflow relative path: ../../data/trained.model)7. Use the Interactive Segmentation View node to evaluate your prediction results Option 2: Train a Unet using DL Python nodes1. Partition your data using the Partitioning node (Settings: Relative partitioning size 80%, Draw randomly)2. Use the Conda Environment Propagation node to ensure the correct conda environment (use the Tensorflow2 environment created in the beginning under Preferences) is selected. 3. Read in your U-Net from the previous exercise using the Tensorflow2 Network Reader node - Node Settings: - Executable Selection tab: select conda environment flow variable4. Use the DL Python Network Learner node to train the model - connections: - use the training data (upper output port from the Partitioning node) as input - use the model from the Tensorflow2 Network Reader as model input - connect the conda environment flow variable from the Conda Environment Propagation node to the Flow Variable input port - Node Settings: - Executable Selection tab: select conda environment flow variable5. Use the Tensorflow2 Network Executor node to predict on the test data - Node settings: - input columns: preprocessed image column "Img Calc" - add output: select "conv2d_19/Sigmoid:0", Conversion: "To Image", rename column "output" - Executable Selection tab: select conda environment flow variable6. Use Tensorflow2 Network Writer node to save your trained model to a file named trained_tf2.h5 in the data folder and check "Save optimizer state" (Hint: use workflow relative path: ../../data/trained_tf2.h5)7. Use the Interactive Segmentation View node to evaluate your prediction results training datau-net.h5Epoch: 15convert labelings to bytepredicted labelspredicted labelsconvert labelings to bytetraining datau-net-tf2.h5 Table Reader Keras NetworkReader DL PythonNetwork Learner Image Converter Image to Labeling InteractiveSegmentation View Joiner Joiner Image to Labeling InteractiveSegmentation View Image Converter Table Reader TensorFlow 2Network Reader Conda EnvironmentPropagation Conda EnvironmentPropagation

Nodes

Extensions

Links