Skip to content
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

ModuleNotFoundError: No module named 'lib.fpn.box_intersections_cpu.bbox' #1

Closed
PrimoWW opened this issue Aug 14, 2021 · 5 comments
Closed

Comments

@PrimoWW
Copy link

PrimoWW commented Aug 14, 2021

thanks for your great job.
when I followed README, and try to run the train command:

python train.py -mode predcls -datasize large -data_path $DATAPATH

I had some problem.
First, in dataloader/action_genome.py, from scipy.misc import imread . the lib scipy seems not surport the fuction imread in latest version. so i change it to from imageio import imread

Second, when I continue totry to run the project, a new problem occured:
ModuleNotFoundError: No module named 'lib.fpn.box_intersections_cpu.bbox'
it means i didnt generate the file in this directory, so I went back to

cd fpn/box_intersections_cpu
python setup.py install ( i found if i dont add 'install ' , the command cant work)

and then

~/project/STTran/lib/fpn/box_intersections_cpu$ python setup.py install
running install
running build
running build_ext
running install_lib
running install_egg_info
Removing /home/liujingwei/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/bbox_cython-0.0.0-py3.7.egg-info
Writing /home/liujingwei/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/bbox_cython-0.0.0-py3.7.egg-info

So, it didnt generate the file(lib.fpn.box_intersections_cpu.bbox), and i dont know how to fix it, then I may need your help.^_^

@yrcong
Copy link
Owner

yrcong commented Aug 14, 2021

  1. My scipy version is 1.1.0. You could switch to this version.
  2. You could use
python setup.py build_ext --inplace

to compile the box_intersections_cpu/draw_rectangles code.

Please let me know if you still meet some problems:)

@PrimoWW
Copy link
Author

PrimoWW commented Aug 15, 2021

thanks for your advice! when I fixed these problem with your help. Then I countinued to run the code, and the program raise a ERROR

ImportError: cannot import name '_C' from 'fasterRCNN.lib.model' (/home/xxx/project/STTran/fasterRCNN/lib/model/init.py)

so ,I solved the problem by running (maybe you should add this command into README)

/STTran/fasterRCNN/lib$ python setup.py build_ext --inplace

and then , I met this error:

Traceback (most recent call last):
File "train.py", line 41, in
object_detector = detector(train=True, object_classes=AG_dataset_train.object_classes, use_SUPPLY=True, mode=conf.mode).to(device=gpu_device)
File "/home/xxx/project/STTran/lib/object_detector.py", line 29, in init
checkpoint = torch.load('fasterRCNN/models/faster_rcnn_ag.pth.pth')
File "/home/xxx/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/torch/serialization.py", line 381, in load
f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'fasterRCNN/models/faster_rcnn_ag.pth.pth'

I found the reason is that In the file lib/object_detector.py , 29th line,
checkpoint = torch.load('fasterRCNN/models/faster_rcnn_ag.pth.pth')
it seems that there are double 'pth'.

when I solved these problem , I can run the program successfully. but unfortunately I found there is not enough GPU memory that I need. So I may continue to ask questions when I have enough GPU memory. :)

@yrcong
Copy link
Owner

yrcong commented Aug 15, 2021

Thanks for reminding! There is a redundant suffix exactly.

For GPU, I used RTX2080ti (ca. 11GB memory).

@PrimoWW
Copy link
Author

PrimoWW commented Aug 17, 2021

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
loading word vectors from data/glove.6B.200d.pt
loading word vectors from /home/xxx/Dokumente/neural-motifs-master/data/glove.6B.200d.pt
background -> background
fail on background
Traceback (most recent call last):
File "train.py", line 102, in
entry = object_detector(im_data, im_info, gt_boxes, num_boxes, gt_annotation ,im_all=None)
File "/home/xxx/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/xxx/project/STTran/lib/object_detector.py", line 306, in forward
FINAL_FEATURES = self.fasterRCNN.RCNN_roi_align(FINAL_BASE_FEATURES, FINAL_BBOXES)
File "/home/xxx/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, kwargs)
File "/home/xxx/project/STTran/fasterRCNN/lib/model/roi_layers/roi_align.py", line 58, in forward
input, rois, self.output_size, self.spatial_scale, self.sampling_ratio
File "/home/xxx/project/STTran/fasterRCNN/lib/model/roi_layers/roi_align.py", line 20, in forward
output = _C.roi_align_forward(input, roi, spatial_scale, output_size[0], output_size[1], sampling_ratio)
RuntimeError: Not compiled with GPU support (ROIAlign_forward at /home/xxx/project/STTran/fasterRCNN/lib/model/csrc/ROIAlign.h:21)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x6d (0x7fc22b3171cd in /home/xxx/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: + 0xb314 (0x7fc1f4145314 in /home/xxx/project/STTran/fasterRCNN/lib/model/_C.cpython-37m-x86_64-linux-gnu.so)
frame #2: + 0x22164 (0x7fc1f415c164 in /home/xxx/project/STTran/fasterRCNN/lib/model/_C.cpython-37m-x86_64-linux-gnu.so)
frame #3: + 0x1d7f4 (0x7fc1f41577f4 in /home/xxx/project/STTran/fasterRCNN/lib/model/_C.cpython-37m-x86_64-linux-gnu.so)

frame #8: THPFunction_apply(_object
, _object
) + 0xa56 (0x7fc24dbda5f6 in /home/xxx/anaconda3/envs/scene_graph_benchmark/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #41: __libc_start_main + 0xf3 (0x7fc25c8200b3 in /lib/x86_64-linux-gnu/libc.so.6)

there are a problem that i cant solve, i guess that maybe I cant use the C lib.

@PrimoWW PrimoWW closed this as completed Aug 19, 2021
@PrimoWW
Copy link
Author

PrimoWW commented Aug 19, 2021

thank you for your help! I ran the code successfully

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

No branches or pull requests

2 participants