# Wolfram Neural Net Repository

Immediate Computable Access to Neural Net Models

Identify the main object in an image

Released in 2014 by the Visual Geometry Group at the University of Oxford, this family of architectures achieved second place for the 2014 ImageNet Classification competition. It is noteworthy for its extremely simple structure, being a simple linear chain of layers, with all the convolutional layers having a kernel size of 3x3. Despite this simple structure, it achieves competitive classification accuracy compared to more complicated nets (such as GoogLeNet), although at the cost of slower evaluation speed and much larger net size.

Number of layers: 40 | Parameter count: 138,357,544 | Trained size: 554 MB |

- ImageNet Large Scale Visual Recognition Challenge 2012 classification dataset, consisting of 1.2 million training images, with 1,000 classes of objects.

This model achieves 75.2% top-1 and 92.5% top-5 accuracy on the ImageNet Large Scale Visual Recognition Challenge 2012 dataset.

Get the pre-trained net:

In[1]:= |

Out[1]= |

Classify an image:

In[2]:= |

Out[2]= |

The prediction is an Entity object, which can be queried:

In[3]:= |

Out[3]= |

Get a list of available properties of the predicted Entity:

In[4]:= |

Out[4]= |

Obtain the probabilities of the ten most likely entities predicted by the net:

In[5]:= |

Out[5]= |

An object outside the list of the ImageNet classes will be misidentified:

In[6]:= |

Out[6]= |

Obtain the list of names of all available classes:

In[7]:= |

Out[7]= |

Remove the last three layers of the trained net so that the net produces a vector representation of an image:

In[8]:= |

Out[8]= |

Get a set of images:

In[9]:= |

Visualize the features of a set of images:

In[10]:= |

Out[10]= |

Extract the weights of the first convolutional layer in the trained net:

In[11]:= |

Visualize the weights as a list of 64 images of size 3x3:

In[12]:= |

Out[12]= |

Use the pre-trained model to build a classifier for telling apart images of dogs and cats. Create a test set and a training set:

In[13]:= |

In[14]:= |

Remove the linear layer from the pre-trained net:

In[15]:= |

Out[15]= |

Create a new net composed of the pre-trained net followed by a linear layer and a softmax layer:

In[16]:= |

Out[16]= |

Train on the dataset, freezing all the weights except for those in the "linearNew" layer (use TargetDevice -> "GPU" for training on a GPU):

In[17]:= |

Out[17]= |

Perfect accuracy is obtained on the test set:

In[18]:= |

Out[18]= |

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

In[19]:= |

Out[19]= |

Obtain the total number of parameters:

In[20]:= |

Out[20]= |

Obtain the layer type counts:

In[21]:= |

Out[21]= |

Display the summary graphic:

In[22]:= |

Out[22]= |

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

In[23]:= |

Out[23]= |

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

In[24]:= |

Out[24]= |

Get the size of the parameter file:

In[25]:= |

Out[25]= |

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

In[26]:= |

Out[26]= |

Represent the MXNet net as a graph:

In[27]:= |

Out[27]= |

Wolfram Language 11.1 (March 2017) or above

- K. Simonyan, A. Zisserman, "Very Deep Convolutional Networks for Large-Scale Image Recognition," arXiv:1409.1556 (2014)
- Available from: http://www.robots.ox.ac.uk/~vgg/research/very_deep
- Rights: Creative Commons Attribution 4.0 International (CC BY 4.0)