Maskrcnn-benchmark: AttributeError: 'list' object has no attribute 'resize'

Created on 10 Jun 2019  ·  10Comments  ·  Source: facebookresearch/maskrcnn-benchmark

❓ Questions and Help

The error information:
AttributeError: Traceback (most recent call last):
File "/home/anaconda3/envs/nms/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 108, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/anaconda3/envs/nms/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 108, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "maskscoring_nms/maskrcnn_benchmark/data/datasets/coco.py", line 52, in __getitem__
img, anno = super(COCODataset, self).__getitem__(idx)
File "/home/anaconda3/envs/nms/lib/python3.7/site-packages/torchvision-0.3.0a0+8a64dbc-py3.7-linux-x86_64.egg/torchvision/datasets/coco.py", line 114, in __getitem__
img, target = self.transforms(img, target)
File "maskscoring_nms/maskrcnn_benchmark/data/transforms/transforms.py", line 15, in __call__
image, target = t(image, target)
File "maskscoring_nms/maskrcnn_benchmark/data/transforms/transforms.py", line 58, in __call__
target = target.resize(image.size)

AttributeError: 'list' object has no attribute 'resize'

I know the right fomat should be "Boxlist", but I don't know how to cause this problems. I only rebuild the softNMS. HELP!

Most helpful comment

Try to use torchvision==0.2.1

All 10 comments

Try to use torchvision==0.2.1

Use torchvision==0.2.1 can solve this problem.

@XdpAreKid @SkeletonOne Thank you very much!It works!

@sunycl , changing to torchvision 0.2.1 throws the following error now

IndexError: list index out of range

The problem is due to the fact that you are using a bad combination of maskrcnn-benchmark and torchvision, and has been fixed in https://github.com/facebookresearch/maskrcnn-benchmark/pull/744

if I use torch1.4+cuda10.1+torchvision0.5 ,can I just turn torchvision==0.5 to torchvision==0.2.1? I'm worry about Their version adaptation problem。 @sunycl @fmassa

@LIYHUI I have the same configuration like you. I install torch1.4+cuda10.1+torchvision0.5. And I face the same problem of getting "'list' object has no attribute 'resize'".
Have you tried to replace torchvision0.5 with torchvision0.2? Did any wrong happen?
I am really looking forward to your reply. Thanks

https://blog.csdn.net/qq_41574648/article/details/104807711 You can try it!

------------------ 原始邮件 ------------------
发件人: "WYBupup"<[email protected]>;
发送时间: 2020年3月17日(星期二) 晚上6:22
收件人: "facebookresearch/maskrcnn-benchmark"<[email protected]>;
抄送: "迁就你"<[email protected]>; "Mention"<[email protected]>;
主题: Re: [facebookresearch/maskrcnn-benchmark] AttributeError: 'list' object has no attribute 'resize' (#876)

@LIYHUI I have the same configuration like you. I install torch1.4+cuda10.1+torchvision0.5. And I face the same problem of getting "'list' object has no attribute 'resize'".
Have you tried to replace torchvision0.5 with torchvision0.2? Did any wrong happen?
I am really looking forward to your reply. Thanks


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@LIYHUI thanks for your fast reply. But your URL is expired. Could you please send me the URL another time. Thanks a lt!!!

首先这个问题出现是由于我下载的GitHub源码是别人的,不是Facebook官方的才导致。如果你也是从别人那下载的,很有可能别人改动了代码导致此bug。

解决方法:

定位:maskrcnn_benchmark/data/datasets/coco.py

line:66, 95, 96

self.transform 改为 self._transform

如果你的代码是 self._transform,那这里的情况可能不适用你,需要查找其他其原因

------------------ 原始邮件 ------------------
发件人: "WYBupup"<[email protected]>;
发送时间: 2020年3月17日(星期二) 晚上7:04
收件人: "facebookresearch/maskrcnn-benchmark"<[email protected]>;
抄送: "迁就你"<[email protected]>; "Mention"<[email protected]>;
主题: Re: [facebookresearch/maskrcnn-benchmark] AttributeError: 'list' object has no attribute 'resize' (#876)

@LIYHUI thanks for your fast reply. But your URL is expired. Could you please send me the URL another time. Thanks a lt!!!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

auroua picture auroua  ·  3Comments

adityaarun1 picture adityaarun1  ·  3Comments

nanyoullm picture nanyoullm  ·  3Comments

BelhalK picture BelhalK  ·  4Comments

jbitton picture jbitton  ·  4Comments