Skip To Content

Non Maximum Suppression

Available with Image Analyst license.

Summary

Identifies duplicate features from the output of the Detect Objects Using Deep Learning tool as a postprocessing step and creates a new output with no duplicate features. The Detect Objects Using Deep Learning tool can return more than one bounding box or polygon for the same object, especially as a tiling side effect. If two features overlap more than a given maximum ratio, the feature with the lower confidence value will be removed.

Usage

  • This tool implements the non-maximum suppression algorithm to delete duplicate objects created by the Detect Objects Using Deep Learning tool.

  • The feature class must have a confidence field with a confidence value for each feature.

  • If the feature class contains more than one object class—such as trees, cars, or buildings—it also must have a field with either a class value or a class name.

  • If two overlapping features have an overlap ratio larger than the Maximum Overlap Ratio specified, the feature with the lower confidence will be removed.

  • The tool first reviews the feature class for each object class separately, and marks lower confidence duplicate features to be removed. Then it reviews all features, comparing features of different object classes. The output is a new feature class with the detected duplicate features removed.

Syntax

NonMaximumSuppression (in_featureclass, confidence_score_field, out_featureclass, {class_value_field}, {max_overlap_ratio})
ParameterExplanationData Type
in_featureclass

The input feature class or feature layer containing overlapping or duplicate features.

Feature Class; Feature Layer
confidence_score_field

The field in the feature class that contains the confidence scores as output by the object detection method.

Field
out_featureclass

The output feature class with the duplicate features removed.

Feature Class
class_value_field
(Optional)

The class value field in the input feature class. If not specified, the tool will use the standard class value fields Classvalue and Value. If these fields do not exist, all features will be treated as the same object class.

Field
max_overlap_ratio
(Optional)

The maximum overlap ratio for two overlapping features. This is defined as the ratio of intersection area over union area. The default is 0.

Double

Code sample

NonMaximumSuppression example 1 (Python window)

Duplicate objects are deleted from the output by the NonMaximumSupression tool.

# Import system modules
import arcpy
from arcpy.ia import *

# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

NonMaximumSuppression("Detectcars1", "Confidence", r"c:\Classification.gdb\tf_detectobjects_cars_", "Class", 0.3)
NonMaximumSuppression example 2 (stand-alone script)

Duplicate objects are deleted from the output by the NonMaximumSupression tool.

# Import system modules
import arcpy
from arcpy.ia import *

"""
Usage: NonMaximumSuppression(in_features,confidence_score_field, 
out_features, {class_value_field}, {max_overlap_ratio})
"""

# Set local variables
in_features = "c:/classifydata/Trees.tif"
confidence_score_field = "Confidence"
out_features = "c:/detectobjects/trees.shp"
class_value_field = "Classvalue"
max_overlap_ratio = 0.2


# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

# Execute 
NonMaximumSuppression(in_features,confidence_score_field, out_features, 
class_value_field, max_overlap_ratio)

Licensing information

  • Basic: Requires Image Analyst
  • Standard: Requires Image Analyst
  • Advanced: Requires Image Analyst

Related topics