Eye-Deep
Detecting Diabetes
with Convolutional Neural Networks
team o_O
Mathis Antony
sveitser@gmail.com
Stephan Brüggemann
Intro
Neurons
Artificial Neurons
ReLU: max(x, 0)
Leaky ReLU: max(x/100, x)
x (sum of inputs)
y (output)
Rectified Linear Unit: ReLU
inputs
output
1. sum inputs
2. activation function
Forward Pass on Toy Neural Network
output
input
tail
age
weights
1
-1
-2
3
1
2
-1
2
-2
weights
tail? = yes | age = 3 | grumpiness = 10
loss/error:
1
3
1·1 - 2·3 = -5
-1·1 + 3·3 = 8
1·1 + 2·2 = 5
1·5 + 2·8 - 2·5 = 11
Gradient Descent
Training
Image Convolutions
-1 | -1 | -1 |
-1 | 8 | -1 |
-1 | -1 | -1 |
deeplearning.stanford.edu/wiki/index.php/Feature_extraction_using_convolution
-1 | 0 | -1 |
0 | -1 | 0 |
-1 | 0 | -1 |
filter
Max Pooling
pool size 3
1 | 1 | 1 | 1 | 7 |
0 | 2 | 1 | 1 | 2 |
1 | 2 | 4 | 0 | 1 |
2 | 4 | 5 | 5 | 6 |
2 | 4 | 1 | 4 | 2 |
| |
| |
4
7
4 | 7 |
5 | 6 |
5
stride 2
max pooling
pool size 3
stride 2
from sklearn.datasets import load_digits�d = load_digits()�
X = d.images
# reshape to n_samples, n_channels, n_x, n_y�# and convert to 32-bit (to train on GPU)
X = X.reshape((-1, 1, 8, 8)).astype('f4')��# standardize�X = (X - X.mean()) / X.std()��# convert target to 32-bit int�y = d.target.astype('i4')�
from lasagne import layers�from lasagne.nonlinearities import softmax��my_layers = [� (layers.InputLayer, {'shape': (None, 1, 8, 8)}),� (layers.Conv2DLayer, {'num_filters': 64,� 'filter_size': (3, 3)}),� (layers.MaxPool2DLayer, {'pool_size': (3, 3),� 'stride': (2, 2)}),� (layers.DenseLayer, {'num_units': 20}),� (layers.DenseLayer, {'num_units': 10,� 'nonlinearity': softmax}),�]�
from nolearn.lasagne import NeuralNet�net = NeuralNet(my_layers, verbose=1,
max_epochs=20,� update_learning_rate=0.02)�# train network�net.fit(X, y)�# make predictions�y_pred = net.predict(X)
$python nn_example.py
Using gpu device 0: GeForce GTX 980 Ti (CNMeM is disabled)
## Layer information
# name size
--- ---------- ------
0 input0 1x8x8
1 conv2d1 64x6x6
2 maxpool2d2 64x3x3
3 dense3 20
4 dense4 10
�
epoch train loss valid loss train/val valid acc dur�------- ------------ ------------ ----------- ----------- -----� 1 2.17409 1.94451 1.11807 0.55025 0.09s� 2 1.67648 1.35972 1.23297 0.64005 0.09s� 3 1.03381 0.75170 1.37530 0.89149 0.10s� 4 0.56765 0.41487 1.36825 0.90712 0.10s� 5 0.33763 0.27013 1.24991 0.94387 0.09s
...� 18 0.02589 0.07183 0.36048 0.98438 0.10s� 19 0.02325 0.07053 0.32962 0.98438 0.09s� 20 0.02129 0.06951 0.30625 0.98698 0.10s�
Kaggle https://www.kaggle.com
Problem
Metric
Dataset
stage 0
stage 1
stage 2
stage 3
stage 4
What are we looking for?
Saiprasad Ravishankar, Arpit Jain, Anurag Mittal
IEEE Conf. on Computer Vision Pattern Recognition (CVPR) 2009 http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=5206763
Preprocessing
Augmentation
Layer Types
5
2
8
1
9
2
2
5
5
0
0
1
9
0
2
0
3
5
5
2
1
2
Network Architecture
Network Architecture
Convolution (4x4)
Pooling (3x3, stride 2)
Dropout
Maxout
Fully Connected
32
64
128
1024
256
512
1024
512
512
Training
What does it “see”?
input (stage 1)
5x5 pixel occluded prediction
overlay
Visualizing and Understanding Convolutional Networks
Matthew D Zeiler, Rob Fergus
http://arxiv.org/abs/1311.2901
What does it “see”?
input (stage 1)
Visualizing and Understanding Convolutional Networks
Matthew D Zeiler, Rob Fergus
http://arxiv.org/abs/1311.2901
Feature Extraction
output of last pooling layer → features
Test Time Averaging (TTA)
“Per Patient” Blend
right eye label for patients
with left eye label 3
Final Result
HK Electric wins too
Thank you
Q&A