Wolfram Research

Function Repository Resource:

YOLOImageLabel

Source Notebook

Identify and highlight objects in an image using a YOLO neural network

Contributed by: Giulio Alessandrini

ResourceFunction["YOLOImageLabel"][image]

highlights and labels the objects identified by the "YOLO V2 Trained on MS-COCO Data" net model in an image.

ResourceFunction["YOLOImageLabel"][image,detect]

uses the specified detection threshold.

ResourceFunction["YOLOImageLabel"][image,detect,overlap]

uses the specified overlap threshold.

Details and Options

ResourceFunction["YOLOImageLabel"] is based on NetModel["YOLO V2 Trained on MS-COCO Data"].
The overlap and detection thresholds should be values between 0 and 1.
The default detection threshold is 0.2. Using a lower detection threshold will highlight objects with lower classification probabilities.
The default overlap threshold is 0.4. A higher overlap threshold will highlight more overlapping objects.
ResourceFunction["YOLOImageLabel"] returns a Graphics object.

Examples

Basic Examples

Identify objects in a photo with a single person:

In[1]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Girl on a Blue Background"]]
Out[1]=

Identify multiple objects in an image:

In[2]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Red Cherry Tomatoes"]]
Out[2]=

Scope

Use the default thresholds:

In[3]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Happy Family in Red"]]
Out[3]=

Using a low detection threshold finds more objects:

In[4]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Happy Family in Red"], 0.01]
Out[4]=

Using a high detection threshold finds fewer objects:

In[5]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Happy Family in Red"], 0.83]
Out[5]=

Highlight objects using default thresholds:

In[6]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Red Cherry Tomatoes"]]
Out[6]=

Increasing the overlap threshold shows more overlapping objects:

In[7]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Red Cherry Tomatoes"], Automatic, 0.8]
Out[7]=

Decreasing the overlap threshold shows fewer objects:

In[8]:=
ResourceFunction["YOLOImageLabel"][
 ResourceData["Sample Image: Red Cherry Tomatoes"], Automatic, 0.01]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information