#
Wolfram Neural Net Repository

Immediate Computable Access to Neural Net Models

Identify the handwritten digit in an image

This pioneer work for image classification with convolutional neural nets was released in 1998. It was developed by Yann LeCun and his collaborators at AT&T Labs while they experimented with a large range of machine learning solutions for classification on the MNIST dataset.

Number of layers: 147 | Parameter count: 5,978,677 | Trained size: 1,750 KB |

- MNIST Database of Handwritten Digits, consisting of 60,000 training and 10,000 test grayscale images of size 28x28.

This model achieves 98.5% accuracy on the MNIST dataset.

Retrieve the pre-trained net:

In[1]:= |

Out[1]= |

Apply the trained net to a set of inputs:

In[2]:= |

Out[2]= |

Give class probabilities for a single input:

In[3]:= |

Out[3]= |

Create a subset of the MNIST dataset:

In[4]:= |

Out[4]= |

Remove the last linear layer of the net, which will be used as a feature extractor:

In[5]:= |

Out[5]= |

Visualize the features of a subset of the MNIST dataset:

In[6]:= |

Out[6]= |

Extract the convolutional features from the first layer:

In[7]:= |

Out[7]= |

Visualize the features:

In[8]:= |

Out[8]= |

Retrieve the uninitialized architecture:

In[9]:= |

Out[9]= |

Retrieve the MNIST dataset:

In[10]:= |

Out[10]= |

Use the training dataset provided:

In[11]:= |

Out[11]= |

Use the test dataset provided:

In[12]:= |

Out[12]= |

Train the net:

In[13]:= |

Out[13]= |

Generate a ClassifierMeasurementsObject of the net with the test set:

In[14]:= |

Out[14]= |

Evaluate the accuracy on the validation set:

In[15]:= |

Out[15]= |

Visualize the confusion matrix:

In[16]:= |

Out[16]= |

Inspect the number of parameters of all arrays in the net:

In[17]:= |

Out[17]= |

Obtain the total number of parameters:

In[18]:= |

Out[18]= |

Obtain the layer type counts:

In[19]:= |

Out[19]= |

Display the summary graphic:

In[20]:= |

Out[20]= |

Export the net into a format that can be opened in MXNet:

In[21]:= |

Out[21]= |

Export also creates a *net.params *file containing parameters:

In[22]:= |

Out[22]= |

Get the size of the parameter file:

In[23]:= |

Out[23]= |

The size is similar to the byte count of the resource object:

In[24]:= |

Out[24]= |

Represent the MXNet net as a graph:

In[25]:= |

Out[25]= |

Wolfram Language 11.1 (March 2017) or above

- Y. LeCun, L. Bottou, Y. Bengio, P. Haffner, "Gradient-Based Learning Applied to Document Recognition," Proceedings of the IEEE, 86(11), 2278-2324 (1998)
- (available from http://yann.lecun.com/exdb/lenet)