mrlooi / rotated_maskrcnn

Rotated Mask R-CNN: From Bounding Boxes to Rotated Bounding Boxes
MIT License
350 stars 62 forks source link

PIL problems #12

Closed amiormu closed 4 years ago

amiormu commented 4 years ago

❓ Questions and Help

Hello! Very good job! However, when I run the code, I can run well at first. But it has a problem after that.

Traceback (most recent call last): File "tools/train_net.py", line 196, in main() File "tools/train_net.py", line 189, in main model = train(cfg, args.local_rank, args.distributed) File "tools/train_net.py", line 89, in train arguments, File "/data/fmy/rotated_maskrcnn-master/maskrcnn_benchmark/engine/trainer.py", line 57, in dotrain for iteration, (images, targets, ) in enumerate(data_loader, start_iter): File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 551, in next return self._process_next_batch(batch) File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 572, in _process_next_batch

raise batch.exc_type(batch.exc_msg)

OSError: Traceback (most recent call last): File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 85, in getitem return self.datasets[dataset_idx][sample_idx] File "/data/fmy/rotated_maskrcnn-master/maskrcnn_benchmark/data/datasets/coco.py", line 69, in getitem img, anno = super(COCODataset, self).getitem(idx) File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torchvision/datasets/coco.py", line 117, in getitem img = Image.open(os.path.join(self.root, path)).convert('RGB') File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/PIL/Image.py", line 930, in convertvi self.load() File "/home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/PIL/ImageFile.py", line 249, in load "(%d bytes not processed)" % len(b) OSError: image file is truncated (20 bytes not processed)

I am confused on this error. Can you help me ? Thanks a lot!

amiormu commented 4 years ago

thx! Maybe i had solved this question

I used the following way:

vi /home/tensor/anaconda2/envs/rotated_maskrcnn/lib/python3.6/site-packages/torchvision/datasets/coco.py

and then add this after call PIL:

from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True

I am still running and waiting for bugs. If it runs normally, i will close this issue.

Good luck!