Icon

03_​Fine-tune_​ResNet50

Fine-tune VGG16
KNIME Deep Learning - Classify Cats and Dogs In this series of workflows we want to demonstrate how to solve an image classification problem using KNIME Deep Learning - Keras Integration.We want to train a model to distinguish cats and dogs on images. Please note: The workflow series is heavily inspired by the great blog-post of François Chollet (see https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html.)1. Workflow 01 Preprocess image data2. Workflow 02 Train simple CNN3. Workflow 03 Fine-tune ResNet50: In this workflow we are fine-tuning a ResNet50 (https://keras.io/api/applications/resnet/#resnet50-function). First, wedownload the network from Keras using the DL Python Network Creator node. To implement the fine-tuning approach, we freeze the parameters of all networklayers except for batch normalization layers. This is done to allow the normalization to adapt to the new data. Finally, we add a new trainable network head tooutput cat and dog probabilities (the original network head is already removed when loading the model from Keras). In order to run the example, please make sure you have the following KNIME extensions installed:- KNIME Deep Learning - Keras Integration (Labs)- KNIME Image Processing (Community Contributions Trusted)- KNIME Image Processing - Deep Learning Extension (Community Contributions Trusted)- KNIME Image Processing - Python Extension (Community Contributions Trusted)You also need a local Python installation that includes Keras. Please refer to https://www.knime.com/deeplearning#keras for installation recommendations andfurther information. Download networkfrom Keras.Fine-tune last layersFreeze the backbone(except batch norm)Apply the modelRead training dataRead testing dataTurn probabilitiesto class labelsNode 294 RowID DL PythonNetwork Creator Keras NetworkLearner Add Top Keras Freeze Layers Keras NetworkExecutor Table Reader Table Reader Create One-hotVector Format NetworkOutput Scorer KNIME Deep Learning - Classify Cats and Dogs In this series of workflows we want to demonstrate how to solve an image classification problem using KNIME Deep Learning - Keras Integration.We want to train a model to distinguish cats and dogs on images. Please note: The workflow series is heavily inspired by the great blog-post of François Chollet (see https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html.)1. Workflow 01 Preprocess image data2. Workflow 02 Train simple CNN3. Workflow 03 Fine-tune ResNet50: In this workflow we are fine-tuning a ResNet50 (https://keras.io/api/applications/resnet/#resnet50-function). First, wedownload the network from Keras using the DL Python Network Creator node. To implement the fine-tuning approach, we freeze the parameters of all networklayers except for batch normalization layers. This is done to allow the normalization to adapt to the new data. Finally, we add a new trainable network head tooutput cat and dog probabilities (the original network head is already removed when loading the model from Keras). In order to run the example, please make sure you have the following KNIME extensions installed:- KNIME Deep Learning - Keras Integration (Labs)- KNIME Image Processing (Community Contributions Trusted)- KNIME Image Processing - Deep Learning Extension (Community Contributions Trusted)- KNIME Image Processing - Python Extension (Community Contributions Trusted)You also need a local Python installation that includes Keras. Please refer to https://www.knime.com/deeplearning#keras for installation recommendations andfurther information. Download networkfrom Keras.Fine-tune last layersFreeze the backbone(except batch norm)Apply the modelRead training dataRead testing dataTurn probabilitiesto class labelsNode 294 RowID DL PythonNetwork Creator Keras NetworkLearner Add Top Keras Freeze Layers Keras NetworkExecutor Table Reader Table Reader Create One-hotVector Format NetworkOutput Scorer

Nodes

Extensions

Links