Age Estimation VGG-16 Trained on IMDB-WIKI Data

Predict a person's age from an image of their face

Released in 2015 as a pre-trained model for the launch of the IMDB-WIKI dataset by the Computer Vision Lab at ETH Zurich, this model is based on the VGG-16 architecture and is designed to run on cropped images of faces only.

Number of layers: 40 | Parameter count: 134,674,341 | Trained size: 540 MB |

Training Set Information

Examples

Resource retrieval

Get the pre-trained net:

In[1]:=
NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"]
Out[1]=

Basic usage

Guess the age of a person from a photograph:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/3570a2e5-4f4f-4d37-a298-ccd526d28b82"]
Out[2]=

Obtain the probability distribution over all possible ages:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/0cb00126-fc0d-4cb4-a357-73a4710ff910"]
Out[3]=

Plot the probability distribution over possible ages:

In[4]:=
ListPlot[probabilities, Filling -> Axis, PlotRange -> All]
Out[4]=

The recommended estimator of the age is the mean of the probability mass function:

In[5]:=
Mean@WeightedData[Range[0, 100], probabilities]
Out[5]=

By default, the mode is used as the estimator:

In[6]:=
MaximalBy[Value][probabilities]
Out[6]=

This net is designed to work with cropped images of faces only. If the photograph is not a facial image, the results may be unexpected:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/4c736279-49a4-418a-be34-89cb29944191"]
In[8]:=
NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"][img]
Out[8]=

Crop the photograph:

In[9]:=
crop = ImageTrim[img, #] & /@ FindFaces[img]
Out[9]=

Guess the age of a person from the cropped image:

In[10]:=
NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"][crop]
Out[10]=

Net information

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

In[11]:=
NetInformation[
 NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"], \
"ArraysElementCounts"]
Out[11]=

Obtain the total number of parameters:

In[12]:=
NetInformation[
 NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"], \
"ArraysTotalElementCount"]
Out[12]=

Obtain the layer type counts:

In[13]:=
NetInformation[
 NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"], \
"LayerTypeCounts"]
Out[13]=

Display the summary graphic:

In[14]:=
NetInformation[
 NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"], \
"SummaryGraphic"]
Out[14]=

Export to MXNet

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

In[15]:=
jsonPath = Export[FileNameJoin[{$TemporaryDirectory, "net.json"}], NetModel["Age Estimation VGG-16 Trained on IMDB-WIKI Data"], "MXNet"]
Out[15]=

Export also creates a net.params file containing parameters:

In[16]:=
paramPath = FileNameJoin[{DirectoryName[jsonPath], "net.params"}]
Out[16]=

Get the size of the parameter file:

In[17]:=
FileByteCount[paramPath]
Out[17]=

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

In[18]:=
ResourceObject[
  "Age Estimation VGG-16 Trained on IMDB-WIKI Data"]["ByteCount"]
Out[18]=

Represent the MXNet net as a graph:

In[19]:=
Import[jsonPath, {"MXNet", "NodeGraphPlot"}]
Out[19]=

Requirements

Wolfram Language 11.2 (September 2017) or above

Resource History

Reference