tianzhi0549 / FCOS

FCOS: Fully Convolutional One-Stage Object Detection (ICCV'19)
https://arxiv.org/abs/1904.01355
Other
3.28k stars 630 forks source link

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

Closed jewelc92 closed 5 years ago

jewelc92 commented 5 years ago

When I train on the coco dataset on single GPU, my datapath is FCOS-master/datasets/coco, in the coco folder are annotations, train2014 and val2014 folders, in the annotations folder are instances_train2014.json and instances_valminusminival2014.json, and I input "python -m torch.distributed.launch --nproc_per_node=1 --master_port=$((RANDOM + 10000)) tools/train_net.py --skip-test --config-file configs/fcos/fcos_R_50_FPN_1x.yaml DATALOADER.NUM_WORKERS 0 OUTPUT_DIR training_dir/fcos_R_50_FPN_1x", then I ran into the AttributeError: Traceback (most recent call last): File "tools/train_net.py", line 174, in main() File "tools/train_net.py", line 167, in main model = train(cfg, args.local_rank, args.distributed) File "tools/train_net.py", line 73, in train arguments, File "/cj/maskrcnn_benchmark/engine/trainer.py", line 56, in dotrain for iteration, (images, targets, ) in enumerate(data_loader, start_iter): File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 560, in next batch = self.collate_fn([self.dataset[i] for i in indices]) File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 560, in batch = self.collate_fn([self.dataset[i] for i in indices]) File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 85, in getitem return self.datasets[dataset_idx][sample_idx] File "/cj/maskrcnn_benchmark/data/datasets/coco.py", line 67, in getitem img, anno = super(COCODataset, self).getitem(idx) File "/miniconda/envs/py36/lib/python3.6/site-packages/torchvision-0.2.3a0+9077164-py3.6-linux-x86_64.egg/torchvision/datasets/coco.py", line 114, in getitem File "/cj/maskrcnn_benchmark/data/transforms/transforms.py", line 15, in call image, target = t(image, target) File "/cj/maskrcnn_benchmark/data/transforms/transforms.py", line 60, in call target = target.resize(image.size) AttributeError: 'list' object has no attribute 'resize' Traceback (most recent call last): File "/miniconda/envs/py36/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/miniconda/envs/py36/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/distributed/launch.py", line 235, in main() File "/miniconda/envs/py36/lib/python3.6/site-packages/torch/distributed/launch.py", line 231, in main cmd=process.args) subprocess.CalledProcessError: Command '['/miniconda/envs/py36/bin/python', '-u', 'tools/train_net.py', '--local_rank=0', '--skip-test', '--config-file', 'configs/fcos/fcos_R_50_FPN_1x.yaml', 'DATALOADER.NUM_WORKERS', '0', 'OUTPUT_DIR', 'training_dir/fcos_R_50_FPN_1x']' returned non-zero exit status 1.

What should I do?

tianzhi0549 commented 5 years ago

@jewelc92 Did you change any of the codes?

jewelc92 commented 5 years ago

@jewelc92 Did you change any of the codes?

No, I did not make any change on the codes.

jewelc92 commented 5 years ago

I ran the codes in docker, and ran the demo/focos_demo.py successfully, is there any possibility that some wrong with the docker?

tianzhi0549 commented 5 years ago

@jewelc92 I do not know if the error is related to docker. But I notice that you are using a different version of torchvision with us. Can you try to use torchvision==0.2.1 instead?

Xavier-Zeng commented 5 years ago

@tianzhi0549 I solved the same problem by your method

# uninstall torchvision already installed
pip uninstall torchvision
# install torchvision==0.2.1
pip install torchvision==0.2.1 
tianzhi0549 commented 5 years ago

@EDG-Zola Thank you for posting it!

jewelc92 commented 5 years ago

I solve the problem too by replacing the torchvision version, thank you very much

tomorrow1210 commented 5 years ago

I solve the problem too by replacing the torchvision version, thank you very much