Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new Batched NMS OP #23567

Merged
merged 27 commits into from Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1d8a762
First Implementation of basic batched non_max_suppression kernel and …
Oct 24, 2018
2d72aeb
Add NMSLite shape function
Oct 24, 2018
a8af48e
Added support for padding to the max_total_size (per batch). Output i…
Oct 25, 2018
ee3b59c
Updated with Debug messages (for dev effort only) and added clip box …
Oct 30, 2018
a930749
Remove debug prints
Oct 30, 2018
6b300cb
Updated kernel unit tests to account for clipped bounding box
Nov 1, 2018
ae64047
Add support for use_static_shapes.
Nov 3, 2018
9147806
Fix a bug in calculating max_detections
Nov 3, 2018
724b6bf
Added argument description, removed trailing whitespaces
Nov 6, 2018
742c2bd
Align function parameters, remove trailing whitespace
Nov 9, 2018
2ac1242
Addressed review comments. Made the following main changes
Nov 12, 2018
5f32198
Updated name of use_static_shapes to pad_per_class to better reflect the
Nov 15, 2018
4f5aa1f
Added more checks for NMS function. Updated name of the new NMS op to
Nov 26, 2018
ab84027
Addressed review comments from PR
Dec 6, 2018
1d36052
Use vector instead of priority_queue in kernel op
Dec 12, 2018
c93e0b5
Addressed last set of review comments. Added test for pad_per_class w…
Dec 13, 2018
487eae6
Clang and pylint formatting fixes
Dec 13, 2018
6c335a5
Added api_def_CombinedNonMaxSuppression.pbtxt based on test requireme…
Dec 13, 2018
ef53228
Added a comment describing 'q'
Dec 13, 2018
b1262df
Add float dtype to the python API
Dec 14, 2018
26a337d
Change golden APIs
Jan 8, 2019
9ec1797
Removed selected_indices return value for NMS op
Jan 17, 2019
fbe21f4
Update comment for pad_per_class
Jan 17, 2019
b1ee8b9
Use std::vector::reserve to optimize allocation
Jan 24, 2019
bc857b4
Change golden APIs for V1
Jan 26, 2019
3115b45
Move added NMS op in V1 golden API to keep the list sorted
Jan 28, 2019
2d3fa90
Do not set 5th output in CombinedNMSShapeFn
Jan 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,101 @@
op {
graph_op_name: "CombinedNonMaxSuppression"
in_arg {
name: "boxes"
description: <<END
A 4-D float tensor of shape `[batch_size, num_boxes, q, 4]`. If `q` is 1 then
same boxes are used for all classes otherwise, if `q` is equal to number of
classes, class-specific boxes are used.
END
}
in_arg {
name: "scores"
description: <<END
A 3-D float tensor of shape `[batch_size, num_boxes, num_classes]`
representing a single score corresponding to each box (each row of boxes).
END
}
in_arg {
name: "max_output_size_per_class"
description: <<END
A scalar integer tensor representing the maximum number of
boxes to be selected by non max suppression per class
END
}
in_arg {
name: "max_total_size"
description: <<END
A scalar representing maximum number of boxes retained over all classes.
END
}
in_arg {
name: "iou_threshold"
description: <<END
A 0-D float tensor representing the threshold for deciding whether
boxes overlap too much with respect to IOU.
END
}
in_arg {
name: "score_threshold"
description: <<END
A 0-D float tensor representing the threshold for deciding when to remove
boxes based on score.
END
}
attr {
name: "pad_per_class"
description: <<END
If false, the output nmsed boxes, scores and classes
are padded/clipped to `max_total_size`. If true, the
output nmsed boxes, scores and classes are padded to be of length
`max_size_per_class`*`num_classes`, unless it exceeds `max_total_size` in
which case it is clipped to `max_total_size`. Defaults to false.
END
}
out_arg {
name: "nmsed_boxes"
description: <<END
A [batch_size, max_detections, 4] float32 tensor
containing the non-max suppressed boxes.
END
}
out_arg {
name: "nmsed_scores"
description: <<END
A [batch_size, max_detections] float32 tensor
containing the scores for the boxes.
END
}
out_arg {
name: "nmsed_classes"
description: <<END
A [batch_size, max_detections] float32 tensor
containing the classes for the boxes.
END
}
out_arg {
name: "valid_detections"
description: <<END
A [batch_size] int32 tensor indicating the number of
valid detections per batch item. Only the top num_detections[i] entries in
nms_boxes[i], nms_scores[i] and nms_class[i] are valid. The rest of the
entries are zero paddings.
END
}
summary: "Greedily selects a subset of bounding boxes in descending order of score,"
description: <<END
This operation performs non_max_suppression on the inputs per batch, across
all classes.
Prunes away boxes that have high intersection-over-union (IOU) overlap
with previously selected boxes. Bounding boxes are supplied as
[y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any
diagonal pair of box corners and the coordinates can be provided as normalized
(i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm
is agnostic to where the origin is in the coordinate system. Also note that
this algorithm is invariant to orthogonal transformations and translations
of the coordinate system; thus translating or reflections of the coordinate
system result in the same boxes being selected by the algorithm.
The output of this operation is the final boxes, scores and classes tensor
returned after performing non_max_suppression.
END
}