maanantai 5. helmikuuta 2018

Deep Learning (Feb 5)

Today's topic was deep learning. We started from the traditional 1990's networks by looking at an example of classifying license plate characters; something that our company has done for 20 years. The difference of modern and 1990's nets is that current networks are both deeper (more layers) and larger (individual layers are wider). Moreover, there are structures that were uncommon in the old days, such as convolutional layers, ReLU nonlinearity and dropout regularization. In computational terms, this is all enabled by the computational resources of modern GPU's.

Convolutional networks usually start with a convolutional pipeline, where each layer applies a number of convolutional filters to highlight different things of interest. The convolutional kernels (filter parameters) are learned from the data at training time. Here's an example of convolution in action; highlighting all vertical edges.


The code for reproducing the figure (apart from the data is below).
 
import numpy as np
from scipy.signal import convolve2d 
import cv2
import matplotlib.pyplot as plt

x = cv2.imread("person1.jpg")
x = np.mean(x, axis = -1)

w = np.array([[0,1,1], [0,1,1], [0,1,1]])
w = w - np.mean(w)
y = convolve2d(x, w)

fig, ax = plt.subplots(1, 2, sharex = True, sharey = True)
ax[0].imshow(x, cmap = 'gray')
ax[1].imshow(y, cmap = 'gray')

plt.show()

When a sequence of convolution operations are stacked together, we get powerful feature extraction operators, that are able to modify the data representation into something easy to recognize by computer. For example, the below example illustrated (part of) the processing pipeline of our real-time age estimation demo.


In addition to the convolutions, the pipeline consists of maxpooling and ReLU nonlinearities, with three dense layers on top.

1 kommentti:

Prep for exam, visiting lectures (Feb 22)

On the last lecture, we spent the first 30 minutes on an old exam. In particular, we learned how to calculate the ROC and AUC for a test sam...