Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

make ROIAlign support position-sensitive pooling #13088

Merged
merged 10 commits into from
Jan 4, 2019
Merged

Conversation

shesung
Copy link
Contributor

@shesung shesung commented Nov 2, 2018

Description

Modify the RoIAlign operator to support position-sensitive roi pooling.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@pengzhao-intel
Copy link
Contributor

Thanks for the improvements.

Could you add the test case for the new feature?

@ankkhedia
Copy link
Contributor

@shesung Thanks for your contribution!
Request you to look into CI failures and add tests for new feature.
Also, could you please update PR description with what this PR actually do

@mxnet-label-bot [pr-awaiting-review, operator]

@marcoabreu marcoabreu added Operator pr-awaiting-review PR is waiting for code review labels Nov 2, 2018
@shesung
Copy link
Contributor Author

shesung commented Nov 2, 2018

Test case is added and CI failures is fixed.

@@ -213,14 +214,21 @@ void ROIAlignForward(
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From our local test, the better performance will be gained if we move this OMP into n_rois loop, L160.
Could you help change this and test the performance with your cases? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time complexity of the new case should be the same with the original one. I did the changes as you suggested and test the runtime for both cases. On my server with two E5-2683 v3, this change did bring obvious performance boost.

Copy link
Contributor

@pengzhao-intel pengzhao-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szha to review the API and algorithm change

@lupesko
Copy link
Contributor

lupesko commented Nov 20, 2018

@shesung thanks for the contribution!
Pulling in some more folks with expertise in this area: @anirudh2290 @apeforest @samskalicky @azai91

@vandanavk
Copy link
Contributor

LGTM.

@anirudh2290 @apeforest @samskalicky @azai91 any comments on this PR?

@roywei
Copy link
Member

roywei commented Dec 11, 2018

@shesung thanks for the contribution, could you trigger CI again?

@pengzhao-intel
Copy link
Contributor

@shesung could you rebase the code which will trigger the new CI?
It's almost the last step to complete the PR :)
@anirudh2290

@shesung
Copy link
Contributor Author

shesung commented Dec 26, 2018

@pengzhao-intel
Copy link
Contributor

pengzhao-intel commented Dec 26, 2018

Seems the problem of connection. Please try to retrigger the CI by adding a space/blank line in the code.

@pengzhao-intel
Copy link
Contributor

@wkcn do you mind take a review for this PR?

@shesung
Copy link
Contributor Author

shesung commented Dec 26, 2018

There seem to be some bugs in test_operator_gpu.test_poisson_generator which lead to failure of CI.

@wkcn
Copy link
Member

wkcn commented Dec 26, 2018

Thanks for your contribution!
The code works well, and I think it will be better to add a CHECK ‘input_channel % ( pooled_width*pooled_height)==0’ when position_sensitive is true.

@@ -17,6 +17,7 @@

# pylint: skip-file
from __future__ import print_function
from __future__ import division
Copy link
Member

@wkcn wkcn Dec 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types of variables are specific as float or int.
But it is useful for the consistency of division between py2 and py3.

@roywei
Copy link
Member

roywei commented Dec 26, 2018

Hi, @shesung could you try git rebase to the latest master? Some tests may be flaky, usually rebase to latest master or push an empty comit will solve it.
Running this test locally does not show any error

MXNET_TEST_SEED=1616106831  nosetests  --logging-level=DEBUG  --verbose -s tests/python/gpu/test_operator_gpu.py:test_poisson_generator
[INFO] Setting module np/mx/python random seeds, use MXNET_MODULE_SEED=1447546482 to reproduce.
[WARNING] *** test-level seed set: all "@with_seed()" tests run deterministically ***
test_operator_gpu.test_poisson_generator ... [INFO] Setting test np/mx/python random seeds, use MXNET_TEST_SEED=1616106831 to reproduce.
ok

----------------------------------------------------------------------
Ran 1 test in 5.083s

OK

Shape4(bshape[0], dshape[1], param.pooled_size[0], param.pooled_size[1]));
if (param.position_sensitive) {
CHECK_EQ(dshape[1] % (param.pooled_size[0]*param.pooled_size[1]), 0) <<
"Input channels shuold be divided by pooled_size[0]*pooled_size[1]";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo:shuold -> should

when position_sensitive is true.

Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo:shuold -> should

when position_sensitive is true.

Thanks.

Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thanks for your contribution!

@pengzhao-intel
Copy link
Contributor

@TaoLv could you help take a review and merge PR?

Copy link
Member

@TaoLv TaoLv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment. The rest looks good to me. Please re-trigger the CI before merging since the last run is about 6 days ago.

src/operator/contrib/roi_align.cc Outdated Show resolved Hide resolved
Copy link
Member

@TaoLv TaoLv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TaoLv
Copy link
Member

TaoLv commented Jan 4, 2019

@shesung Thank you for the contribution. I think it's good to merge now.

@TaoLv TaoLv merged commit 16cb135 into apache:master Jan 4, 2019
rondogency pushed a commit to rondogency/incubator-mxnet that referenced this pull request Jan 9, 2019
* make ROIAlign support position-sensitive pooling

* add unittest for RoIAlign op

* fix ccplint error

* fix python3 compability for unittest

* change OMP for better performance

* delete blank line to trigger CI

* add shape check when position_sensitive is true

* fix the typo

* typo: shuold -> should

* remove private() clause in omp statement
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* make ROIAlign support position-sensitive pooling

* add unittest for RoIAlign op

* fix ccplint error

* fix python3 compability for unittest

* change OMP for better performance

* delete blank line to trigger CI

* add shape check when position_sensitive is true

* fix the typo

* typo: shuold -> should

* remove private() clause in omp statement
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Operator pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants