Wolfram Neural Net Repository
Immediate Computable Access to Neural Net Models
Identify the main object in an image
Number of models: 7
The models achieve the following accuracies on the original ImageNet validation set.
Get the pre-trained net:
In[1]:= | ![]() |
Out[1]= | ![]() |
This model consists of a family of individual nets, each identified by a specific parameter combination. Inspect the available parameters:
In[2]:= | ![]() |
Out[2]= | ![]() |
Pick a non-default net by specifying the parameters:
In[3]:= | ![]() |
Out[3]= | ![]() |
Pick a non-default uninitialized net:
In[4]:= | ![]() |
Out[4]= | ![]() |
Classify an image:
In[5]:= | ![]() |
Out[5]= | ![]() |
The prediction is an Entity object, which can be queried:
In[6]:= | ![]() |
Out[6]= | ![]() |
Get a list of available properties of the predicted Entity:
In[7]:= | ![]() |
Out[7]= | ![]() |
Obtain the probabilities of the 10 most likely entities predicted by the net:
In[8]:= | ![]() |
Out[8]= | ![]() |
An object outside the list of the ImageNet classes will be misidentified:
In[9]:= | ![]() |
Out[9]= | ![]() |
Obtain the list of names of all available classes:
In[10]:= | ![]() |
Out[10]= | ![]() |
Remove the last two layers of the trained net so that the net produces a vector representation of an image:
In[11]:= | ![]() |
Out[11]= | ![]() |
Get a set of images:
In[12]:= | ![]() |
Use the net as a feature extractor to build a clustering tree of the images:
In[13]:= | ![]() |
Out[13]= | ![]() |
Use the pre-trained model to build a classifier for telling apart indoor and outdoor photos. Create a test set and a training set:
In[14]:= | ![]() |
In[15]:= | ![]() |
Remove the linear layer from the pre-trained net:
In[16]:= | ![]() |
Out[16]= | ![]() |
Create a new net composed of the pre-trained net followed by a linear layer and a softmax layer:
In[17]:= | ![]() |
Train on the dataset, freezing all the weights except for those in the "linearNew" layer (use TargetDevice -> "GPU" for training on a GPU):
In[18]:= | ![]() |
Out[18]= | ![]() |
Perfect accuracy is obtained on the test set:
In[19]:= | ![]() |
Out[19]= | ![]() |
Inspect the number of parameters of all arrays in the net:
In[20]:= | ![]() |
Out[20]= | ![]() |
Obtain the total number of parameters:
In[21]:= | ![]() |
Out[21]= | ![]() |
Obtain the layer type counts:
In[22]:= | ![]() |
Out[22]= | ![]() |
Export the net to the ONNX format:
In[23]:= | ![]() |
Out[23]= | ![]() |
Get the size of the ONNX file:
In[24]:= | ![]() |
Out[24]= | ![]() |
Check some metadata of the ONNX model:
In[25]:= | ![]() |
Out[25]= | ![]() |
Import the model back into the Wolfram Language. However, the NetEncoder and NetDecoder will be absent because they are not supported by ONNX:
In[26]:= | ![]() |
Out[26]= | ![]() |