Icon

Image Classification Application

This workflow reads images of cats and dogs, performs some simple preprocessing, and trains and evaluates a Convolutional Neural Network (CNN) that is able to distinguish cat images from dog images.

Reference:
F. Villaroel Ordenes & R. Silipo, “Machine learning for marketing on the KNIME Hub: The development of a live repository for marketing applications”, Journal of Business Research 137(1):393-410, DOI: 10.1016/j.jbusres.2021.08.036.


Annotations and comments
  • Image Classification Application This workflow reads images of cats and dogs, performs some image preprocessing, and trains and evaluates a Convolutional Neural Network (CNN) for image classification.
  • Define CNN architecture
  • Train and evaluate the CNN
  • The Conda Environment Propagation node ensures the existence of a Conda environment with all packages. Another option is to setup your Python integration to use a Conda environment with all packages as described here: https://docs.knime.com/2021-12/deep_learning_installation_guide/index.html#dl_python_setup
  • Read and preprocess images
  • Find the data here! https://www.kaggle.com/c/dogs-vs-cats/data
  • Remove superfluous columns
  • Set up conda environment
  • Normalize between 0..1
  • Read images
  • Resize to 150x150
  • filters: 32 kernel size: 3x3 activation: ReLU
  • units: 64 kernel size: 3x3 activation: ReLU
  • units: 64 activation: ReLU
  • units: 1 activation: sigmoid
  • dropout: 0.5
  • shape: 150, 150, 3
  • pool size: 2x2
  • Apply the model on new data
  • Train the model for 10 epochs (Adam) with loss function binary cross entropy
  • Save model
  • Select folder with images
  • Extract class from file name
  • output >= 0.5 Cat output < 0.5 Dog
  • Encode classes with 0 and 1
  • Evaluate the model accuracy

Nodes

Extensions

Links