ResNet-152 Trained on ImageNet Competition Data

Identify the main object in an image

Released in 2015 by Microsoft Research Asia, the ResNet architecture (with its three realizations ResNet-50, ResNet-101 and ResNet-152) obtained very successful results in the ImageNet and MS-COCO competition. The core idea exploited in these models, residual connections, is found to greatly improve gradient flow, thus allowing training of much deeper models with tens or even hundreds of layers. ImageNet classes are mapped to Wolfram Language Entities through their unique WordNet IDs.

Number of layers: 517 | Parameter count: 60,344,232 | Trained size: 244 MB |

Training Set Information

Performance

Examples

Resource retrieval

Get the pre-trained net:

In[1]:=

The prediction is an Entity:

In[4]:=

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

In[6]:=
EntityValue[
 NetExtract[
   NetModel["ResNet-152 Trained on ImageNet Competition Data"], "Output"][["Labels"]], "Name"]
Out[7]=
extractor = Take[NetModel[
   "ResNet-152 Trained on ImageNet Competition Data"], {1, -4}]
Out[8]=

Visualize convolutional weights

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

In[11]:=
weights = NetExtract[
   NetModel[
    "ResNet-152 Trained on ImageNet Competition Data"], {"conv1", "Weights"}];

Visualize the weights as a list of 64 images of size 7x7:

In[12]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/acdb90a5-4bd9-4018-b598-e3d1699c980f"]

Remove the linear layer from the pre-trained net:

In[15]:=
tempNet = Take[NetModel[
   "ResNet-152 Trained on ImageNet Competition Data"], {1, -4}]
Out[15]=
TargetDevice -> "GPU" for training on a GPU):

In[17]:=

Net information

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

In[19]:=
NetInformation[
 NetModel["ResNet-152 Trained on ImageNet Competition Data"], \
"ArraysElementCounts"]
Out[19]=
NetInformation[
 NetModel["ResNet-152 Trained on ImageNet Competition Data"], \
"ArraysTotalElementCount"]
Out[20]=
NetInformation[
 NetModel["ResNet-152 Trained on ImageNet Competition Data"], \
"LayerTypeCounts"]
Out[21]=
NetInformation[
 NetModel["ResNet-152 Trained on ImageNet Competition Data"], \
"SummaryGraphic"]
Out[22]=

Out[25]=
ResourceObject[
  "ResNet-152 Trained on ImageNet Competition Data"]["ByteCount"]
Out[26]=

Requirements

Wolfram Language 11.2 (September 2017) or above

Resource History

Reference

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant