Icon

Building CNN Predictor for cats and dogs images - Exercise

Classifying Images of Cats and Dogs - Training (Exercise)
2. Read and preprocess images: This workflow part reads the images of cats and dogs, encodes the twoclasses (cats = 1 and dogs = 0), and performs some image preprocessing -- e.g., normalization of theimages to be represented with values between 0 and 1 (Image Calculator), resizing the images to a fixed size(Image Resizer node). 1. Define network architecture: The Keras Layer nodes define a CNN for a binary image classification task. 3. Train, execute, and evalutate network: The Keras Network Learner nodes train theKeras network. In the configuration window you can define the loss functions and thetraining parameters. The Learning Monitor view of the node shows the performanceimprovement during training. The Conda Environment Propagation node ensures the existence of a Conda environmentwith all packages. Another option is to setup your Python integration to use a Condaenvironment with all packages as described here: https://docs.knime.com/2021-12/deep_learning_installation_guide/index.html#dl_python_setup IMPORTANT!To execute the workflow you needto download the training datasetfrom Kaggle and update the pathin the List Files / Folders Nodeinside this metanode. The pathshould point to the unzipped folderincluding the images.https://www.kaggle.com/c/dogs-vs-cats/data Exercise - Classifying Images of Cats and Dogs - TrainingImprove the performance of the simple CNN for image classification. Play around with hyperparameter optimization and/or the network architecture. shape: 150, 150, 3Train the model for 10 epochs (Adam) withloss function binary crossentropyApply the modelon new dataoutput >= 0.5 Catoutput < 0.5 DogEvaluate the modelResize to 150x150Path to training imagesNormalize between 0..1Read imagesRemove superfluous columnsSave modelSet up condaenvironmentEncode classeswith 0 and 1 Keras Input Layer Keras NetworkLearner Keras NetworkExecutor Rule Engine Scorer Image Resizer Paths to images Image Calculator Image Reader(Table) Column Filter Partitioning Keras NetworkWriter Conda EnvironmentPropagation Rule Engine 2. Read and preprocess images: This workflow part reads the images of cats and dogs, encodes the twoclasses (cats = 1 and dogs = 0), and performs some image preprocessing -- e.g., normalization of theimages to be represented with values between 0 and 1 (Image Calculator), resizing the images to a fixed size(Image Resizer node). 1. Define network architecture: The Keras Layer nodes define a CNN for a binary image classification task. 3. Train, execute, and evalutate network: The Keras Network Learner nodes train theKeras network. In the configuration window you can define the loss functions and thetraining parameters. The Learning Monitor view of the node shows the performanceimprovement during training. The Conda Environment Propagation node ensures the existence of a Conda environmentwith all packages. Another option is to setup your Python integration to use a Condaenvironment with all packages as described here: https://docs.knime.com/2021-12/deep_learning_installation_guide/index.html#dl_python_setup IMPORTANT!To execute the workflow you needto download the training datasetfrom Kaggle and update the pathin the List Files / Folders Nodeinside this metanode. The pathshould point to the unzipped folderincluding the images.https://www.kaggle.com/c/dogs-vs-cats/data Exercise - Classifying Images of Cats and Dogs - TrainingImprove the performance of the simple CNN for image classification. Play around with hyperparameter optimization and/or the network architecture. shape: 150, 150, 3Train the model for 10 epochs (Adam) withloss function binary crossentropyApply the modelon new dataoutput >= 0.5 Catoutput < 0.5 DogEvaluate the modelResize to 150x150Path to training imagesNormalize between 0..1Read imagesRemove superfluous columnsSave modelSet up condaenvironmentEncode classeswith 0 and 1 Keras Input Layer Keras NetworkLearner Keras NetworkExecutor Rule Engine Scorer Image Resizer Paths to images Image Calculator Image Reader(Table) Column Filter Partitioning Keras NetworkWriter Conda EnvironmentPropagation Rule Engine

Nodes

Extensions

Links