# Wolfram Neural Net Repository

Immediate Computable Access to Neural Net Models

Detect, segment and localize objects in an image

YOLO (You Only Look Once) Version 8 by Ultralytics is the latest version of the YOLO models. Just like its predecessor, YOLO Version 5, YOLO Version 8 is an anchor-free model that was trained with mosaic augmentation. It features the use of new "C2f" blocks, which employ additional dense connections between bottleneck modules. Although YOLO models are historically object detection models, these models perform both object detection and segmentation at the same time.

- Microsoft COCO, a dataset for image recognition, segmentation, captioning, object detection and keypoint estimation, consisting of more than three hundred thousand images.

Get the pre-trained net:

In[1]:= |

Out[1]= |

This model consists of a family of individual nets, each identified by a specific parameter combination. Inspect the available parameters:

In[2]:= |

Out[2]= |

Pick a non-default net by specifying the parameters:

In[3]:= |

Out[3]= |

Pick a non-default uninitialized net:

In[4]:= |

Out[4]= |

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

In[5]:= |

In[6]:= |

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

In[7]:= |

In[8]:= |

The model's output is an Association containing the detected "Boxes", "Classes" and "Masks":

In[9]:= |

Out[9]= |

The "Boxes" key is a list of Rectangle expressions corresponding to the bounding boxes of the detected objects:

In[10]:= |

Out[10]= |

The "Classes" key contains the classes of the detected objects:

In[11]:= |

Out[11]= |

The "Masks" key contains segmentation masks for the detected objects:

In[12]:= |

Out[12]= |

Visualize the boxes labeled with their assigned classes:

In[13]:= |

Out[13]= |

Visualize the masks labeled with their assigned classes:

In[14]:= |

Out[14]= |

The network computes eight thousand four hundred bounding boxes, the probability that the objects in each box are of any given class, 32 160x160 prototyped segmentation masks and mask weights for each bounding box:

In[15]:= |

In[16]:= |

Out[16]= |

Visualize prototyped masks:

In[17]:= |

Out[17]= |

Every box is then assigned a mask, computed by taking linear combinations of the prototyped masks with the associated weights. Values are normalized to lie between 0 and 1 with a LogisticSigmoid:

In[18]:= |

Out[19]= |

Filter out masks whose detection probabilities are small and visualize the others:

In[20]:= |

Out[22]= |

Scale the boxes and apply non-maximum suppression for the final reduction. Use the result to filter the masks and visualize them:

In[23]:= |

Out[32]= |

Remove the padding from the masks, scale them to the original image size, binarize them and use the scaled boxes to isolate the region of interest:

In[33]:= |

Out[42]= |

Remove any detections outside the boxes:

In[43]:= |

Out[44]= |

Visualize the bounding boxes scaled by their class probabilities:

In[45]:= |

Out[51]= |

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

In[52]:= |

In[53]:= |

Out[53]= |

Superimpose the person predictions on top of the input received by the net:

In[54]:= |

Out[54]= |

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

In[55]:= |

Out[55]= |

Obtain the total number of parameters:

In[56]:= |

Out[56]= |

Obtain the layer type counts:

In[57]:= |

Out[57]= |

Display the summary graphic:

In[58]:= |

Out[58]= |

- G. Jocher, A. Chaurasia, J. Qiu, "YOLO by Ultralytics."
- Available from: https://github.com/ultralytics/ultralytics
- Rights: GNU General Public License