Я использую Pytorch для создания класса Image Classification с Transfer Learning, но это ошибка в
OSError Traceback (most recent call last)
<ipython-input-19-9adf0e1aec22> in <module>
----> 1 base_model = train_model(res_mod, criterion, optimizer_ft, exp_lr_scheduler, num_epochs=3)
2 visualize_model(base_model)
3 plt.show()
<ipython-input-17-38c3b83cfa49> in train_model(model, criterion, optimizer, scheduler, num_epochs)
23 print('Iterating through data...')
24
---> 25 for inputs, labels in dataloaders[phase]:
26 inputs = inputs.to(device)
27 labels = labels.to(device)
C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in __next__(self)
580 self.reorder_dict[idx] = batch
581 continue
--> 582 return self._process_next_batch(batch)
583
584 next = __next__ # Python 2 compatibility
C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py in _process_next_batch(self, batch)
606 raise Exception("KeyError:" + batch.exc_msg)
607 else:
--> 608 raise batch.exc_type(batch.exc_msg)
609 return batch
610
OSError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 99, in <listcomp>
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\ProgramData\Anaconda3\lib\site-packages\torchvision\datasets\folder.py", line 138, in __getitem__
sample = self.loader(path)
File "C:\ProgramData\Anaconda3\lib\site-packages\torchvision\datasets\folder.py", line 174, in default_loader
return pil_loader(path)
File "C:\ProgramData\Anaconda3\lib\site-packages\torchvision\datasets\folder.py", line 157, in pil_loader
return img.convert('RGB')
File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 930, in convert
self.load()
File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\ImageFile.py", line 249, in load
"(%d bytes not processed)" % len(b)
OSError: image file is truncated (17 bytes not processed)
Я пытаюсь ImageFile.LOAD_TRUNCATED_IMAGES = True, но это не работает, я не понимаю с его ошибкой тоже