Icon

04 Image Classification

04 Image Classification - Exercise

This workflow shows a hands-on exercise in the L4-DL Introduction to Deep Learning self-paced course

Task 3. Define the structure of your CNN network. A possible solution can be:- Keras Input Layer node configured with input shape 28, 28, 1- Keras Convolution 2D Layer node: - Filters: 32 - Kernel size: 3,3 - Dilation Rate: 2,2 - Activation Function: ReLu- Keras Max Pooling 2D Layer node: Pool size (2,2) and Stride (2,2), valid Padding- Keras Flatten Layer node- Keras Dense Layer node: 100 units, ReLu activation function- Keras Dense Layer node: 10 units, Softmax activation function TIP: use Name prefix to mark the output layer Task 4. Train and apply the network1. Add a Keras Network Learner node to train the CNNnetwork defined in Task 32. Set conversion From Image (Auto Mapping) and selectthe Image column as input data3. Set conversion From Collection of Number (Integer) toOne-Hot Tensor and select the collection column astarget data4. Select Categorical cross entropy as loss function andtrain for 10 epochs.5. Apply the model to the test set using the Keras NetworkExecutor node6. Check the box to keep input columns in the outputtable TIP: select the correct input column. If you cannotsee it, check if the correct conversion is applied Task 5. Extract prediction and evaluate1. Reduce the network output to a single column with theMany to One node. Retain the column with the highestvalue. Name the new column "Detected Digit"2. Execute the preconfigured Column Expression toextract the predicted digit3. Add a scorer node and evaluate the performance of themodel Task 0. Prepare training dataset1. Execute the Decompress Files node. It willunzip the train dataset and create a new folder(data/images) containing 10000 images fromthe MNIST dataset.2. Execute the Prepare files metanode. Itformats the data table and appends a columncontaining the actual digit for each image. Requirements- KNIME Expressions- KNIME Image Processing- KNIME Image Processing - Deep Learning Extension Task 2. Preprocess images1. Use the Image Calculator node to normalize images.TIP: Result Pixel Type should be FLOATTYPE. Include thefollowing expression $Image$ / 2552. Convert the Actual Digit column into a collection with a singleelement. Use the Create Collection Column node3. Partiton the data into training (80%) and testing (20%) set Task 1. Read image dataset1. Use a Path to String node to convert the Pathcolumn into string format2. Add an Image Reader (Table) node to loadthe images into KNIME extract predicted digitUnzip image dataExtract img index,sort rows and appendtarget digit Column Expressions Decompress Files Prepare files Task 3. Define the structure of your CNN network. A possible solution can be:- Keras Input Layer node configured with input shape 28, 28, 1- Keras Convolution 2D Layer node: - Filters: 32 - Kernel size: 3,3 - Dilation Rate: 2,2 - Activation Function: ReLu- Keras Max Pooling 2D Layer node: Pool size (2,2) and Stride (2,2), valid Padding- Keras Flatten Layer node- Keras Dense Layer node: 100 units, ReLu activation function- Keras Dense Layer node: 10 units, Softmax activation function TIP: use Name prefix to mark the output layer Task 4. Train and apply the network1. Add a Keras Network Learner node to train the CNNnetwork defined in Task 32. Set conversion From Image (Auto Mapping) and selectthe Image column as input data3. Set conversion From Collection of Number (Integer) toOne-Hot Tensor and select the collection column astarget data4. Select Categorical cross entropy as loss function andtrain for 10 epochs.5. Apply the model to the test set using the Keras NetworkExecutor node6. Check the box to keep input columns in the outputtable TIP: select the correct input column. If you cannotsee it, check if the correct conversion is applied Task 5. Extract prediction and evaluate1. Reduce the network output to a single column with theMany to One node. Retain the column with the highestvalue. Name the new column "Detected Digit"2. Execute the preconfigured Column Expression toextract the predicted digit3. Add a scorer node and evaluate the performance of themodel Task 0. Prepare training dataset1. Execute the Decompress Files node. It willunzip the train dataset and create a new folder(data/images) containing 10000 images fromthe MNIST dataset.2. Execute the Prepare files metanode. Itformats the data table and appends a columncontaining the actual digit for each image. Requirements- KNIME Expressions- KNIME Image Processing- KNIME Image Processing - Deep Learning Extension Task 2. Preprocess images1. Use the Image Calculator node to normalize images.TIP: Result Pixel Type should be FLOATTYPE. Include thefollowing expression $Image$ / 2552. Convert the Actual Digit column into a collection with a singleelement. Use the Create Collection Column node3. Partiton the data into training (80%) and testing (20%) set Task 1. Read image dataset1. Use a Path to String node to convert the Pathcolumn into string format2. Add an Image Reader (Table) node to loadthe images into KNIME extract predicted digitUnzip image dataExtract img index,sort rows and appendtarget digit Column Expressions Decompress Files Prepare files

Nodes

Extensions

Links