Select strongest multiclass bounding boxes from overlapping clusters using nonmaximal suppression (NMS) (2024)

Select strongest multiclass bounding boxes from overlapping clusters using nonmaximal suppression (NMS)

collapse all in page

Syntax

selectedBboxes = selectStrongestBboxMulticlass(bboxes,scores,labels)

[selectedBboxes,selectedScores,selectedLabels,index]= selectStrongestBboxMulticlass(bboxes,scores,labels)

[___]= selectStrongestBboxMulticlass(___,Name,Value)

Description

example

selectedBboxes = selectStrongestBboxMulticlass(bboxes,scores,labels) returns selected bounding boxes that have high confidence scores. The function uses greedy nonmaximal suppression (NMS) to eliminate overlapping bounding boxes from the bboxes input, only if they have the same class label.

[selectedBboxes,selectedScores,selectedLabels,index]= selectStrongestBboxMulticlass(bboxes,scores,labels) additionally returns the scores, labels, and index associated with the selected bounding boxes.

[___]= selectStrongestBboxMulticlass(___,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Run Multiclass Nonmaximal Suppression on Bounding Boxes Using People Detector

Open Live Script

Create detectors using two different models. These will be used to generate multiclass detection results.

detectorInria = peopleDetectorACF('inria-100x41');detectorCaltech = peopleDetectorACF('caltech-50x21');

Apply the detectors.

I = imread('visionteam1.jpg');[bboxesInria,scoresInria] = detect(detectorInria,I,'SelectStrongest',false);[bboxesCaltech,scoresCaltech] = detect(detectorCaltech,I,'SelectStrongest',false);

Create categorical labels for each the result of each detector.

labelsInria = repelem("inria",numel(scoresInria),1);labelsInria = categorical(labelsInria,{'inria','caltech'});labelsCaltech = repelem("caltech",numel(scoresCaltech),1);labelsCaltech = categorical(labelsCaltech,{'inria','caltech'});

Combine results from all detectors to for multiclass detection results.

allBBoxes = [bboxesInria;bboxesCaltech];allScores = [scoresInria;scoresCaltech];allLabels = [labelsInria;labelsCaltech];

Run multiclass non-maximal suppression.

[bboxes,scores,labels] = selectStrongestBboxMulticlass(allBBoxes,allScores,allLabels,... 'RatioType','Min','OverlapThreshold',0.65);

Annotate detected people.

annotations = string(labels) + ": " + string(scores);I = insertObjectAnnotation(I,'rectangle',bboxes,cellstr(annotations));imshow(I)title('Detected People, Scores, and Labels')

Select strongest multiclass bounding boxes from overlapping clusters usingnonmaximal suppression (NMS) (1)

Input Arguments

collapse all

bboxesBounding boxes
M-by-4 matrix | M-by-5 matrix

Bounding boxes, specified as an M-by-4 or M-by-5 nonsparse numeric matrix. M is the number of bounding boxes. Each row of the matrix defines a bounding box as either an axis-aligned rectangle or a rotated rectangle. This table describes the format for each bounding box.

Bounding BoxDescription
Axis-aligned rectangle

Defined in spatial coordinates as an M-by-4 numeric matrix with rows of the form [x y w h], where:

  • M is the number of axis-aligned rectangles.

  • x and y specify the upper-left corner of the rectangle.

  • w specifies the width of the rectangle, which is its length along the x-axis.

  • h specifies the height of the rectangle, which is its length along the y-axis.

Rotated rectangle

Defined in spatial coordinates as an M-by-5 numeric matrix with rows of the form [xctr yctr xlen ylen yaw], where:

  • M is the number of rotated rectangles.

  • xctr and yctr specify the center of the rectangle.

  • xlen specifies the width of the rectangle, which is its length along the x-axis before rotation.

  • ylen specifies the height of the rectangle, which is its length along the y-axis before rotation.

  • yaw specifies the rotation angle in degrees. The rotation is clockwise-positive around the center of the bounding box.

Select strongest multiclass bounding boxes from overlapping clusters usingnonmaximal suppression (NMS) (2)

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

scoresConfidence scores
M-by-1 vector

Confidence scores corresponding to the input bounding boxes, specified as an M-by-1 vector. The selectStrongestBboxMulticlass function uses greedy NMS to eliminate overlapping bounding boxes and associate the confidence score with the boxes. A higher score represents a higher confidence in keeping the bounding box. The scores input must be real, finite, and nonsparse.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

labelsLabels
M-by-1 categorical vector | M-by-1 numeric vector

Labels corresponding to the input bounding boxes, specified as an M-by-1 categorical or numeric vector.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | categorical

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'RatioType','Union' sets the 'RatioType' property to 'Union'.

RatioTypeBounding box overlap ratio denominator
'Union' (default) | 'Min'

Ratio type, specified as the character vector 'Union' or 'Min'.

  • Set the ratio type to 'Union' to compute the ratio as the area of intersection between bboxA and bboxB, divided by the area of the union of the two.

  • Set the ratio type to 'Min' to compute the ratio as the area of intersection between bboxA and bboxB, divided by the minimum area of the two bounding boxes.

Select strongest multiclass bounding boxes from overlapping clusters usingnonmaximal suppression (NMS) (3)

Data Types: char

OverlapThresholdOverlap ratio threshold
0.5 (default) | scalar in the range [0 1]

Overlap ratio threshold, specified as the comma-separated pair consisting of 'OverlapThreshold' and a scalar in the range [0 1]. When the overlap ratio is above the threshold, the function removes bounding boxes around the reference box. Decrease the threshold to reduce the number of selected bounding boxes. However, if you decrease the threshold too much, you might eliminate boxes that represent objects close to each other in the image.

Data Types: single | double

NumStrongestMaximum number of strongest boxes
inf (default) | positive scalar

Maximum number of strongest boxes, specified as the comma-separated pair consisting of 'NumStrongest' and inf or a positive scalar. Use this argument to reduce processing time when you have a priori knowledge about the maximum number of boxes. Set the value to inf to select all the strongest, non-overlapping, bounding boxes.

When the labels input contains categorical labels, you can also specify a vector that contains the maximum number of strongest boxes for each category in the labels input. The length of the specified vector must equal the number of categories in the label.

Output Arguments

collapse all

selectedBboxes — Selected bounding boxes
M-by-4 matrix | M-by-5 matrix

Selected bounding boxes, returned as an M-by-4 or an M-by-5 matrix. The 4-element vectors represent axis-aligned rectangles and the 5-element vectors represent rotated rectangles.

The selectedBbox output returns the selected bounding boxes from the bbox input that have the highest confidence score. The function uses nonmaximal suppression to eliminate overlapping bounding boxes.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

selectedScores — Scores of selected bounding boxes
M-by-1 vector

Scores of selected bounding boxes, returned as an M-by-1 vector. The Mth score in the selectedScores output corresponds to the Mth bounding box in the selectedBboxes output. The data type of selectedScores matches the data type of scores.

selectedLabels — Labels of selected bounding boxes
M-by-1 categorical vector | M-by-1 numeric vector

Labels of selected bounding boxes, returned as an M-by-1 categorical or numeric vector. The Mth label in the selectedLabels output corresponds to the Mth bounding box in the selectedBboxes output. The data type of selectedLabels matches the data type of labels.

index — Index of selected bounding boxes
M-by-1 vector

Index of selected bounding boxes, returned as an M-by-1 vector. The index vector contains the indices to the selected boxes in the bboxes input.

Data Types: double

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2018a

See Also

bboxOverlapRatio | selectStrongestBbox

MATLAB 命令

您点击的链接对应于以下 MATLAB 命令:

 

请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。

Select strongest multiclass bounding boxes from overlapping clusters usingnonmaximal suppression (NMS) (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

Europe

Asia Pacific

Contact your local office

Select strongest multiclass bounding boxes from overlapping clusters using
nonmaximal suppression (NMS) (2024)

FAQs

What is select strongest box in Matlab? ›

The selectStrongestBbox function uses nonmaximal suppression to eliminate overlapping bounding boxes and associate the confidence score with the boxes. A higher score represents a higher confidence in keeping the bounding box. The score input must be real, finite, and nonsparse.

How to remove overlapping bounding boxes? ›

Pseudo code for non-max Suppression?
  1. Select the box with highest objectiveness score.
  2. Then, compare the overlap (intersection over union) of this box with other boxes.
  3. Remove the bounding boxes with overlap (intersection over union) >50%
  4. Then, move to the next highest objectiveness score.
  5. Finally, repeat steps 2-4.
Feb 20, 2024

What is selectStrongest in Matlab? ›

Description. strongestPoints = selectStrongest( points , N ) returns N number of points that have the strongest metrics.

What is bbox in Matlab? ›

bbox bounds the outer edges of the image in map coordinates: [minX minY maxX maxY] bbox = mapbbox(R, sizea) accepts sizea = [height, width, ...] instead of height and width .

How do you select maximum in MATLAB? ›

M = max( A ,[], "all" ) finds the maximum over all elements of A . M = max( A ,[], dim ) returns the maximum element along dimension dim .

What is MinMax block in MATLAB? ›

The MinMax block enables you to find minimum or maximum values over a specified dimension using these new parameters: Apply over — Apply function over all or specified dimensions.

What is non-max suppression? ›

Non-maximum suppression (NMS) is a post-processing technique used in object detection to eliminate duplicate detections and select the most relevant detected objects. This helps reduce false positives and the computational complexity of a detection algorithm.

Can bounding boxes overlap? ›

Two objects / bounding boxes may overlap partially or even completely. So there may be some bounding boxes with the exact same size & position that then need to be moved apart from each other, so that they are next to each other.

How to check if a bounding box is inside another bounding box? ›

By comparing the coordinates of the top-left and bottom-right corners of the bounding box and the inner boxes it is easy to know if any of the latter is inside the former.

What is Cummax function in MATLAB? ›

Description. M = cummax( A ) returns the cumulative maximum elements of A . If A is a vector, then M is a vector of the same size and type and contains the cumulative maxima of A . If A is a matrix, then M is a matrix of the same size and type and contains the cumulative maxima in each column of A .

What does Fgetl do in MATLAB? ›

fgetl reads characters using the encoding scheme associated with the file. To specify the encoding scheme, use fopen . When fgetl encounters the ASCII characters in the order 0A 0D , which are a line feed followed by a carriage return, it will read them as a single ASCII newline character.

What does ode15s do in MATLAB? ›

ode15s and ode23t can solve problems with a mass matrix that is singular, known as differential-algebraic equations (DAEs). Specify the mass matrix using the Mass option of odeset .

How do you compute a bounding box in MATLAB? ›

Compute Bounding Box

Use the utility function rectToBbox to compute the bounding box value from the values returned by OpenCV function cv::Rect2i . bbox = rectToBbox(rec); Display the bounding box values. Notice that the bounding box values in the MATLAB workspace have one-based indexing.

How do you resize a bounding box in MATLAB? ›

bboxB = bboxresize( bboxA , scale ) resizes bounding boxes in bboxA by the amount specified by scale . This function supports 2-D and 3-D bounding boxes.

How do I get rid of bounding box in MATLAB? ›

bboxB = bboxerase( bboxA , window ) removes bounding boxes in the input bboxA that lie within a region of interest (ROI) specified by window . The output is the set of bounding boxes retained from the input bboxA . This function supports 2-D and 3-D bounding boxes.

What does box on do in MATLAB? ›

Box visibility, specified one of these values: "on" or "off" — A value of "on" displays the box outline, and "off" hides it. You can also specify the character vectors 'on' or 'off' . Numeric or logical 1 ( true ) or 0 ( false ) — A value of 1 or true displays the box outline, and 0 or false hides it.

What does selector block do in MATLAB? ›

The Selector block extracts selected elements of an input vector, matrix, or multidimensional signal based on specified indices. The extracted signals can be grouped differently than the input signals. Based on the value you enter for the Number of input dimensions parameter, a table of indexing settings is displayed.

What are the different toolboxes in MATLAB? ›

Access MATLAB Add-On Toolboxes
  • Statistics and Machine Learning Toolbox™ (Statistics and Machine Learning Toolbox)
  • Curve Fitting Toolbox™ (Curve Fitting Toolbox)
  • Control System Toolbox™ (Control System Toolbox)
  • Signal Processing Toolbox™ (Signal Processing Toolbox)
  • Mapping Toolbox™ (Mapping Toolbox)

How do I select specific data in MATLAB? ›

To select data at the command line, pass the data to the fit function during the fitting process. To select data for curve fitting, save the X and Y data as column vectors with the same number of rows. Then, pass the column vectors to the fit function as the x and y input arguments.

Top Articles
Shocking And Disturbing: The Tragic Death Of Nikki Catsouras
Gruesome Discovery: Nikki Catsouras Death Photo Surfaces
Cremation Services | Mason Funeral Home serving Westfield, New York...
Calvert Er Wait Time
Yogabella Babysitter
NYC Drilled on Variant Response as Vaccine Limits Push State Appointments to Mid-April
Lsn Nashville Tn
Busted Newspaper Randolph County
Localhotguy
Haverhill, MA Obituaries | Driscoll Funeral Home and Cremation Service
How to track your Amazon order on your phone or desktop
Pear Shaped Rocsi
How to Sign Out of Microsoft Outlook: Step-by-Step Guide - Solve Your Tech
Point Click Care Cna Lo
Onlybaddiestv
Sloansmoans Bio
Pheasant Chicks Tractor Supply
Craigslist Yamhill
Waitlistcheck Sign Up
Open jazz : podcast et émission en replay | France Musique
rochester, NY cars & trucks - craigslist
Olentangy Calendar
Melanin - Altmeyers Enzyklopädie - Fachbereich Dermatologie
Reptile Expo Spokane
Conference Usa Message Boards
Hose Woe Crossword Clue
Fast X Showtimes Near Evo Cinemas Creekside 14
The History Of Fujoshi, Male Shippers, And How Its Changed
Los Garroberros Menu
Maurice hat ein echtes Aggressionsproblem
By Association Only Watsonville
Meritas Health Patient Portal
Quattrocento, Italienische Kunst des 15. Jahrhunderts
The Bold And The Beautiful Soap Hub
Shellys Earth Materials
Dutchessravenna N Word
Great Clips Radio Road
Solarmovies Rick And Morty
Rennlist Com Forums
2010 Ford F-350 Super Duty XLT for sale - Wadena, MN - craigslist
Jetnet Retirees Aa
Franchisee Training & Support | Papa Johns Pizza Franchise UK
Morning Call Obits Today Legacy
Bronx Apartments For Rent Craigslist
What Does It Mean When Hulu Says Exp
Cvs On 30Th And Fowler
QuiBids Review: Legit Penny Auction or a Scam? The Truth... - MoneyPantry
Tamu Registration Worksheet
158 Rosemont Ringoes Rd, East Amwell Twp, NJ, 08559 | MLS #3921765 | RocketHomes
Stephen Dilbeck Obituary
Turtle Beach Velocity One Factory Reset
Navy Qrs Supervisor Answers
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 5589

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.