-
Notifications
You must be signed in to change notification settings - Fork 56
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
How do I extract the features using an FPN based model? #7
Comments
@kevkid You might be facing this issue since FB/detectron2 has moved a lot and there are too many changes there to maintain compatibility. I ported changes from |
@faizanahemad I wrote this up to extract the features for a detectron2 model. I believe this is correct and I have lots of comments. Let me know if this looks right to you:
Your input should be a DataFrame with the following columns = ['dicom_id', 'path', 'report_path', 'report', 'study_id', 'y']
|
Hi @kevkid , do not find |
Hi @kevkid, your mask_rcnn_R_101_FPN_3x.yaml and @ThierryDeruyttere's faster_rcnn_R_101_C4_attr_caffemaxpool.yaml in #16 are starting point for my goal (repeatly, my goal is I am using a smaller backbone (for example, |
Hi @kevkid , after referring to detectron2_mscoco_proposal_maxnms.py and coming up with code in #6 , I am looking into your AttributeError: 'StandardROIHeads' object has no attribute '_shared_roi_transform' while /github/py-bottom-up-attention/detectron2/layers/roi_align.py in forward(ctx, input, roi, output_size, spatial_scale, sampling_ratio, aligned)
18 ctx.aligned = aligned
19 output = _C.roi_align_forward(
---> 20 input, roi, spatial_scale, output_size[0], output_size[1], sampling_ratio, aligned
21 )
22 return output
RuntimeError: Not compiled with GPU support (ROIAlign_forward at /github/py-bottom-up-attention/detectron2/layers/csrc/ROIAlign/ROIAlign.h:73)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x7fb5494f2193 in /opt/conda/lib/python3.6/site-packages/torch/lib/libc10.so)
frame #1: detectron2::ROIAlign_forward(at::Tensor const&, at::Tensor const&, float, int, int, int, bool) + 0x171 (0x7fb54867df61 in /github/py-bottom-up-attention/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #2: <unknown function> + 0x1faea (0x7fb54868daea in /github/py-bottom-up-attention/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #3: <unknown function> + 0x1aba0 (0x7fb548688ba0 in /github/py-bottom-up-attention/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #4: _PyCFunction_FastCallDict + 0x154 (0x5608c725ac54 in /opt/conda/bin/python)
frame #5: <unknown function> + 0x199abc (0x5608c72e2abc in /opt/conda/bin/python)
frame #6: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #7: PyEval_EvalCodeEx + 0x329 (0x5608c72dd9b9 in /opt/conda/bin/python)
frame #8: <unknown function> + 0x1957d4 (0x5608c72de7d4 in /opt/conda/bin/python)
frame #9: PyObject_Call + 0x3e (0x5608c725aa5e in /opt/conda/bin/python)
frame #10: THPFunction_apply(_object*, _object*) + 0xa8f (0x7fb59454c82f in /opt/conda/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
frame #11: _PyCFunction_FastCallDict + 0x91 (0x5608c725ab91 in /opt/conda/bin/python)
frame #12: <unknown function> + 0x199abc (0x5608c72e2abc in /opt/conda/bin/python)
frame #13: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #14: _PyFunction_FastCallDict + 0x11b (0x5608c72dd2db in /opt/conda/bin/python)
frame #15: _PyObject_FastCallDict + 0x26f (0x5608c725b01f in /opt/conda/bin/python)
frame #16: _PyObject_Call_Prepend + 0x63 (0x5608c725faa3 in /opt/conda/bin/python)
frame #17: PyObject_Call + 0x3e (0x5608c725aa5e in /opt/conda/bin/python)
frame #18: _PyEval_EvalFrameDefault + 0x19e7 (0x5608c7306e37 in /opt/conda/bin/python)
frame #19: <unknown function> + 0x192e66 (0x5608c72dbe66 in /opt/conda/bin/python)
frame #20: _PyFunction_FastCallDict + 0x1be (0x5608c72dd37e in /opt/conda/bin/python)
frame #21: _PyObject_FastCallDict + 0x26f (0x5608c725b01f in /opt/conda/bin/python)
frame #22: _PyObject_Call_Prepend + 0x63 (0x5608c725faa3 in /opt/conda/bin/python)
frame #23: PyObject_Call + 0x3e (0x5608c725aa5e in /opt/conda/bin/python)
frame #24: <unknown function> + 0x16b371 (0x5608c72b4371 in /opt/conda/bin/python)
frame #25: _PyObject_FastCallDict + 0x8b (0x5608c725ae3b in /opt/conda/bin/python)
frame #26: <unknown function> + 0x199c0e (0x5608c72e2c0e in /opt/conda/bin/python)
frame #27: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #28: _PyFunction_FastCallDict + 0x11b (0x5608c72dd2db in /opt/conda/bin/python)
frame #29: _PyObject_FastCallDict + 0x26f (0x5608c725b01f in /opt/conda/bin/python)
frame #30: _PyObject_Call_Prepend + 0x63 (0x5608c725faa3 in /opt/conda/bin/python)
frame #31: PyObject_Call + 0x3e (0x5608c725aa5e in /opt/conda/bin/python)
frame #32: _PyEval_EvalFrameDefault + 0x19e7 (0x5608c7306e37 in /opt/conda/bin/python)
frame #33: <unknown function> + 0x192e66 (0x5608c72dbe66 in /opt/conda/bin/python)
frame #34: _PyFunction_FastCallDict + 0x1be (0x5608c72dd37e in /opt/conda/bin/python)
frame #35: _PyObject_FastCallDict + 0x26f (0x5608c725b01f in /opt/conda/bin/python)
frame #36: _PyObject_Call_Prepend + 0x63 (0x5608c725faa3 in /opt/conda/bin/python)
frame #37: PyObject_Call + 0x3e (0x5608c725aa5e in /opt/conda/bin/python)
frame #38: <unknown function> + 0x16b371 (0x5608c72b4371 in /opt/conda/bin/python)
frame #39: _PyObject_FastCallDict + 0x8b (0x5608c725ae3b in /opt/conda/bin/python)
frame #40: <unknown function> + 0x199c0e (0x5608c72e2c0e in /opt/conda/bin/python)
frame #41: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #42: <unknown function> + 0x193c5b (0x5608c72dcc5b in /opt/conda/bin/python)
frame #43: <unknown function> + 0x199b95 (0x5608c72e2b95 in /opt/conda/bin/python)
frame #44: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #45: <unknown function> + 0x19329e (0x5608c72dc29e in /opt/conda/bin/python)
frame #46: <unknown function> + 0x193ed6 (0x5608c72dced6 in /opt/conda/bin/python)
frame #47: <unknown function> + 0x199b95 (0x5608c72e2b95 in /opt/conda/bin/python)
frame #48: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #49: <unknown function> + 0x193c5b (0x5608c72dcc5b in /opt/conda/bin/python)
frame #50: <unknown function> + 0x199b95 (0x5608c72e2b95 in /opt/conda/bin/python)
frame #51: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #52: PyEval_EvalCodeEx + 0x329 (0x5608c72dd9b9 in /opt/conda/bin/python)
frame #53: PyEval_EvalCode + 0x1c (0x5608c72de75c in /opt/conda/bin/python)
frame #54: <unknown function> + 0x1ba167 (0x5608c7303167 in /opt/conda/bin/python)
frame #55: _PyCFunction_FastCallDict + 0x91 (0x5608c725ab91 in /opt/conda/bin/python)
frame #56: <unknown function> + 0x199abc (0x5608c72e2abc in /opt/conda/bin/python)
frame #57: _PyEval_EvalFrameDefault + 0x30a (0x5608c730575a in /opt/conda/bin/python)
frame #58: _PyGen_Send + 0x256 (0x5608c72e5be6 in /opt/conda/bin/python)
frame #59: _PyEval_EvalFrameDefault + 0x144f (0x5608c730689f in /opt/conda/bin/python)
frame #60: _PyGen_Send + 0x256 (0x5608c72e5be6 in /opt/conda/bin/python)
frame #61: _PyEval_EvalFrameDefault + 0x144f (0x5608c730689f in /opt/conda/bin/python)
frame #62: _PyGen_Send + 0x256 (0x5608c72e5be6 in /opt/conda/bin/python)
frame #63: _PyCFunction_FastCallDict + 0x115 (0x5608c725ac15 in /opt/conda/bin/python) |
For |
@kevkid I also get this problem: does above code work ? |
❓ How to use Detectron2
Questions like:
I have a pretrained model (trained on custom data) and would like to be able to extract the features of the bounding boxes.
I keep getting
AttributeError: 'StandardROIHeads' object has no attribute '_shared_roi_transform'
I apologized if the answer is obvious, I am very new to object detection.
Thank you!
EDIT
I am confused, I have detectron2 installed. Can I install this onto of my current installation and use it? I ask because it looks like there is a fork of detectron2 in this package which is different from the original detectron2. If I train a model using vanilla detectron2 and install this, can I just load the model weights, and extract the features from there?
The text was updated successfully, but these errors were encountered: