wangyuxin87 / ContourNet

A PyTorch implementation of "ContourNet: Taking a Further Step toward Accurate Arbitrary-shaped Scene Text Detection" (CVPR2020)
Other
227 stars 46 forks source link

AttributeError: 'dict' object has no attribute 'resize' #38

Closed sssimpleboy closed 2 years ago

sssimpleboy commented 2 years ago

When I ran this code "bash test_contour.sh" , "AttributeError: 'dict' object has no attribute 'resize'" appeared. my torch version is 1.3.1 , torchvision is 0.4.2 and my cuda is 10.1. I spent three days but make little progress. If I change it to torch1.0.0 and torchvision0.2 ,will it work? I had tried to use install the recommened version but failed with many other problems. Could you tell me how to run it in current environment ? Thank you. And I advise you to create a docker images if convenient.

**2022-03-04 06:36:11,448 maskrcnn_benchmark.inference INFO: Start evaluation on ic15_test dataset(500 images). 0%| | 0/500 [00:00<?, ?it/s]Traceback (most recent call last): File "tools/test_net.py", line 95, in main() File "tools/test_net.py", line 89, in main output_folder=output_folder, File "/home/ai/ContourNet/maskrcnn_benchmark/engine/inference.py", line 99, in inference predictions = compute_on_dataset(model, data_loader, device, inference_timer) File "/home/ai/ContourNet/maskrcnn_benchmark/engine/inference.py", line 20, in compute_ondataset for , batch in enumerate(tqdm(data_loader)): File "/opt/conda/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1005, in iter for obj in iterable: File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/opt/conda/lib/python3.6/site-packages/torch/_utils.py", line 385, in reraise raise self.exc_type(msg) AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ai/ContourNet/maskrcnn_benchmark/data/datasets/word_dataset.py", line 64, in getitem img, anno = super(WordDataset, self).getitem(idx) File "/opt/conda/lib/python3.6/site-packages/torchvision/datasets/coco.py", line 117, in getitem img, target = self.transforms(img, target) File "/home/ai/ContourNet/maskrcnn_benchmark/data/transforms/transforms.py", line 26, in call image, target = t(image, target) File "/home/ai/ContourNet/maskrcnn_benchmark/data/transforms/transforms.py", line 79, in call target = [t.resize(image.size) for t in target] File "/home/ai/ContourNet/maskrcnn_benchmark/data/transforms/transforms.py", line 79, in target = [t.resize(image.size) for t in target] AttributeError: 'dict' object has no attribute 'resize'

Traceback (most recent call last): File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/opt/conda/lib/python3.6/site-packages/torch/distributed/launch.py", line 253, in main() File "/opt/conda/lib/python3.6/site-packages/torch/distributed/launch.py", line 249, in main cmd=cmd) subprocess.CalledProcessError: Command '['/opt/conda/bin/python', '-u', 'tools/test_net.py', '--local_rank=0', '--config-file', 'configs/r50_baseline.yaml']' returned non-zero exit status 1. root@0001ea0b0712:/home/ai/ContourNet#**

Now I try to install torch1.0.0 again and I will put the result here later.

sssimpleboy commented 2 years ago

还是安装失败了- - 这次甚至第一个setup都没成功 root@1d10e780c451:/home/ai/cocoapi-master/PythonAPI# python setup.py build_ext install running build_ext skipping 'pycocotools/_mask.c' Cython extension (up-to-date) building 'pycocotools._mask' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I../common -I/usr/include/python3.6m -c ../common/maskApi.c -o build/temp.linux-x86_64-3.6/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99 ../common/maskApi.c: In function 'rleToBbox': ../common/maskApi.c:141:31: warning: 'xp' may be used uninitialized in this function [-Wmaybe-uninitialized] if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; } ^ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I../common -I/usr/include/python3.6m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.6/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99 pycocotools/_mask.c:6:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

sssimpleboy commented 2 years ago

这次是 torth=1.0.1, torchvision=0.2.2 python=3.6.7.

123cjjjj commented 2 years ago

遇到了同样的问题,请问你是怎么解决的?

sssimpleboy commented 2 years ago

遇到了同样的问题,请问你是怎么解决的?

忘记了,看报错是 dict 没有resize, 那就把图片找出来就好了。