OSError: cannot find loader for this HDF5 file
Opened this issue · 3 comments
Why do I get this error? How can I solve it?Traceback (most recent call last): File "feature_extraction/patch_extraction.py", line 25, in <module> enc_name=model_name, dataset='BRIGHT', batch_size=args.batch_size) File "/home/hp/new/lgq/MG-Trans-main/feature_extraction/patch_extraction_utils.py", line 113, in create_embeddings save_embeddings(model, fname, dataloader, enc_name) File "/home/hp/new/lgq/MG-Trans-main/feature_extraction/patch_extraction_utils.py", line 53, in save_embeddings for batch, coord in dataloader: File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 363, in __next__ data = self._next_data() File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 989, in _next_data return self._process_data(data) File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data data.reraise() File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) OSError: Caught OSError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop data = fetcher.fetch(index) File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/hp/new/lgq/MG-Trans-main/feature_extraction/patch_extraction_utils.py", line 134, in __getitem__ img = Image.open(fn).convert('RGB') File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/PIL/Image.py", line 873, in convert self.load() File "/home/hp/anaconda3/envs/lgq-MG/lib/python3.7/site-packages/PIL/ImageFile.py", line 323, in load raise OSError("cannot find loader for this %s file" % self.format) OSError: cannot find loader for this HDF5 file
It shows that the problem is here. Did I make a mistake in the steps? This has been bothering me for a long time.
你好我也遇到了这个问题,是出现在patch extraction的时候,我重新运行了上一步create patches就解决了,你可以试一试
(Hello, I also encountered this problem. When it appeared in patch extraction, I rerun the previous step create patches and solved it. You can try it.)
你好我也遇到了这个问题,是出现在patch extraction的时候,我重新运行了上一步create patches就解决了,你可以试一试 (Hello, I also encountered this problem. When it appeared in patch extraction, I rerun the previous step create patches and solved it. You can try it.)
Hello, when I use the h5 files created in the previous step of creating patches, I encounter an error during patch extraction. How did you resolve it?
patch extraction
你好我也遇到了这个问题,是出现在patch extraction的时候,我重新运行了上一步create patches就解决了,你可以试一试 (Hello, 我也遇到过这个问题。当它出现在补丁提取中时,我重新运行上一步创建补丁并解决了它。你可以试试。
Hello, I repeated the step of creating patches, but I still encounter an error during patch extraction. It's worth mentioning that the h5 files generated during the create patches step do not have their parent directory. During patch extraction, I received a NotADirectoryError: [Errno 20] Not a directory: 'data_prepare/BRIGHT/patches_512/TCGA-49-6744-01A-01-TS1.cb8c4bda-8e2b-45e1-a7ec-7db89e297f5d.h5'. I manually created the parent directory to resolve this issue, but then encountered another error: OSError: cannot find loader for this HDF5 file.