Yangr116 / BoxSnake

[ICCV 2023] BoxSnake official repository.
https://arxiv.org/pdf/2303.11630.pdf
Apache License 2.0
66 stars 6 forks source link

AttributeError: 'FPN' object has no attribute 'padding_constraints' #4

Closed shanghangjiang closed 1 year ago

shanghangjiang commented 1 year ago

是我的detectron2版本不对吗?

Yangr116 commented 1 year ago

你可以 clone detectron2,然后重新安装一下:

git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2

如果还有问题,你可以给我你的环境信息,我们进一步讨论

shanghangjiang commented 1 year ago

重装之后遇到了新的问题 -- Process 1 terminated with the following error: Traceback (most recent call last): File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap fn(i, args) File "/data/shjiang/BoxSnake/detectron2/detectron2/engine/launch.py", line 123, in _distributed_worker main_func(args) File "/data/shjiang/BoxSnake/train_vdd.py", line 273, in main return trainer.train() File "/data/shjiang/BoxSnake/detectron2/detectron2/engine/defaults.py", line 484, in train super().train(self.start_iter, self.max_iter) File "/data/shjiang/BoxSnake/detectron2/detectron2/engine/train_loop.py", line 155, in train self.run_step() File "/data/shjiang/BoxSnake/detectron2/detectron2/engine/defaults.py", line 494, in run_step self._trainer.run_step() File "/data/shjiang/BoxSnake/detectron2/detectron2/engine/train_loop.py", line 310, in run_step loss_dict = self.model(data) File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, kwargs) File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 799, in forward output = self.module(*inputs[0], *kwargs[0]) File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(input, kwargs) File "/data/shjiang/BoxSnake/modeling/newrcnn.py", line 198, in forward , detector_losses = self.roi_heads(images_info, features, proposals, gt_instances) File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/data/shjiang/BoxSnake/modeling/roi_heads/roi_heads.py", line 147, in forward losses.update(self._forward_mask(images, features, proposals, targets=targets)) File "/data/shjiang/BoxSnake/modeling/roi_heads/roi_heads.py", line 208, in _forward_mask if self.enable_roi_jitter: File "/data/shjiang/anaconda3/envs/mmdetection2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'StandardROIHeadsV2' object has no attribute 'enable_roi_jitter'

shanghangjiang commented 1 year ago

这个是我的环境 absl-py 1.4.0 addict 2.4.0 AdelaiDet 0.2.0 /data/shjiang/AdelaiDet aiohttp 3.8.4 aiosignal 1.3.1 antlr4-python3-runtime 4.9.3 appdirs 1.4.4 async-timeout 4.0.2 attrs 22.2.0 black 21.4b2 boxinst-plugin 0.0.1 /data/shjiang/BoxInstSeg/mmdet/ops/pairwise cachetools 4.2.4 cement 3.0.8 certifi 2022.12.7 cffi 1.15.1 charset-normalizer 3.1.0 click 8.1.3 cloudpickle 2.2.1 cmake 3.26.1 colorama 0.4.6 contourpy 1.0.7 cycler 0.11.0 Cython 0.29.33 cytoolz 0.12.0 dask 2022.2.0 detectron2 0.6 /data/shjiang/BoxSnake/detectron2 dnspython 2.3.0 editdistance 0.6.2 fairscale 0.4.13 Faker 18.9.0 filelock 3.10.7 fonttools 4.39.0 frozenlist 1.3.3 fsspec 2023.3.0 future 0.18.3 fvcore 0.1.5.post20221221 google-auth 1.35.0 google-auth-oauthlib 0.4.6 grpcio 1.51.3 huggingface-hub 0.13.3 hydra-core 1.3.2 idna 3.4 imageio 2.26.0 importlib-metadata 6.1.0 importlib-resources 5.12.0 iopath 0.1.9 Jinja2 3.1.2 kiwisolver 1.4.4 lazy_loader 0.1 lightning-utilities 0.8.0 lit 16.0.0 lmdb 1.4.0 locket 1.0.0 Markdown 3.4.3 markdown-it-py 2.2.0 MarkupSafe 2.1.2 matplotlib 3.7.1 mdurl 0.1.2 mkl-service 2.4.0 mmcv-full 1.5.0 mmdet 2.25.0 /data/shjiang/BoxInstSeg model-index 0.1.11 mpmath 1.3.0 multidict 6.0.4 MultiScaleDeformableAttention 1.0 mypy-extensions 1.0.0 networkx 3.0 numpy 1.24.2 nvidia-cublas-cu11 11.10.3.66 nvidia-cuda-cupti-cu11 11.7.101 nvidia-cuda-nvrtc-cu11 11.7.99 nvidia-cuda-runtime-cu11 11.7.99 nvidia-cudnn-cu11 8.5.0.96 nvidia-cufft-cu11 10.9.0.58 nvidia-curand-cu11 10.2.10.91 nvidia-cusolver-cu11 11.4.0.1 nvidia-cusparse-cu11 11.7.4.91 nvidia-nccl-cu11 2.14.3 nvidia-nvtx-cu11 11.7.91 oauthlib 3.2.2 olefile 0.46 omegaconf 2.3.0 opencv-python 4.7.0.72 openmim 0.3.6 ordered-set 4.1.0 packaging 23.0 pandas 1.5.3 partd 1.3.0 pathspec 0.11.1 Pillow 9.4.0 pip 23.0.1 Polygon3 3.0.9.1 portalocker 2.7.0 protobuf 4.21.12 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycocotools 2.0.6 pycparser 2.21 pydot 1.4.2 Pygments 2.14.0 pymongo 4.3.3 pyparsing 3.0.9 python-dateutil 2.8.2 pytorch-lightning 2.0.1 pytz 2022.7.1 PyWavelets 1.4.1 PyYAML 6.0 rapidfuzz 2.15.0 rasterizer 0.0.0 regex 2023.3.23 requests 2.28.2 requests-oauthlib 1.3.1 rich 13.3.2 rsa 4.9 scikit-image 0.19.3 scipy 1.9.3 setuptools 59.5.0 shapely 2.0.1 six 1.16.0 sympy 1.11.1 tabulate 0.9.0 tensorboard 1.15.0 tensorboard-data-server 0.7.0 tensorboard-plugin-wit 1.8.1 termcolor 2.2.0 terminaltables 3.1.10 tifffile 2023.2.28 timm 0.6.13 toml 0.10.2 toolz 0.12.0 torch 1.9.1+cu111 torchmetrics 0.11.4 torchvision 0.10.1+cu111 tornado 6.2 tqdm 4.65.0 tree-filter 0.1 /data/shjiang/BoxInstSeg/mmdet/ops/tree_filter triton 2.0.0 typing_extensions 4.5.0 urllib3 1.26.15 Werkzeug 2.2.3 wheel 0.40.0 yacs 0.1.8 yapf 0.32.0 yarl 1.8.2 zipp 3.15.0

Yangr116 commented 1 year ago

你可以使用最新的代码(git pull) 和 issue#3 相同

shanghangjiang commented 1 year ago

您好,我是昨天clone的代码,我想应该是最新的,我仔细检查了下StandardROIHeadsV2这个类,发现enable_roi_jitter参数没有传给self,有没有可能是这个原因呢

shanghangjiang commented 1 year ago

在StandardROIHeadsV2这个类中,enable_roi_jitter和roi_jitter并没有赋值给self.enable_roi_jitter和self.roi_jitter,会不会是这个原因呀

Original Email

Sender:"Rui Yang"< @.*** >;

Sent Time:2023/6/15 22:36

To:"Yangr116/BoxSnake"< @.*** >;

Cc recipient:"shanghangjiang"< @. >;"Author"< @. >;

Subject:Re: [Yangr116/BoxSnake] AttributeError: 'FPN' object has no attribute'padding_constraints' (Issue #4)

你可以使用最新的代码(git pull) 和 issue#3 相同

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Yangr116 commented 1 year ago

感谢指正,已经修改

zebbsb commented 1 year ago

补充一下,by 2023.10.16, detectron2的prefetch_factor变量是有问题的,如果用最新的版本的detectorn2,FPN可能不会出现问题但是会显示: assert prefetch_factor > 0, TypeError '>' not supported between instances of 'NoneType' and 'int' https://github.com/facebookresearch/detectron2/commit/fc9c33b1f6e5d4c37bbb46dde19af41afc1ddb2a is solution.