Closed chentao2016 closed 4 years ago
Hi @chentao2016 , COCO already has the information we need (e.g. ids of all images that contain a certain class), so no preparation is needed. All preprocessing is handled by COCO Dataset class.
Thank you.
Thank you for your reply. When I train and test for coco dataset, sometimes I encounter the following error ("OSError: image file is truncated" ) suddenly. As shown below, it happens during the training after step 23300.
step 23200: loss: 0.2685678899172565, align_loss: 0.18199997818072525
step 23300: loss: 0.2685404613065681, align_loss: 0.18187280085978194
ERROR - PANet - Failed after 0:43:37!
Traceback (most recent calls WITHOUT Sacred internals):
File "train.py", line 83, in main for i_iter, sample_batched in enumerate(trainloader): File "/farm/ct/anaconda3/envs/pt13/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next
return self._process_data(data)
File "/farm/ct/anaconda3/envs/pt13/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
data.reraise() File "/farm/ct/anaconda3/envs/pt13/lib/python3.6/site-packages/torch/_utils.py", line 385, in reraise
raise self.exc_type(msg)
OSError: Caught OSError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/farm/ct/anaconda3/envs/pt13/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/farm/ct/anaconda3/envs/pt13/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 "/farm/ct/anaconda3/envs/pt13/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
That could be caused by a corrupted image. You can use try/except to catch the error and get the image_id and then see if that particular image can be opened in python without error.
Here are some links I found that might be useful.
FYI, my PIL version is
PIL.VERSION=1.1.7
PIL.PILLOW_VERSION=5.4.1
Thank you.
Following your guidance, I find the corrupted image that causes this error. Thanks!
I notice that COCO contains 80 classes but the id is from 1-90 (skip some id, for example,12). Therefore, I was wondering whether the following code can get the very 80 classes that you want.
'COCO': { 'all': set(range(1, 81)), 0: set(range(1, 81)) - set(range(1, 21)), 1: set(range(1, 81)) - set(range(21, 41)), 2: set(range(1, 81)) - set(range(41, 61)), 3: set(range(1, 81)) - set(range(61, 81)), }
The mapping from label indices (1-80) to coco class_id (1-90) is done here.
Thank you.
Ok, I get it now, thanks. Nice code!
Thanks for your great work!
Could you give me some instructions about the Data Preparation for COCO Dataset?