Wolfram Neural Net Repository
Immediate Computable Access to Neural Net Models
Determine the locations of the eyes, nose and mouth from a facial image
Released in 2015, this net is a regressor for locating five facial landmarks from facial images: eyes, nose and mouth corners. The net output is to be interpreted as the positions of {EyeLeft, EyeRight, Nose, MouthLeft, MouthRight}, where values are rescaled to the input image size so that the bottom-left corner is identified by {0, 0} and the top-right corner by {1, 1}.
Number of layers: 24 | Parameter count: 111,050 | Trained size: 485 KB |
This model achieves 8.1% detector error rate on the AFLW Dataset.
Get the pre-trained net:
In[1]:= | ![]() |
Out[1]= | ![]() |
Get a facial image and the net:
In[2]:= | ![]() |
In[3]:= | ![]() |
Get the locations of the eyes, nose and mouth corners:
In[4]:= | ![]() |
Out[4]= | ![]() |
Show the prediction:
In[5]:= | ![]() |
Out[5]= | ![]() |
The net must be evaluated on facial crops only. Get an image with multiple faces:
In[6]:= | ![]() |
Write an evaluation function that crops the input image around faces and returns the crops and facial landmarks:
In[7]:= | ![]() |
Evaluate the function on the image:
In[8]:= | ![]() |
Out[8]= | ![]() |
Write a simple function to show the landmarks:
In[9]:= | ![]() |
In[10]:= | ![]() |
Evaluate the function on the previous output:
In[11]:= | ![]() |
Out[11]= | ![]() |
Inspect the number of parameters of all arrays in the net:
In[12]:= | ![]() |
Out[12]= | ![]() |
Obtain the total number of parameters:
In[13]:= | ![]() |
Out[13]= | ![]() |
Obtain the layer type counts:
In[14]:= | ![]() |
Out[14]= | ![]() |
Display the summary graphic:
In[15]:= | ![]() |
Out[15]= | ![]() |
Export the net into a format that can be opened in MXNet:
In[16]:= | ![]() |
Out[16]= | ![]() |
Export also creates a net.params file containing parameters:
In[17]:= | ![]() |
Out[17]= | ![]() |
Get the size of the parameter file:
In[18]:= | ![]() |
Out[18]= | ![]() |
The size is similar to the byte count of the resource object:
In[19]:= | ![]() |
Out[19]= | ![]() |
Represent the MXNet net as a graph:
In[20]:= | ![]() |
Out[20]= | ![]() |
Wolfram Language 11.2 (September 2017) or above