#
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: 46 | Parameter count: 143,667,240 | Trained size: 575 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.

Retrieve the resource object:

In[1]:= |

Out[1]= |

Get the pre-trained net:

In[2]:= |

Out[2]= |

Classify an image:

In[3]:= |

Out[3]= |

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

In[4]:= |

Out[4]= |

Get a list of available properties of the predicted Entity:

In[5]:= |

Out[5]= |

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

In[6]:= |

Out[6]= |

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

In[7]:= |

Out[7]= |

Obtain the list of names of all available classes:

In[8]:= |

Out[8]= |

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

In[9]:= |

Out[9]= |

Get a set of images:

In[10]:= |

Visualize the features of a set of images:

In[11]:= |

Out[11]= |

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

In[12]:= |

Show the dimensions of the weights:

In[13]:= |

Out[13]= |

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

In[14]:= |

Out[14]= |

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[15]:= |

In[16]:= |

Remove the linear layer from the pre-trained net:

In[17]:= |

Out[17]= |

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

In[18]:= |

Out[18]= |

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

In[19]:= |

Out[19]= |

Perfect accuracy is obtained on the test set:

In[20]:= |

Out[20]= |

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

In[21]:= |

Out[21]= |

Obtain the total number of parameters:

In[22]:= |

Out[22]= |

Obtain the layer type counts:

In[23]:= |

Out[23]= |

Display the summary graphic:

In[24]:= |

Out[24]= |

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

In[25]:= |

Out[25]= |

Export also creates a net.params file containing parameters:

In[26]:= |

Out[26]= |

Get the size of the parameter file:

In[27]:= |

Out[27]= |

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

In[28]:= |

Out[28]= |

Represent the MXNet net as a graph:

In[29]:= |

Out[29]= |

Wolfram Language 11.2 (September 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)