#
Wolfram Neural Net Repository

Immediate Computable Access to Neural Net Models

Contributed By:
Julian W. Francis

Detect and localize objects in an image

YOLO (You Only Look Once) Version 3 is an object detection model published in April 2018. It is a single-stage architecture that goes straight from image pixels to bounding box coordinates and class probabilities. Compared to previous versions of YOLO, it performs bounding box regression and classification at three different scales and uses three anchor boxes instead of two. Additionally, residual blocks and skip connections are added and L2 losses for object confidence and class predictions are now replaced by cross-entropy error terms.

Number of layers: 349 | Parameter count: 65,252,682 | Trained size: 263 MB |

- Open Images, a dataset for image recognition, segmentation and captioning, consisting a total of 16 million bounding boxes for 600 object classes on 1.9 million images.

This model achieves an mAP-50 of 51.5% and an AP50 of 57.9% on the MS-COCO 2014 test set.

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]:= |

In[5]:= |

In[6]:= |

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

In[7]:= |

In[8]:= |

Out[8]= |

Inspect which classes are detected:

In[9]:= |

Out[9]= |

Visualize the detection:

In[10]:= |

In[11]:= |

Out[11]= |

The network computes 22,743 bounding boxes, the probability of having an object in each box and the conditioned probability that the object is of any given class:

In[12]:= |

Out[12]= |

In[13]:= |

Out[13]= |

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

In[14]:= |

In[15]:= |

Out[15]= |

Visualize all the boxes scaled by the probability that they contain an animal:

In[16]:= |

Out[16]= |

In[17]:= |

Out[17]= |

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

In[18]:= |

Out[18]= |

Obtain a test image:

In[19]:= |

Obtain bounding boxes for the specified classes only (“Vehicle registration plate” and “Window”):

In[20]:= |

Out[20]= |

Visualize the detection:

In[21]:= |

In[22]:= |

Out[22]= |

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

In[23]:= |

Out[23]= |

Obtain the total number of parameters:

In[24]:= |

Out[24]= |

Obtain the layer type counts:

In[25]:= |

Out[25]= |

Display the summary graphic:

In[26]:= |

Out[26]= |

Wolfram Language 12.0 (April 2019) or above

- J. Redmon, A. Farhadi, "YOLOv3: An Incremental Improvement," arXiv:1804.02767 (2018)
- (available from https://pjreddie.com/darknet/yolo)
- Rights: Unrestricted Use