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/06/18 16:11:04 UTC
[GitHub] [incubator-tvm] yongwww opened a new pull request #5844: [Relay] symbolic max_output_size
yongwww opened a new pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844
- modify nms to support symbolic max_output_size
- stop iou computation once get enough boxes
@kevinthesun @zhiics @icemelon9 @lixiaoquan
----------------------------------------------------------------
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] yongwww commented on pull request #5844: [Relay] symbolic max_output_size
Posted by GitBox <gi...@apache.org>.
yongwww commented on pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844#issuecomment-646139868
Tested with 20000 random boxes (score_threshold=0, iou_threshold=0.6, max_output_size=7) on my local env., the execution time of nms decreased to 0.003057119846343994 second from 0.39738729953765867
----------------------------------------------------------------
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 merged pull request #5844: [Relay] symbolic max_output_size
Posted by GitBox <gi...@apache.org>.
kevinthesun merged pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844
----------------------------------------------------------------
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 #5844: [Relay] symbolic max_output_size
Posted by GitBox <gi...@apache.org>.
kevinthesun commented on a change in pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844#discussion_r442390568
##########
File path: topi/python/topi/vision/nms.py
##########
@@ -326,30 +329,40 @@ def hybrid_nms(data, sorted_index, valid_count, indices, batch_size, num_anchors
# Apply nms
box_start_idx = coord_start
batch_idx = i
+ num_valid_boxes = 0
for j in range(valid_count[i]):
- if output[i, j, score_index] > 0 and (id_index < 0 or output[i, j, id_index] >= 0):
+ if num_valid_boxes == max_output_size:
+ for k in range(box_data_length):
+ output[i, j, k] = -one
+ box_indices[i, j] = -1
+
+ elif output[i, j, score_index] > 0:
box_a_idx = j
- for k in parallel(valid_count[i]):
+ is_valid_box = 1
+
+ # a_l: left, a_t: top, a_r: right, a_b: bottom
+ a_l = min(output[batch_idx, box_a_idx, box_start_idx],
+ output[batch_idx, box_a_idx, box_start_idx + 2])
+ a_t = min(output[batch_idx, box_a_idx, box_start_idx + 1],
+ output[batch_idx, box_a_idx, box_start_idx + 3])
+ a_r = max(output[batch_idx, box_a_idx, box_start_idx],
+ output[batch_idx, box_a_idx, box_start_idx + 2])
+ a_b = max(output[batch_idx, box_a_idx, box_start_idx + 1],
+ output[batch_idx, box_a_idx, box_start_idx + 3])
+
+ # check if current box j is valid by calculating iou with
+ # all existing valid boxes
+ for k in parallel(j):
Review comment:
```suggestion
for k in range(j):
```
I found use serial loop here can actually improve performance a bit.
----------------------------------------------------------------
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 pull request #5844: [Relay] symbolic max_output_size
Posted by GitBox <gi...@apache.org>.
kevinthesun commented on pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844#issuecomment-648325370
Can we also add a TODO to topi cuda nms?
----------------------------------------------------------------
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 pull request #5844: [Relay] symbolic max_output_size
Posted by GitBox <gi...@apache.org>.
kevinthesun commented on pull request #5844:
URL: https://github.com/apache/incubator-tvm/pull/5844#issuecomment-650945939
Thanks @yongwww
----------------------------------------------------------------
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