You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/07/17 05:46:31 UTC

[GitHub] [incubator-tvm] csullivan opened a new pull request #6085: [Relay][OP] Support NMSv4

csullivan opened a new pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085


   Add support for `pad_to_max_output_size` field in NMSv4 from Tensorflow which results in two outputs: 
   1. Indices tensor (vector of length max_num_indices.
   2. Scalar tensor indicating the number of valid entries in the indices tensor.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6085: [Relay][OP] Support NMSv4

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085#discussion_r456757509



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -637,10 +637,11 @@ def _impl(inputs, attr, params, mod):
         iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
         # score_threshold was introduced from V3
         score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if len(inputs) > 4 else 0.0
+        pad_output = 'pad_to_max_output_size'
 
         # Generate data with shape (1, num_anchors, 5)
         scores = AttrCvt(op_name="expand_dims",
-                         ignores=['T_threshold'],
+                         ignores=['T_threshold', pad_output],

Review comment:
       We want to do padding if number of boxed is smaller than `max_output_size`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6085: [Relay][OP] Support NMSv4

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085#discussion_r456757509



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -637,10 +637,11 @@ def _impl(inputs, attr, params, mod):
         iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
         # score_threshold was introduced from V3
         score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if len(inputs) > 4 else 0.0
+        pad_output = 'pad_to_max_output_size'
 
         # Generate data with shape (1, num_anchors, 5)
         scores = AttrCvt(op_name="expand_dims",
-                         ignores=['T_threshold'],
+                         ignores=['T_threshold', pad_output],

Review comment:
       We want to do padding if number of output boxes is smaller than `max_output_size`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6085: [Relay][OP] Support NMSv4

Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085#discussion_r460322183



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -637,10 +637,11 @@ def _impl(inputs, attr, params, mod):
         iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
         # score_threshold was introduced from V3
         score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if len(inputs) > 4 else 0.0
+        pad_output = 'pad_to_max_output_size'
 
         # Generate data with shape (1, num_anchors, 5)
         scores = AttrCvt(op_name="expand_dims",
-                         ignores=['T_threshold'],
+                         ignores=['T_threshold', pad_output],

Review comment:
       We need to handle ```True``` case instead of just ignoring it?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] csullivan commented on a change in pull request #6085: [Relay][OP] Support NMSv4

Posted by GitBox <gi...@apache.org>.
csullivan commented on a change in pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085#discussion_r460449924



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -637,10 +637,11 @@ def _impl(inputs, attr, params, mod):
         iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
         # score_threshold was introduced from V3
         score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if len(inputs) > 4 else 0.0
+        pad_output = 'pad_to_max_output_size'
 
         # Generate data with shape (1, num_anchors, 5)
         scores = AttrCvt(op_name="expand_dims",
-                         ignores=['T_threshold'],
+                         ignores=['T_threshold', pad_output],

Review comment:
       It's not ignored, this PR adds explicit support to `__nms()` for the `pad_to_max_output_size=True` case, see lines 671/2. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-tvm] csullivan commented on a change in pull request #6085: [Relay][OP] Support NMSv4

Posted by GitBox <gi...@apache.org>.
csullivan commented on a change in pull request #6085:
URL: https://github.com/apache/incubator-tvm/pull/6085#discussion_r459608948



##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -637,10 +637,11 @@ def _impl(inputs, attr, params, mod):
         iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
         # score_threshold was introduced from V3
         score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if len(inputs) > 4 else 0.0
+        pad_output = 'pad_to_max_output_size'
 
         # Generate data with shape (1, num_anchors, 5)
         scores = AttrCvt(op_name="expand_dims",
-                         ignores=['T_threshold'],
+                         ignores=['T_threshold', pad_output],

Review comment:
       NMSv4 semantics allow for the user to define whether or not to pad the output using `pad_to_max_output_size=True/False`, see the example I provided in the test. Some pre-trained TF models use NMSv4 with pad_to_max_output_size=True, in which case, yes, they expect padding of the indices if the number of boxes is less than `max_output_size`, as well as an additional scalar output specifying the number of valid boxes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org