CLAM icon indicating copy to clipboard operation
CLAM copied to clipboard

KeyError: "Unable to synchronously open attribute (can't locate attribute: 'patch_level')"

Open MarioPaps opened this issue 9 months ago • 1 comments

Hi,

I ran the patch creator script to generate h5 files. I then ran the 'create_features_fp.py' script to obtain feature vectors. However, I get the following error: Traceback (most recent call last): File "/rds/general/user/kp4718/home/RCS_help/CLAM/extract_features_fp.py", line 100, in dataset = Whole_Slide_Bag_FP(file_path=h5_file_path, File "/rds/general/user/kp4718/home/RCS_help/CLAM/dataset_modules/dataset_h5.py", line 65, in init self.patch_level = f['coords'].attrs['patch_level'] File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "/rds/general/user/kp4718/home/anaconda3/envs/clam_latest/lib/python3.10/site-packages/h5py/_hl/attrs.py", line 56, in getitem attr = h5a.open(self._id, self._e(name)) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5a.pyx", line 80, in h5py.h5a.open KeyError: "Unable to synchronously open attribute (can't locate attribute: 'patch_level')"

I checked the h5 files and I found that they do not have the attribute patch_level.

What options should I give to create_patches.py to avoid this error? I ran it as follows: python create_patches.py --source surformerpat --save_dir surformertiles --patch_size 256 --patch_level 2 --seg --patch --stitch

MarioPaps avatar May 01 '24 16:05 MarioPaps

maybe you need to run extract_features_fp.py

MohammedHAlali avatar Jul 02 '24 18:07 MohammedHAlali