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

Add vanilla and optimized cpu device to detectron #596

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jgong5
Copy link

@jgong5 jgong5 commented Aug 2, 2018

I would like to use this PR to initiate the support of CPU device paths in detectron. Changes are made minimal in this PR to ask the advice from the community a good integration approach to follow. There are two major changes:

  1. detectron/utils/env.py would load "lib/libcaffe2_detectron_ops.so" if "lib/libcaffe2_detectron_ops_gpu.so" is not found. A separate PR will be submitted to PyTorch/Caffe2 to generate this dynamic lib which contains only CPU ops.
  2. detectron/utils/c2.py: borrows the functions GpuNameScope/CudaScope to support vanilla CPU (gpu_id==-1) and optimized CPU (gpu_id==-2) devices.

Renaming the hard-coded GpuNameScope/CudaScope to more general names might be a more elegant approach but this would require changes of many places in detectron code. Any suggestions?

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@gadcam
Copy link
Contributor

gadcam commented Aug 2, 2018

@jgong5 Good to see other people are trying to solve big issues of the Detectron!

Does this mean with this PR merged we can already run Mask R-CNN models and Keypoint Mask R-CNN models ? Or some operators are still missing from PyTorch/Caffe2 ?
What did you achieve to run today ?

@jgong5
Copy link
Author

jgong5 commented Aug 3, 2018

@gadcam The accompanying PR for PyTorch/Caffe2 is here:
pytorch/pytorch#10157

We validated the accuracy of Faster-RCNN and Mask-RCNN with ResNet-50/FPN backbone.

@gadcam gadcam mentioned this pull request Aug 4, 2018
3 tasks
@jgong5
Copy link
Author

jgong5 commented Aug 8, 2018

@gadcam Any comments? Possible to merge the changes? We will PR further optimizations to PyTorch and Detectron repo. But this PR would be the baseline.

@gadcam
Copy link
Contributor

gadcam commented Aug 9, 2018

@jgong5

Any comments? Possible to merge the changes?

My comments here have no special value and I have no way to influence the merge decisions, I am a contributor like you :)

I think you should ping @rbgirshick and @ir413 which are the maintainers.

@jgong5
Copy link
Author

jgong5 commented Aug 10, 2018

@rbgirshick @ir413 Any comments?

@jspisak
Copy link

jspisak commented Aug 30, 2018

@rbgirshick - can you take a look and confirm?

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants