Open rzamarefat opened 3 years ago
Same problem,please give some advise.
I add following code under class Beziers:, but another error occured. def len(self): self.tensor.len()
The another error is :
Traceback (most recent call last):
File "demo/demo.py", line 88, in
anyone can give some advise?
安装文档中找到相应解决方案,在readme的Installation里。 First install Detectron2 following the official guide: INSTALL.md. Please use Detectron2 with commit id 9eb4831 if you have any issues related to Detectron2.
I met the same problem and solved it by reinstalling AdelaiDet with prebuilt detectron2. I don't know if this is the right way, but at least I can use demo.py with pre-trained model (ctw1500_attn_R_50.pth).
In my case, when I installed detection2 by following "Build Detectron2 from Source" with the below command
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
and then try to run demo.py, I got "AttributeError: 'Beziers' object has no attribute 'len'"
After I reinstalled AdelaiDet with prebuilt detectron2 by following command,
(I use Pytorch 1.9.1 and cuda 11.1, check your pytorch and cuda version and change /cu111/torch1.9/
part)
cd AdelaiDet/
rm -r build/
pip uninstall detectron2
python -m pip install detectron2 -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html
python setup.py build develop
now I can run demo.py without the error. Hope it helps :D
Thanks. I have tested using Detectron2 with commit id 9eb4831, and the error does not occur. You may find the link here https://github.com/aim-uofa/AdelaiDet#Installation
I met the same problem and solved it by reinstalling AdelaiDet with prebuilt detectron2. I don't know if this is the right way, but at least I can use demo.py with pre-trained model (ctw1500_attn_R_50.pth).
In my case, when I installed detection2 by following "Build Detectron2 from Source" with the below command
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
and then try to run demo.py, I got "AttributeError: 'Beziers' object has no attribute 'len'"
After I reinstalled AdelaiDet with prebuilt detectron2 by following command, (I use Pytorch 1.9.1 and cuda 11.1, check your pytorch and cuda version and change
/cu111/torch1.9/
part)cd AdelaiDet/ rm -r build/ pip uninstall detectron2 python -m pip install detectron2 -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html python setup.py build develop
now I can run demo.py without the error. Hope it helps :D
My Rocm to compile with commit id 9eb4831 will error,do you know the reason?how to solve it,please?
Same problem,Try the above methods will not work,and display in pycharm :
Arguments: Namespace(confidence_threshold=0.3, config_file='configs/BAText/ReCTS/v2_chn_attn_R_50.yaml', input='datasets/ReCTS_test_images/', opts=['MODEL.WEIGHTS weight/model_v2_rects.pth'], output=None, video_input=None, webcam=False) Traceback (most recent call last):
File "/home/jsj/AdelaiDet-master/AdelaiDet-master/demo/demo.py", line 78, in <module> cfg = setup_cfg(args)
File "/home/jsj/AdelaiDet-master/AdelaiDet-master/demo/demo.py", line 23, in setup_cfg cfg.merge_from_file(args.config_file)
File "/home/jsj/detectron2/detectron2/config/config.py", line 45, in merge_from_file assert PathManager.isfile(cfg_filename), f"Config file '{cfg_filename}' does not exist!"
AssertionError: Config file 'configs/BAText/ReCTS/v2_chn_attn_R_50.yaml' does not exist!
But the file exists and the path is correct.how to solve it,please?
The same problem encountered. Solved by re-installing detectron at version 0.5. (https://github.com/facebookresearch/detectron2/releases)
Installing detectron version 0.5 - Didn't work for me
Installing the detectron with commit id 9eb4831 - Worked https://github.com/facebookresearch/detectron2.git@9eb4831f742ae6a13b8edb61d07b619392fb6543 (I had pytorch 1.9, not sure if it makes any difference)
In adet/structures/beziers.py add the following magic method:
def __len__(self):
return self.tensor.shape[0]
def len(self): return self.tensor.shape[0]
Thanks for your valuable comment which truly helps me.
def len(self): return self.tensor.shape[0]
Thanks for your valuable comment which truly helps me.
A newer version of CUDA and PyTorch should be matched. Here is the link: https://github.com/facebookresearch/detectron2/releases
I had the same issue. But once I downgrade the PyTorch it worked.
I add following code under class Beziers:, but another error occured. def len(self): self.tensor.len()
The another error is : Traceback (most recent call last): File "demo/demo.py", line 88, in predictions, visualized_output = demo.run_on_image(img) File "/mnt/datadisk0/zsf/AdelaiDet/demo/predictor.py", line 54, in run_on_image predictions = self.predictor(image) File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 316, in call predictions = self.model([inputs])[0] File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "/mnt/datadisk0/zsf/AdelaiDet/adet/modeling/one_stage_detector.py", line 100, in forward return self.inference(batched_inputs) File "/mnt/datadisk0/zsf/AdelaiDet/adet/modeling/one_stagedetector.py", line 164, in inference results, = self.roi_heads(images, features, proposals, None) File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/mnt/datadisk0/zsf/AdelaiDet/adet/modeling/roi_heads/text_head.py", line 208, in forward bezier_features = self.pooler(features, beziers) File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/mnt/datadisk0/zsf/AdelaiDet/adet/modeling/poolers.py", line 135, in forward pooler_fmt_boxes = convert_boxes_to_pooler_format(box_lists) File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/detectron2/modeling/poolers.py", line 86, in convert_boxes_to_pooler_format sizes = shapes_to_tensor([x.len() for x in box_lists], device=boxes.device) File "/home/ubuntu/miniconda3/envs/torch/lib/python3.8/site-packages/detectron2/layers/wrappers.py", line 35, in shapes_to_tensor return torch.as_tensor(x, device=device) RuntimeError: Could not infer dtype of NoneType
anyone can give some advise?
it just work for me without any error,thx a lot
Hi. Thank you for the great repo. I have followed instructions to installation and usage of ABCNet and everything have gone well. But the problem is when I run the demo I got the following error: 'Beziers' object has no attribute 'len'
This problem lies on 86th line of poolers.py module of detectron2. How can I solve this?