Deep Learning - Exercise 02

Learning goal: In this exercise you shall learn how to read in MNIST training and testing data and filter example MNIST images with a filter bank.

1. Reading in data from the MNIST data set

The MNIST dataset is an important (old) training and test data set. I wrote a MNIST dataset reader in C++ for this lecture, see here. You can download the code as a Visual Studio 2015 project from github. So

  • Go to the new Exercises-Deep-Learning repository I have created for this lecture and download the project.
  • Create a new environment variable OPENCV_DIR, e.g., using Rapid Enviroment Editor and set it to the path where you have stored the OpenCV library - before opening Visual Studio.
  • Open the mnist.sln with Visual Studio and try to compile and run the project.

2. Filtering MNIST images with a filter bank

First prepare a std::vector that stores some 5x5 filter kernel cv::Mat matrices. We call this a filter bank. You can predefine these filter kernel matrices manually or randomly generate the filter kernel values.

Then randomly choose 10 MNIST images using the provided class mnist_dataset_reader and filter each of these 10 MNIST images with all the filters in the filter bank and visualize the input image and the filter results in one big image.

The resulting visualization could look like this (here the filter bank has a size of 8 filter kernels):