# Wolfram Neural Net Repository

Immediate Computable Access to Neural Net Models

Contributed By:
Julian W. Francis

Detect and localize objects in an image

Released in 2019, this model is a single-stage object detection model that goes straight from image pixels to bounding box coordinates and class probabilities. The model architecture is based on inverted residual structure where the input and output of the residual block are thin bottleneck layers as opposed to traditional residual models. Moreover, nonlinearities are removed from intermediate layers and lightweight depthwise convolution is used. This model is part of the Tensorflow object detection API.

Number of layers: 267 | Parameter count: 15,291,106 | Trained size: 63 MB |

- MS-COCO, a dataset for image recognition, segmentation and captioning, consisting of more than 300,000 images overall and 80 object classes.

Get the pre-trained net:

In[1]:= |

Out[1]= |

Define the label list for this model. Integers in the model's output correspond to elements in the label list:

In[2]:= |

Write an evaluation function to scale the result to the input image size and suppress the least probable detections:

In[3]:= |

In[4]:= |

Obtain the detected bounding boxes with their corresponding classes and confidences for a given image:

In[5]:= |

In[6]:= |

Out[6]= |

Inspect which classes are detected:

In[7]:= |

Out[7]= |

Visualize the detection:

In[8]:= |

Out[8]= |

The network computes 1,917 bounding boxes and the probability that the objects in each box are of any given class:

In[9]:= |

Out[9]= |

Visualize all the boxes predicted by the net scaled by their “objectness” measures:

In[10]:= |

In[11]:= |

Out[11]= |

Visualize all the boxes scaled by the probability that they contain a cat:

In[12]:= |

Out[12]= |

In[13]:= |

Out[13]= |

Superimpose the cat prediction on top of the scaled input received by the net:

In[14]:= |

Out[14]= |

Write a function to apply a custom styling to the result of the detection:

In[15]:= |

In[16]:= |

Visualize multiple objects, using a different color for each class:

In[17]:= |

Out[17]= |

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

In[18]:= |

Out[18]= |

Obtain the total number of parameters:

In[19]:= |

Out[19]= |

Obtain the layer type counts:

In[20]:= |

Out[20]= |

Display the summary graphic:

In[21]:= |

Out[21]= |

Wolfram Language 12.0 (April 2019) or above

- M. Sandler, A. Howard, M. Zhu, A. Zhmoginov, L. C. Chen, "MobileNetV2: Inverted Residuals and Linear Bottlenecks," arxiv:1801.04381 (2019)
- (available from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md)
- Rights: Apache 2.0 License